Data Driven Game Programming

Started by
1 comment, last by BeerNutts 12 years, 3 months ago
Hi guys,

can someone tell me how a Data-Driven programming can be an advantage? As far as I know, Data-Driven programming means that I load in a text file with a set of varibles that can be used in the game? How can this be useful? Can someone give me an example in a situation where a game will be better off by doing Data-Driven Programming?

Thanks
Advertisement
Well, if you're making a platform game and you want to have different levels then a data driven program is really handy. Because you can generalise a level class and then load the specifics from the datafiles. That way you don't need to program each level independently.


while( game is running ){
if( change level )
load( level) // loading data from data file
input( level )
logic( level )
render( level )
// and everything else in your game loop.
}


So a data driven model cleans up your code a lot and you don't need to hardcode everything. It can also be used for other things except levels. You can have a list of spells in one file and if you want to add another you can just edit the file add a new one and you're finished. This also saves time with compiling, you don;t need to recompile if some data has changed.

Those are some benefits I can think of. Hope this helped you

Sepii
It's the ability to change things about your game without having to modify the game code itself. Let's say your game has 10 different weapons. You should detail all your weapon data in files loaded by your program. That way, when testing, if your shotgun doesn't have enough force, just modify the file, and run the game.

Or, you have a load of enemies, and you can load them from these files, and make changes to their core data on-the-fly.

I personally use xml to store this information, and use tinyxml to parse it for me

My Gamedev Journal: 2D Game Making, the Easy Way

---(Old Blog, still has good info): 2dGameMaking
-----
"No one ever posts on that message board; it's too crowded." - Yoga Berra (sorta)

This topic is closed to new replies.

Advertisement