Allegro.cc - Online Community

Allegro.cc Forums » Off-Topic Ordeals » Using XML for level design

This thread is locked; no one can reply to it. rss feed Print
Using XML for level design
Goalie Ca
Member #2,579
July 2002
avatar

I was wondering if anyone has used XML for level and character design and such and if it would be a good idea or a waste of time. It seems there are a lot of xml parsers out there and it would save a lot of time trying to load stuff into structures.

Edit: As for xml parsers, expat (c-language) is opensource and said to be very fast. Are there any better ones.

-------------
Bah weep granah weep nini bong!

Matthew Leverton
Supreme Loser
January 1999
avatar

A waste of time. XML is meant for multiple programs to share abstract data. It does have some good uses, but I think they are limited...

Why do you think "loading stuff" into structures is hard? How would XML make that any easier?

XML is not meant to be hand-edited, so it doesn't gain any points there.

X-G
Member #856
December 2000
avatar

Doesn't Crystal Space use XML for its map format?

--
Since 2008-Jun-18, democracy in Sweden is dead. | 悪霊退散!悪霊退散!怨霊、物の怪、困った時は ドーマン!セーマン!ドーマン!セーマン! 直ぐに呼びましょう陰陽師レッツゴー!

Goalie Ca
Member #2,579
July 2002
avatar

Well, i was thinking that it may be usefull for a describing maps and characters in an rpg as well as a save game file. I know its more human readeable and easier for me edit. I also thought something like this might be nice.

<level id='1'>
   <character level='7' name="King Ryan">
       <treasures>
            ogre_gloves
            sun_talisman
       </treasures>
       <coordinate x='1' y='1' z='1'/>
       <bitmap>img.png</bitmap>
       <lives amount='5'/>
   </character>

   <treasure name="moon_talisman">
         <properties>
                <bitmap>img.png</bitmap>
                <lifetime>1000</lifetime>
                <coordinate x='1' y='1' z='1'/>
         </properties>
   </treasure>

</level>

-------------
Bah weep granah weep nini bong!

X-G
Member #856
December 2000
avatar

What's wrong with this?

<treasure name="moon_talisman" bitmap="img.png" lifetime=1000 x='1' y='1' z='1'/>

:)

--
Since 2008-Jun-18, democracy in Sweden is dead. | 悪霊退散!悪霊退散!怨霊、物の怪、困った時は ドーマン!セーマン!ドーマン!セーマン! 直ぐに呼びましょう陰陽師レッツゴー!

Matthew Leverton
Supreme Loser
January 1999
avatar

Or this:

"moon_talisman","img.png",1000,1,1,1

mEmO
Member #1,124
March 2001
avatar

That saves a bit of disk space, but the xml version is by far the most readable one (IMO, though)

[edit]
I guess map files don't have to be readable :-/

---------------------------------------------
There is only one God, and Connor is his son!
http://www.memocomputers.com
Happy birthday!

spellcaster
Member #1,493
September 2001
avatar

Quote:

<treasure name="moon_talisman" bitmap="img.png" lifetime=1000 x='1' y='1' z='1'/>

From an XML point of view, that's harder to extend.

--
There are no stupid questions, but there are a lot of inquisitive idiots.

X-G
Member #856
December 2000
avatar

How so?

--
Since 2008-Jun-18, democracy in Sweden is dead. | 悪霊退散!悪霊退散!怨霊、物の怪、困った時は ドーマン!セーマン!ドーマン!セーマン! 直ぐに呼びましょう陰陽師レッツゴー!

Goalie Ca
Member #2,579
July 2002
avatar

XML seems like a bit of overkill but the situation below seems to make it easier to read data in. I'd have to use some sort of delimeter anyways. Also, if i have a map I'll have the tilemap as a seperate file. I'd probably end up placing the items by hand, probably won't be too many. Maybe 20 per level. I don't feel like making a world editor to do that stuff and i don't know any better way to go about it.

       <treasures>
            ogre_gloves
            sun_talisman
            discovere_item n
            discovered_item_n_1
            discovered_item_n_2
       </treasures>
       <bitmaps>maybe list of these as well</bitmaps>

-------------
Bah weep granah weep nini bong!

Paul Pridham
Member #250
April 2000
avatar

What's wrong with the handy dandy built-in Allegro configuration file functions? More readable than XML gunk.

Go to: