I moved to a new URL! Check it out!

Dev Log: Going Data Driven

Dev Log: Going Data Driven
I've been making a lot of progress on tackling this system I want to implement for my next game. Since yesterday I decided to scrap a bunch of code in favor of going for a data driven approach. Lars gave me the final push I needed to go for this method of content.

My initial design of the code structure was going to be object or class driven for specific content. For example I had a namespace and a folder set up for "Weapon" and inside Weapon there was a "Base" class for any sort of Weapon. Then I made a few classes that extended the Base class inside the Weapon namespace which then changed values and added their own code to various functions.

This seemed like a good idea at the time. Using classes and extending base classes for specific functionality is something I do a lot in my games. It makes sense for a lot of things, I think. Like enemies. The enemies in All the King's Men for example are specific classes that extend a base Enemy class to implement their own specific functionality.

As I began to think about all the possibilities for gear, weapons, enchantments, and whatever else in my game, I was pretty grossed out by the thought of having a billion classes in my project for each single one. After thinking it over I ripped out all my old code for content and started on replacing it with one class for each different thing, and having a factory that instantiates objects using data from various data xml files.

I'm more excited about this method since so far it feels cleaner. The code to parse everything out of the xml for each object is pretty ugly, but editing content should be pretty easy with this structure in place. I can also use the xml files as a good guide on what to do next. Right now my work flow is to just start writing the xml data for whatever I can think I would want to customize for each thing, and then I start implementing each thing I've written. Working "backwards" like this can be a big help when working in a system where I have no idea where to begin.
new comment!

Post your comment!