Though this change isn't fully set in stone. We have to revisit if we
add motion between physical domains. This change would at least prevent
segfaults when domains are destroyed.
Collision detection should fully be handled by the domain, as should
sight checking.
The plan is to let the domain keep a separate structure of all collision
geometry, optimized in something like a quad or oct tree. Since the vast
majority of geometry is static, in the sense that it very seldom moves,
the Domain should keep a flat representation of all geometry, with
precomputer meshes for fast lookup.
Similarily it should keep a separate structure, or structures, for sight
checks.
And it should of course also use Bullet for collision detection.
* rulesets/Motion.cpp, rulesets/Motion.h: Remove the support for
hierarchical location model from the collision system. From
now on there will be a flat movement space.
* physics/Vector3D.h, physics/Vector3D.cpp: Move a bunch of inline
functions in the header to be non-inline in the body. Use
the forward declaraions in wfmath/const.h instead of having to
include the full headers.
* rulesets/Motion.cpp, rulesets/Motion.h, rulesets/Movement.h,
rulesets/Py_Point3D.h, rulesets/Py_Vector3D.h: Include wfmath
headers as required.
* client/CreatorClient.cpp, client/CreatorClient.h,
client/Py_CreatorClient.cpp, common/BaseWorld.h, common/types.h,
modules/Location.cpp, modules/Location.h,
rulesets/AtlasProperties.cpp, rulesets/AtlasProperties.h,
rulesets/BaseMind.cpp, rulesets/Character.cpp, rulesets/Character.h,
rulesets/Entity.cpp, rulesets/Entity.h,
rulesets/EntityProperties.cpp, rulesets/LocatedEntity.cpp,
rulesets/LocatedEntity.h, rulesets/MemEntity.cpp,
rulesets/MemEntity.h, rulesets/MemMap.cpp, rulesets/Motion.cpp,
rulesets/Motion.h, rulesets/Py_Location.h, rulesets/Py_Mind.cpp,
rulesets/Py_Thing.cpp, rulesets/Py_Thing.h,
rulesets/PythonMindScript.h, rulesets/PythonScript.h,
rulesets/PythonThingScript.cpp, rulesets/PythonThingScript.h,
rulesets/Python_API.cpp, rulesets/Script.cpp, rulesets/Script.h,
rulesets/Thing.cpp, rulesets/World.cpp, server/WorldRouter.cpp,
server/WorldRouter.h: Refactor all the entity code so there is now
a new base class for entities in the world simulation, and in the
mind which only contains things which are trully common to both.
This moves a lot of functionality which should not have been
present in mind entities away, and makes that code safer and more
efficient.
* tests/TestWorld.h: Update the test world API to match the base
class.
* rulesets/Motion.cpp, rulesets/Motion.h: Add method and storage
to note what the reference number of the next update op should
be.
* rulesets/Thing.cpp: Note the current serialno as the refno of the
expected update op, and ignore all others obsolete update ops.
* rulesets/Motion.h: Rename to clearCollision() to adhere to
convention.
* rulesets/Motion.cpp: Implicitly clear a pending collision whenever
one is resolved.
* rulesets/Thing.cpp: Cut in the new collision resolution code.
* rulesets/Motion.h: Add method to clear the collision flag.
* rulesets/Thing.cpp: Clear the collision flag once it has been
handled, and improve code harmonisation between MoveOp and
UpdateOp handlers.
* rulesets/Motion.h, rulesets/Motion.cpp: Add flag and time to sore
info about collisions.
* rulesets/Thing.cpp: Rambling messy code to detect and act on
predicted collisions.
* rulesets/Motion.h, rulesets/Motion.cpp: Add method to check for
collisions.
* rulesets/Thing.cpp: Use Motion::checkCollisions to output debug
data about collisions.
* rulesets/Motion.h, rulesets/Motion.cpp: Add a little more API,
and provide stubs of existing methods.
* rulesets/Thing.cpp: Add a motion instance to all physical
entities, and pass mode setting to it.