2000-02-25 00:22:36 UTC
One problem that has been gnawing on the back of my
mind for a while has been one of seperation of the
equations governing physical entities who are
independent of each other.
i.e. During collisions the "best" ( not best
performance but garuanteed not to mess up the
simulation ) handling of collisions is to rewind the
entire simulation back to the point just before the
collision, deal with the collision and then continue.
A huge drawback to this is that if one entity
collides, then you need to redo _all_ the computations
for every entity in the world.
Another thing that is desireable is to detect entities
whose state is not changing ( rest on ground not
moving ) and then not compute those guys until
something happens to them.
The best optimization of the physics lib is obviously
to minimize the number of computations every frame.
Another constraint I have is that I don't want the
physics lib to duplicate all the 3d data in the world.
I came to the conclusion that the "cleanest" way to
seperate entities is to have non-interacting entities
exist in their own worlds ( class ctWorld ). This
sort of dumps the responsibility for this sort of
thing on the application. csphyziks would supply some
interface to support this kind of thing, i.e. like
callbacks when an object is at rest or start moving
So it would be the responsibility of the app to move
entities between worlds.
I think this allows for a lot of flexibilty. The app
could have one world per sector for a CS app. For a
FPS you could have one world for objects at rest, one
for objects that never rest and are still computed
when out of sight, and one for each player ( which
contains all entities close to that player ). For a
networked game you could have clients compute their
own worlds and send the results back to the server.
It would really be different for different
One disadvantage of this approach is the extra
overhead required by lots of worlds ( also some world
management code is needed ). But I think the
advantages far outwiegh these small disadvantage.
A layer could be put on top of csphyziks and collision
detection that would handle all this and try to
generalize things, but I don't know how effective this
Just thinking out loud :)
- Michael Alexander Ewert
Do You Yahoo!?
Talk to your friends online with Yahoo! Messenger.