|
Author
|
||||
|
More in Development
|
||||
Use appropriate file formats
If you implement a tool that spits out game data, the file format you choose have a big impact on the amount of work required. In general, keep these principles in mind:
Property Files
Here is an example of a property file:
level = Jupiter aliens_count = 5 space_ship = Androxi II
These files are relatively easy to parse, simple to edit (also for non-programmers).
Make sure that your importer does not rely on a specific order – this makes the tool easier to maintain, and helps make it backwards compatible).
Property files are only suitable for flat data. If more structure is required, XML should be used instead.
XML
XML is by no means the best format for data. It tends to be verbose, and does not represent some data structures, such as graphs, well.
However, it is so widely used that it would be a terrible waste not to piggy-back onto existing code and tools:
XML is also editable by non-programmers (after a 5 minute training course!), and the verbosity actually helps document the format.
Scripting Language as a data format
If your game engine supports scripting, it is often better to generate data in the scripting language directly. This means you can use the built-in parser, and, if it is available, also the editor. In addition:
On the downside, it is not suitable for hand editing by non-programmers. Also, smart content is dangerous, especially if it cannot be checked in the tool where it is created. For those reasons, it is best to limit your format to use only the most necessary data presentation features of the language (dictionaries and structs, for example).
Game or Game Engine Language as Data Format
In some cases, you might want to produce code files to be compiled with your engine directly. This is most useful for files that control behaviour, (such as state machines or other AI behaviour), scripted events, procedural content, or graphics routines (such as shaders).
The main advantages of this approach is that it
It is also a dangerous approach, and can easily become a production bottleneck:
|
Words from the readers
|
||||
|
Hmm, thanks for spotting the typo; I'll ask Chippit to fix it...
Posted by ht at 18:34:34 on 06 November 2009
Small error on page 1 'can you write and write files?', but I enjoyed the article and found it quite useful
Posted by edg3 at 21:30:24 on 04 November 2009
Thanks! The Game Maker idea actually comes from one of Danny's articles for NAG (quite a while ago), I think it was about data driven design. Before then, I never thought of GM as a tool for anything other than GM games.
Posted by ht at 13:58:44 on 30 October 2009
Very nice article, Herman! You've actually opened my eyes in quite a few respects, especially with regards to creative sources for level editors (those really ARE quite a pain at times!). It's particularly nice to see the suggestion for using Game Maker and the like as level editors: I actually did the same thing for one or two Flash projects that I've screwed around with, and it really does work. ;)
Posted by Nandrew at 01:21:21 on 29 October 2009
Have your say:
|
||||