Re: [Super-tux-devel] Next IRC Meeting
Brought to you by:
wkendrick
From: Ingo R. <gr...@gm...> - 2004-03-08 15:58:11
|
Ricardo Cruz <ri...@ae...> writes: > I could implement the use of files for tiles, but we need to agree > with a file format. As I said before, the INI-like file format would > be, IMO, the one that fits better with this. It is powerfull more > than enough and very easy to edit. For the tile-format I am fine with .ini, it serve the purpose there good enough. For the levelformat however its not that good, yep, it would work for milestone1, but it wouldn't win a price for eleganc (ie. simply misses any way to handle structured data across multiple levels). I am personally happy with the lispreader library which I used in Construo (no extra library dependency, since its just two files that can be assimilated): http://www.complang.tuwien.ac.at/~schani/lispreader/ It provides a way to read in lisp-like S-Expressions and returns a parse-tree. Levelformat itself would then look like: (supertux-level (version 1) (properties (name "Hello World") (width 500)) (enemies (snowball (pos 11 10)) (icecube (pos 10 10))) (tilemap (data 1 2 3 4 5 6 1 414 23 4324 1 2 3 4 5 6 1 414 23 4324 1 2 3 4 5 6 1 414 23 4324))) Advantage would be that its trivially to parse in Lisp/Scheme like languages, parsers for perl and python exists too, but its not that widespread as XML. Another way which I would also find interesting is directory based level format, ie. a level is represented as a directory: $ ls foobar.supertux/ =map.data =name =default-archive =width =height $ Each file there contains then the relevant data (ie. tilemap data gets its own file, level name gets its own name, etc.). Never used that in practice, but its used in both QMail and Arch and has the advantage that it is easy to parse from all languages, even bash, since there is after all not much to parse, but just a directory tree to read in. Disadvantages are of course that its a bit obscure to edit with a text-editor, since its a multi-file format. -- WWW: http://pingus.seul.org/~grumbel/ JabberID: gr...@ja... ICQ: 59461927 |