FAQ  •  Register  •  Login

XML Level Format?

Forum rules
This forum is for technical discussion only. If you are interested in gameplay or client-side issues, please post in Bitfighter Features.
<<

Unknown

User avatar

Posts: 183

Joined: Mon Mar 08, 2010 4:48 pm

Post Fri Mar 11, 2011 3:24 pm

XML Level Format?

Has anyone considered using an XML level format?

If we used XML for the level format, it would be better organized, more readable, and far, far more extendable. I'm sure there are plenty of XML parsers out there.
It is more verbose, though, and will take up more room, but if that really is an issue the XML could be compressed.

Example:
  Code:
<level>
   <levelInfo>
      <name>Test Level</name>
      <description>This is an XML example</description>
      <author>Unknown</author>
   </levelInfo>
   <game>
      <type>CTF</type>
      <time>5m</time>
      <endscore>3</endscore>
      <gridsize>255</gridsize>
      <bots>auto</bots>
      <allowEngineer>true</allowEngineer>
   </game>
   <teams>
      <team name="Blue" color="0000FF"/>
      <team name="Red" color="FF0000"/>
   </teams>
   <objects>
      <wall>
         <width>50</width>
         <points>
            <point x="0" y="0"/>
            <point x="4" y="0"/>
            <point x="4" y="4"/>
            <point x="0" y="4"/>
            <point x="0" y="0"/>
         </points>
      </wall>
      <spawn>
         <teamID>1</teamID>
         <point x="1" y="1"/>
      </spawn>
      <spawn>
         <teamID>2</teamID>
         <point x="3" y="3"/>
      </spawn>
      <teleporter>
         <in x="2" y="2"/>
         <out x="6" y="2"/>
      </teleporter>
   </objects>
</level>
<<

ZoombeR

Posts: 1036

Joined: Fri Jun 04, 2010 11:56 pm

Post Fri Mar 11, 2011 6:47 pm

Re: XML Level Format?

it would just be annoying to have to type everything twice, not as friendly, but better organization
<<

raptor

Posts: 1046

Joined: Mon Oct 11, 2010 9:03 pm

Post Fri Mar 11, 2011 7:13 pm

Re: XML Level Format?

I use XML all the time and I can tell you that parsing and transforming it is no fun, is slow, and causes general headaches and sucks the life from your brain.

However, XML does make sense if we want more database-like functionality out of the level file. It does have many strengths, like better structure and extensibility like you say.
<<

ZoombeR

Posts: 1036

Joined: Fri Jun 04, 2010 11:56 pm

Post Sun Mar 13, 2011 1:11 pm

Re: XML Level Format?

maybe the game can be built to read both?

just like it can read .txt and .level? (even though thats completely different and much easier and is the same thing just with a different extension :) )
<<

watusimoto

Site Admin

Posts: 1558

Joined: Tue Feb 23, 2010 7:07 pm

Location: Quartz's mom's house

Post Mon Mar 14, 2011 4:54 pm

Re: XML Level Format?

I have considered it. I dislike XML personally, but the main obstacle to converting is simply the doing of it. If we converted, we'd surely maintain backwards compatibility; new features would only be added to the XML version, and when you loaded and saved a level, you'd always get XML out.

The only real question is what advantage would it bring? If there were a compelling reason to switch, I'd be willing.
<<

Unknown

User avatar

Posts: 183

Joined: Mon Mar 08, 2010 4:48 pm

Post Wed Mar 16, 2011 5:50 pm

Re: XML Level Format?

The big advantage is the extendability and backwards compatibility. For example, if you ever decide to make teleporters have the option to be team specific, adding that parameter would not hard at all - no extra place in the parameter list would have to be made. Old copies of the game could run the level, even - they just wouldn't use the team-specific option.
<<

ZoombeR

Posts: 1036

Joined: Fri Jun 04, 2010 11:56 pm

Post Sat Mar 19, 2011 12:04 am

Re: XML Level Format?

advantages of xml formats could include a web based app that lets you see which kind of item is used, and how many of them are used.
<<

raptor

Posts: 1046

Joined: Mon Oct 11, 2010 9:03 pm

Post Sat Mar 19, 2011 8:35 am

Re: XML Level Format?

@Zoomber

I guess that's sort of true - transformation of XML into HTML only requires XSLT processing (maintenance of which is almost as bad as PERL, by the way...)
<<

ZoombeR

Posts: 1036

Joined: Fri Jun 04, 2010 11:56 pm

Post Sat Mar 19, 2011 11:05 pm

Re: XML Level Format?

xml would be great if bitfighter was available for the itouch
<<

watusimoto

Site Admin

Posts: 1558

Joined: Tue Feb 23, 2010 7:07 pm

Location: Quartz's mom's house

Post Tue Mar 22, 2011 9:34 am

Re: XML Level Format?

For me, the killer feature of using some standard markup language would be if we could somehow display a level in a browser or manipulate an svg tool like Inkscape. I don't know enough about how XML could work to know if we could gin up a stylesheet to make the levels viewable/editable elsewhere.
<<

KaKiLa

Posts: 2

Joined: Fri Jun 10, 2011 11:27 am

Post Fri Jun 10, 2011 1:27 pm

Re: XML Level Format?

Definitely having the chance to convert SVG to levels would be really nice!

Return to Technical Discussion

Who is online

Users browsing this forum: No registered users and 3 guests