Friday, May 28, 2010

Practical Examples in Data Oriented Design

Here are the slides from my talk at the Sthlm Game Developer Forum yesterday:

4 comments:

  1. Very good read, thanks!(is there audio btw?) I wonder if there is a good book on data oriented approach...

    ReplyDelete
  2. Thank you very much! The ideas reflect my practice as well, but here they are compiled in one presentation!

    ReplyDelete
  3. Interesting read, I hope it's ok to ask some questions for such an old post..
    I'm designing a scene graph now and decided to try the data oriented approach, but I can't figure out how to do certain things cleanly..
    Regarding the scene graph, how would one remove or add a node? If deleting a node involves moving all nodes below it to the left in the array, isn't that slow?
    Also, the index for the mesh would have to be updated, which means that adding new objects that attach to the scene graph would involve changing the "remove node" function, correct? Do I have to search through all meshes to see if the node index for each mesh needs to be updated?
    Thanks for a great blog.

    ReplyDelete
  4. Note that our "scene graphs" do not cover the entire scene, only the objects within a particular entity. So adding or removing nodes is actually not a very common operations. (You would seldom add a new mesh to an entity.) So the system is not super optimized for that case. It is optimized for the common case of updating the scene graph.

    That said, to add a node as a leaf (which you would normally do), you would just add it to the end of the scene graph array.

    Removing a node isn't really necessary. You can just leave it in the scene graph. Unless you have some use case where you constantly add and remove nodes, but we don't have that.

    Relinking within the entity's scene graph is thus the only thing that actually would require things to move around in the array. But that is an even more rare thing to want to do. You would seldom want to relink so that the hand is before the shoulder in the scene graph, for instance. So you can afford to have special, expensive code for those rare cases.

    ReplyDelete