Data Oriented Design - class hierarchies

Currently I've been reading up on DOD and its benefits over OOP in games with cache speed in mind. I think I've read everything easy to find on the web, and I do understand the principles of keeping data structs small and worked on as much as possible whilst still in memory to reduce cache loading/misses. But I just can't seem to get that eureka moment when it comes to piecing it all together in a program.

say for example I have a bat and ball game, i need to draw 1 sprite for bat and 1 for ball, and 1 for brick many times over, then check for collisions between all bricks and 1 ball, then all bricks and bat (consider the bat and bricks can move freely), what kind of interaction would the classes have?

At the moment I would have a collsion object within an entities manager object, enman would have a checkcollision() which would take 2 arrays of objects arguments and set relevant flags in the objects as to whether they collided. As for drawing Im not entirely sure about what i would do.

please consider that I have already googled and I havent found any examples of classes working together with DOD in mind.

if youre reading this and youve never heard of DOD this sums it up pretty well.

http://www.gamedev.net/topic/575076-what-is-data-oriented-programming/page__st__20
Last edited on
DOD isn't opposed to OOP, it's supplimentary. I think it's using the Flyweight Pattern to handle lots of things more efficiently than doing things one at a time. But you're still dealing with objects.

See: http://stackoverflow.com/questions/1641580/what-is-data-oriented-design
please assume that ive read that and anything else that turns up in google and am just looking for a simple class hierarchy example to get kick started.
Topic archived. No new replies allowed.