Infinite world

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
User avatar
miloguy
Prole
Posts: 32
Joined: Sat Jul 02, 2011 2:09 am

Infinite world

Post by miloguy » Tue Sep 06, 2011 6:52 am

I plan on making a game with physics, and it's going to get bigger as you get farther away from the starting place. What should I do for smallest and largest positions in love.physics.newWorld()?

Thanks

User avatar
ivan
Party member
Posts: 1530
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

Re: Infinite world

Post by ivan » Tue Sep 06, 2011 7:34 am

Box2D has many constants so you're not going to be able to create a super huge physics world populated with bodies.
Even if you could create something like that, the lag of simulating it would make your game unplayable.
What you could try is to generate the physics objects as the player nears them.
Another approach is to split your 'infinate' world into 'screens' like in the original Zelda.
In both cases you would keep the bounds of your Box2D world farily small.

User avatar
miko
Party member
Posts: 409
Joined: Fri Nov 26, 2010 2:25 pm
Location: PL

Re: Infinite world

Post by miko » Tue Sep 06, 2011 12:38 pm

miloguy wrote:I plan on making a game with physics, and it's going to get bigger as you get farther away from the starting place. What should I do for smallest and largest positions in love.physics.newWorld()?

Thanks
You cannot have really infinite world within finite amount of RAM (unless your world is procedural). You need to think about your game design. For the beginning, you can make it "big enough", then splice it as needed.
My lovely code lives at GitHub: http://github.com/miko/Love2d-samples

User avatar
tentus
Inner party member
Posts: 1060
Joined: Sun Oct 31, 2010 7:56 pm
Location: Appalachia
Contact:

Re: Infinite world

Post by tentus » Tue Sep 06, 2011 3:05 pm

ivan wrote:Box2D has many constants so you're not going to be able to create a super huge physics world populated with bodies.
Even if you could create something like that, the lag of simulating it would make your game unplayable.
What you could try is to generate the physics objects as the player nears them.
Another approach is to split your 'infinate' world into 'screens' like in the original Zelda.
In both cases you would keep the bounds of your Box2D world farily small.
I should point out that people are always hating on Box2D around here, but in practice you can actually make a pretty big world. The largest subsection in, say, A Link to the Past, is easily within the limits of Box2D.

As a functional example, my platformer Kurosuke creates worlds that are 16384 units wide/tall by default. I can go larger, but I want to keep multiplayer running smoothly on netbooks (I have a little Asus that I use for testing).
Kurosuke needs beta testers

User avatar
Taehl
Dreaming in associative arrays
Posts: 1024
Joined: Mon Jan 11, 2010 5:07 am
Location: CA, USA
Contact:

Re: Infinite world

Post by Taehl » Tue Sep 06, 2011 9:39 pm

I faced the same dilemma in my game, miloguy. After a lot of thought and testing, I ended up finding out that the best solution was to drop Box2D and make my own physics system.
Earliest Love2D supporter who can't Love anymore. Let me disable pixel shaders if I don't use them, dammit!
Lenovo Thinkpad X60 Tablet, built like a tank. But not fancy enough for Love2D 0.10.0+.

User avatar
Jasoco
Inner party member
Posts: 3650
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: Infinite world

Post by Jasoco » Tue Sep 06, 2011 10:22 pm

That's what I'm doing for my 2D sidescroller engine. It's coming along pretty well and I haven't even touched Box2D, even for collisions. Box2D never works well, or at least realistically, for platformers. Yet everyone tries to use it.

User avatar
BlackBulletIV
Inner party member
Posts: 1260
Joined: Wed Dec 29, 2010 8:19 pm
Location: Queensland, Australia
Contact:

Re: Infinite world

Post by BlackBulletIV » Tue Sep 06, 2011 10:50 pm

Jasoco wrote:Box2D never works well, or at least realistically, for platformers. Yet everyone tries to use it.
Yeah I tried that... didn't work out well. Box2D is about being realistic, and that's not what platformers are.

User avatar
tentus
Inner party member
Posts: 1060
Joined: Sun Oct 31, 2010 7:56 pm
Location: Appalachia
Contact:

Re: Infinite world

Post by tentus » Wed Sep 07, 2011 12:00 am

Jasoco wrote:That's what I'm doing for my 2D sidescroller engine. It's coming along pretty well and I haven't even touched Box2D, even for collisions. Box2D never works well, or at least realistically, for platformers. Yet everyone tries to use it.
I guess Kurosuke is of no count, then. :P

Seriously, why do we even have Box2D in Love if everyone hates it so much?
Kurosuke needs beta testers

User avatar
slime
Solid Snayke
Posts: 2853
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: Infinite world

Post by slime » Wed Sep 07, 2011 12:27 am

tentus wrote:Seriously, why do we even have Box2D in Love if everyone hates it so much?
People often misunderstand its uses (or how to use it) because it's essentially a whole new API on top of regular LÖVE. I personally love it, but I also know when to use it and when to stick with my own solution.

User avatar
miko
Party member
Posts: 409
Joined: Fri Nov 26, 2010 2:25 pm
Location: PL

Re: Infinite world

Post by miko » Wed Sep 07, 2011 7:09 am

tentus wrote:
Jasoco wrote:That's what I'm doing for my 2D sidescroller engine. It's coming along pretty well and I haven't even touched Box2D, even for collisions. Box2D never works well, or at least realistically, for platformers. Yet everyone tries to use it.
I guess Kurosuke is of no count, then. :P

Seriously, why do we even have Box2D in Love if everyone hates it so much?
The question is why everyone hates it ;) And why do we have Box2d in Love? Because everyone has it (it is common on iPhone, Android, and in other game engines).
So I guess it is good to have it also in Love (despite the fact that I have never used it).
My lovely code lives at GitHub: http://github.com/miko/Love2d-samples

Post Reply

Who is online

Users browsing this forum: No registered users and 10 guests