   How to handle scene management
  Sorry for the long post, I hope people will have the patience to read it and make some suggestions.I''m trying to design a scene management system which will handle graphics and visualisation, and am just wondering if this is a good way to do it:  Game | |World Manager /    \/ \    /   \   /\   Physics Mgr Scene Graph||Render ManagerEach section communicates with the others via a messaging system, so no section will call any functions from a different part, except a process message function. The thing I''m having trouble with is the scene graph and loading models etc.I''m thinking it would go like this:The Game says to the World Manager "Load level: level.lev"The World Manager will parse the level and open individual files for each entity, passing the position/bounding box/type to the physics manager, registering a new object for physics interractions.It should also pass information to the scene graph, to add a graphics object to represent the entity.The thing is, I want my scene graph to generate a list of renderables which the render manager will render. The renderables will all be the same structure, and will be like this:Vertex Buffer NumberIndex Buffer NumberPrimitive TypeStart IndexNumber of PrimitivesVertex Shader NumberPixel Shader NumberTexture Number (Stage 0, 1, 2....)Whenever the scene graph needs to add a new object, it should ask the render manager if the mesh details are already loaded into the vertex buffer, and get back the VB/IB IDs and the texture IDs etc, and then add an object to the scene which contains this information, and a transformation. But, because the World Manager will be opening the meshes and sending the mesh details (e.g. vertex details) to the scene graph, how could the scene graph check if these are already loaded, instead of just adding the vertex details to the render manager?Damn, that''s long, probably doesnt make any sense (if anyone bothered to read it), and I don''t think it actually asks any clear questions. I guess I''m just going to have to sleep on it.   ---------------------------------------Let''s struggle for our dream of Game!http://andrewporritt.4t.com
  This is one of the particularly tricky aspects of programming scene management. I would say forget trying to avoid any direct function calls between the managers - you''ll end up confusing matters I think. There are some relationships that should be done without a message paradigm to link them e.g. collision detection - the physics module may as well have full access to the geometry so it can test collision directly, or better yet the physics module has access to a collision query interface - which then uses an optimised algorithm based upon the format used to organise the geometry in the scenegraph e.g. have different specific routines for octrees, BSP trees etc..To answer your question with regard to loading meshes/entities, I think that you''re trying to do the loading in two steps: 1) load entity details (by World manager)2) load geometry into a vertex buffer (by scene graph)I think that you would be better off combining the two steps together and having the world manager directly interact with the render manager. I know that it''s nice to have a clearly defined heirarchy, but the reality of design is that it''s not always possible to do, whilst maintaining speed and efficiency.Hope this helps.;  Yeah, thanx. I guess I just wanted a well defined hierarchy, but I suppose it could still be tidy if I link the Render Manager to the World Manager, as long as I''m careful. The messaging system would probably create quite a bit of overhead as well, so I think I''ll scrap it. Thanx a lot, that''s really helped.   ---------------------------------------Let''s struggle for our dream of Game!http://andrewporritt.4t.com