I am going through the process of rethinking my current game engine's design. And I'd like to ask about some information from other's experiences about scene graph. Before we begin, this graph is in no way shape or form going to be used directly for culling, however, it may possibly send data to the Quad-Tree system for culling. And it may limit data being sent.
The game's construction is currently using something that might be a bit of an oddball set up. It's an entity component system, but Entities are only crafted in LUA. A few of it's components are just wrappers to the C++ framework.'
Which means that the scene graph does not see entities. It just sees transforms of arbitrary objects. The benefit is that not everything in the scene needs to be an entity. However... I have to currently throw away or modify the code as it uses a structure of arrays design.
Right now, the planed re-implementation of the scene graph will do a few things.
- Transform children's to their parent's fixed point.
- Act as a loader for Terrain Cells and Dungeons. Cell files will simply be a branch of the scene graph with tags for static, and persistent objects (Objects that can move). The benefit of this is I can just store objects as a local to that cell in it's file, rather than having to have some sort of transform that is world dependent.
- Supply the render system with a view-space coordinates (Camera is origin) rather than world coordinates. (I have no idea what DirectX's limitations are. But OpenGL is limited to 32bits last I checked. Float point accuracy becomes a major problem.)
- Party Characters can possibly be split up across a large world. Possibly only send the cells near the camera to the render engine.
- Entities skeletal system will be a scene graph managed by the entity it's self. But can be updated by the animation system. This is a pre-engineering design inspired by bitsquid. Unlikely to be used, but in case systems need to be reorganized, it helps.
What should the scene graph actually handle in the world? Or would this be completely dependent on how I architect the system? From researching the ways a lot of big daddy engines handle things, everything that is a concept of matter is in the scene graph.
If I decide to use a cell based system, what owns things that can wander? Example... a player walks into some arbitrary cell (int16 X,int16 Y, in16 Z). When the scene graph calculates world coordinates, it translates into (float64 x, float64 y, float64 z).
Should the previous cell surrender ownership to the player, NPC, persistant object, or otherwise to the next cell. Or should the world just own them?
And lastly, if you do recommend this system. Could you provide me an example to an SoA method of implementing such a graph using a world Cell coordinate? The problem with SOA, is it usually implies you have a fixed type for everything. Unless, I simply keep everything as transforms. Then add extra data as hints?