[ODE] Large physics worlds - let autodisable handle it, or create
a sliding window of physical activity?
gcarlton at iinet.net.au
Thu Apr 21 10:14:39 MST 2005
If indeed only the player(s) can initiate interaction, then most objects
should autodisable anyway, except for cases where you don't want them to
- e.g. touching a ball that rolls down a long incline. On the other
hand you may want "freezing" for more than ODE, as there are logic
updates and networking to consider.
A while ago I did some experimenting with ODE in a large dynamically
generated world. In my case I had sections large enough so that you
could only see as far as the next one - worst case was 4 sections in
view if the player stands in a corner. Each section had its own
simulation in its own coordinate system - there was some juggling back
and forth for objects that touched into the neighbouring section. That
proved necessary because float starts losing precision when the world
gets very large.
On top of that I built the system so that objects outside the max range
(a sphere with radius bit more than visible range) get forcably
disabled, no logic, no physics, and no networking to clients. If the
player starts coming back towards them they turn on, if the player
leaves the entire section it gets unloaded and the objects destroyed.
However if you have small sections then you may not need this because
you can just use the sections themselves for it, rather than a bounding
sphere (or actually a set of bounding spheres for MP).
Not sure this helps, but let us know how you get on!
Megan Fox wrote:
>Let me explain my world, first of all. Explorable, free-form,
>non-linear RPG world. Physics are a boon because they give players
>yet another possible option in solving problems (and creating them,
>for the evil characters, poor NPCs crushed by rolling logs and such).
>Now because of that, I of course manage things such that not too much
>of the world is ever in memory at once. I'm working with load regions
>that are tenatively set at 204.8 meters square, but that's a fairly
>arbitrary value (first test heightmap was 256x256, scaled by 8, with
>world scale 0.1 - 256x8x0.1 = 204.8), and physics need only be active
>to the region that the player can influence without crossing a load
>It's the region I'm asking about here.
>I see two options. In one, I simulate the entire load zone,
>everything has a physical representation that needs one. The
>simulation extends beyond the barrier of the load zone out to max
>visible range for the sorts of small objects that can be physically
>active (meaning a ball rolled outside the zone would fade out of view
>just before I turned it off physically and it stood stock-still).
>Everything is alive at once, which could be expensive, but with
>auto-disable active it should all in theory be mostly turned off
>almost all the time. (this assumes NPCs can't initiate any sort of
>physical interaction without the presence of the player, which is
>fairly accurate, since NPCs exist more as state machines than entities
>when outside the range of the player)
>The other option is to simulate only within a bubble around the
>player. Things like terrain stay loaded in memory the entire time,
>but balls and people and ragdolls lose their physical representation
>when the player's bubble leaves the region (thus freezing them in
>space until the bubble comes back). This is more work on my part, and
>it can make for some strange occurences (explosion happens as player
>walks away, explosion freezes until player comes back, probably to be
>greeted by flying objects with no apparent cause since the explosion
>animation finished playing a long time), but if auto-disable won't do
>what I think it's the only other option.
>I'm of the mind I'm almost definately stuck with option #2, but I'm
>wondering if anyone else has tried anything similar and found that
>option #1 was actually viable? So long as you're intelligent with
>your auto-disabling (disabling islands instead of individual bodies),
>it seems as if your system would effectively disable most of the load
>zone for you anyways, but keep everything consistent and moving if
>there was a force applied some distance from the player. But then
>again, maybe even disabled bodies present some sort of drag on the
>system that would kill it?
>ODE mailing list
>ODE at q12.org
More information about the ODE