• Home
  • About
    • Biography
    • Contact Info
  • Projects
    • 2D Map Editor
    • Dodge and Destroy
    • Intruder's Run
    • Procedural Terrain
    • Jim Bob's Jam
Nickpdevelop.net

Update, and DOD/education rant 09/06/2011 at 02:21

Hello! First a little update: uploaded a new video to show off the screen managemnet/menu system I implemented for Dodge and Destroy, as well as uploaded the source. I also included with the source a release build that should work under windows with processors that support x86 instruction set. Haven’t tested it under Linux so not 100% sure if it works but the code should compile under Linux as well.

Second I would just like to discuss Data Oriented Design a little bit. Throughout my university career, in most classes we were taught strictly about Object Oriented Design, and how to engineer our software around concepts. It wasn’t until later in my final year (this past spring) that I really got introduced to Data Oriented Design, however the course wasn’t focused on it. The course focused on parallelism and writing algorithms to take advantage of task and data parallelism. In order to take advantage of parallelism however you need to manipulate your data; keep all data of a specific type together and take advantage of filling cache lines and reducing cache misses. Even in single threaded systems by reducing the amount of cache misses you will increase performance by a lot as the CPU as access to data much quicker. It is much easier to perform parallel operations and design parallel algorithms on data that is neatly structured and of a single type. During this course my mind was blown how some simple manipulations to data in a GPGPU program can speed up a matrix multiplication on an extremely large data set by a significant amount.

As technology progresses we are going to have to stop thinking about algorithms/systems in a single threaded matter and start developing to maximize parallelism provided by things like the GPU, and multi-cored processors. This is where hardware is progressing so we must start developing with this in mind. These hardware advances allows us to manage more data quicker, and thus we must shift from focusing our teachings on OOP, and start thinking DOD in my opinion. While OOP works well for single objects, for GUI’s, it is extremely inefficient when managing a plethora of game entities. When I began learning about designing around data as opposed to objects outside of school I just didn’t understand why there was so much emphasis on OOP when in the near future if we are to take advantage of hardware we must design our systems around the Data instead.

Now I say this yet I still have been developing my games in the meantime with OOP in mind. Mostly it is because it was how I was taught, and when I began developing games like Dodge And Destroy I developed it in an OOP manner. Eventually my goal is to slowly change this over to a data orient approach which will not only speed up performance, but allow for multi-threading to occur. For instance: instead of processing an enemy object by calling enemy->update() each enemy independently which creates A LOT of cache misses the more enemies there are, I could process all of the positions at once by looping through an array containing all of their positions. Same goes for collision detection etc, if we loop through the raw data, and keep data elements 16, 32 bits large, more data can be stored in a cache line resulting in less cache misses, and an huge increase in performance. I am already taking this approach with my XNA game, and beginning development with a Data Oriented approach is much easier then beginning with OOP and switching everything over to fit a DOD paradigm.

Now I haven’t gone into detail fully about DOD, and its advantages, and explained in detail why its much more efficient for game design, but my point is why wasn’t this taught throughout my education from the beginning? My time at University was mostly spent thinking Object Oriented, while we did learn little bits about cache lines in some classes, it wasn’t until I took this course on parallelism that I really learned the implications data-oriented design had on performance and parallelism. I understand where OOP has its place, but in classes like our Universities Game Engine, or some Software Engineering classes things like data-oriented design should have been talked about(but wasn’t), especially since parallelism is going to have to be taken advantage of to get higher performance in the coming years.

Here are a couple links to DOD topics that go over it in much more(and clearer) detail than I have:
http://gamesfromwithin.com/data-oriented-design
http://bitsquid.blogspot.com/2010/05/practical-examples-in-data-oriented.html



« Menu’s n stuff done! XNA stuff »