Physics in a Cell and Portal universe

Published May 11, 2011
Advertisement
I have regretfully omitted to mention something quite important, although I did allude to it.
How do we track which subspace an entity is in at any given moment - and what happens if an entity is poking partly through a portal?

We can handle this two ways, but personally, I think it's helpful to make the following declaration:

AN ENTITY'S CURRENT CELL IS DEFINED BY THE LOCATION OF ITS ORIGIN.

The origin of anything is an infinitely small point in space, occupying zero volume.
We can, as mentioned, utilize the BSP tree structure to quickly determine which subspace or cell contains a given point.
So we can say for certain which cell contains a given entity (say, the camera).
But what if the entity is partly sticking through one or more portals? Is the entity actually in more than one cell?

For the purposes of collision detection, visibility and etc, the answer is YES, we are going to have to take this entity into account when processing the neighboring cell.
But for the purpose of answering the query 'what cell am i in', the answer is NO, an entity is 'owned' by the cell that contains its origin.

The physical simulation of the game world can be partitioned by Cell, but NOT CLEANLY - we must support the notion of a 'dirty list' of entities that belong to other cells, and yet are partially invading the given cell, and so could potentially be involved in collisions. We need something that is not exactly 'simulation islands' but more something like 'simulation peninsulas' or maybe 'simulation islands with floating walkways' ( :P )

Even with this extra cost of maintaining the 'dirty lists', we're still several orders faster than if we only had one big simulation.
0 likes 0 comments

Comments

Nobody has left a comment. You can be the first!
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement