Home » Community » Forums » » XML in Games
  Intel sponsors gamedev.net search:   
[Control Panel] [Register] [Bookmarks] [Who's Online] [Active Topics] [Stats] [FAQ] [Search]

Add Forum to Favorites |  Send Topic To a Friend | View Forum FAQ | Track this topic

Page:   1 2 »»

 Last Thread Next Thread 
 XML in Games
Post Reply 
Phew, I wrote this a while ago!

A couple of people have emailed me already:

Jonas Eichhorst has pointed out a typo - I left off a quotation mark in the description of my fridge, in the tupperware-box node. Thanks

Keith McAfee asks why I talk about writing my own parser, rather than using one of the established parsing libraries (such as expat).

Erk. Let's just say I wrote this back in the days when I was naieve and uneducated, and had little knowledge of the pre-established parsers.

I'll still write a second article though, sometime - demonstrating how to use a DOM with an XML document; reading using a parser (probably expat - Xerces-C is a little big) and writing out using DOM classes directly.

Superpig
- saving pigs from untimely fates, and when he's not doing that, runs The Binary Refinery.

 User Rating: 2118   |  Rate This User  Send Private MessageView ProfileView JournalView GD Showcase Entries Report this Post to a Moderator | Link

I have to admit, after reading the first six words of this article:

"The foundation of the Internet, HTML..."

I just had to stop. HTML the FOUNDATION of the Internet? LOL!! There's just no possible way you know anything of value, so I'm sorry, I can't continue reading this trash.

 User Rating: 979   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

quote:
Original post by Buster
I have to admit, after reading the first six words of this article:

"The foundation of the Internet, HTML..."

I just had to stop. HTML the FOUNDATION of the Internet? LOL!! There's just no possible way you know anything of value, so I'm sorry, I can't continue reading this trash.


This is a very odd statement to me, I mean HTML isn't the greatest thing in the world but I can't really think of anything that has a stronger presents in the internet.

Yes there is PHP, ASP, JSP, and others but they all use HTML to do the basic formatting..

Anyways I quickly skimmed through the article and I was hoping for a little more, but thats because I was already planning to use XML in my current project.. maybe your next article will be more usefull to me..

It great to see people taking there own time to write these articles



Please visit Turt99 Productions

 User Rating: 1115   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

I liked the article, I am also using XML in my game. I also wrote my own class instead of using Expat, TinyXML or Xerces.

One of the reasons I did that was I did not want to get into DTD docs. Another reason I wrote my own is that I intend to also be able to save my XML to binary files for the finished program.

 User Rating: 1035   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

My $.02.

In the introduction, you don't actually say what XML is or does, just what you have without it. I would have said something like:

"Simply put, XML is meta-data. That is, data that describes other data."
and something like
"XML structures your data."

Next point is that "item"s in XML are called "elements", not "nodes" (in a DOM tree, they are "element nodes", but the tutorial isn't there yet).

Its probably good that you didn't go over DTDs, but they should be covered somewhere in the series.

Otherwise a pretty good tutorial.

superpig, you think you could email me the next tutorial before it gets published. I've written my own XML parser (it read SGML too) and have been working with marked up data for a while now. I think my expertise could be of some help.

PS - HTML is actually an SGML application, not its own markup language.


[edited by - Big B on April 21, 2003 1:05:15 PM]

 User Rating: 1158   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

quote:
Original post by Turt99
Original post by Buster
I have to admit, after reading the first six words of this article:

"The foundation of the Internet, HTML..."

I just had to stop. HTML the FOUNDATION of the Internet? LOL!! There's just no possible way you know anything of value, so I'm sorry, I can't continue reading this trash.

This is a very odd statement to me, I mean HTML isn't the greatest thing in the world but I can't really think of anything that has a stronger presents in the internet.

Yes there is PHP, ASP, JSP, and others but they all use HTML to do the basic formatting..



There is a big difference between the internet and the world wide web. The WWW is only one application of the vast internet. I am sure the author of the article meant to say "The foundation of the WWW, HTML...".

Regards,
Jeff

Edit: Removed the extra quote tags...


[edited by - rypyr on April 21, 2003 1:25:45 PM]

 User Rating: 1101   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

Yes, rypyr, you're exactly right. Thank you.

Big B: I'll just draw attention to the part at the end where it says 'I wonder why I write all my articles at 2:30am...' You're right about the meta-data thing though.

I'll do a quick rewrite of this soon to correct some of the most simple terminology errors and typos (because I have a feeling that's what people are going to be emailing me the most about).



Superpig
- saving pigs from untimely fates, and when he's not doing that, runs The Binary Refinery.

 User Rating: 2118   |  Rate This User  Send Private MessageView ProfileView JournalView GD Showcase Entries Report this Post to a Moderator | Link

Hi,

Hey hey !! don't be so Hard guys !! )

I red your article at 1:30am and like it.
It's true, that's it's a little empty...you give severals examples but not enough explanations, in fact i find you don't go far enough in the subject. Anyway it's very interesting (i guess i'll try to code a simple parser...)

waiting for the next one...

++
VietCoder

 User Rating: 1015   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

I have to point out something about your style. You seem to use attributes a lot, and while that's ok, I don't think that that is the best way to do it. Oftenly attributes are used not to describe data, but to provide the parser with information about that tag. In XML it is generally recommended to use child elements instead of attributes where possible.

quote:
w3schools
Attributes often provide information that is not a part of the data. In the example below, the file type is irrelevant to the data, but important to the software that wants to manipulate the element:



quote:
w3schools
There are no rules about when to use attributes, and when to use child elements. My experience is that attributes are handy in HTML, but in XML you should try to avoid them. Use child elements if the information feels like data.



I don't think it really matters much, I just felt that I should point it out.

 User Rating: 1018   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

tuxx,

As you may have guessed from my mixing up of the words 'node' and 'element,' I'm somewhat used to using XML in DOM form.

As such, each element is treated as a single object, with child elements as child objects.

I'm more comfortable with the idea of an object having it's own properties (read: attributes) than having those properties stored as child objects.

So yes, it is a style thing; but yes, it doesn't really matter.

Just to let you people know, the rewrite is now almost complete, and will be emailed to Dave before the night is over.

Superpig
- saving pigs from untimely fates, and when he's not doing that, runs The Binary Refinery.

 User Rating: 2118   |  Rate This User  Send Private MessageView ProfileView JournalView GD Showcase Entries Report this Post to a Moderator | Link

Another great article, superpig! I can't wait for the next editions of your articles (Engine from ground up, and this XML article)!!!
Thanks for your dedication,
Jason

 User Rating: 1035   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

Fairly good article, that adventure game example set off a small mental explosision about scripting/configuration using xml and introspection in C#.

Good stuff

 User Rating: 1015    Report this Post to a Moderator | Link

Updated, with numerous small fixes (thanks Dave, and everyone who's emailed me to point out how stupid I am).

Superpig
- saving pigs from untimely fates, and when he's not doing that, runs The Binary Refinery.

 User Rating: 2118   |  Rate This User  Send Private MessageView ProfileView JournalView GD Showcase Entries Report this Post to a Moderator | Link

I liked your article a lot, it is a great idea using XML in games and your examples are fitting also, but I harshly object in using it on multiplayer games, as stated in this article:
"Surely, in the days of object-orientation and massively-multiplayer online games, there must be a better way? I think XML can fill part of the gap."

That would certainly eat up a lot of bandwidth and some unecessary processing power; Resources wich are to be preserved in your grasps in game developing. Maybe its interesting in some other types of online applications, but I wouldnt agree on online gaming.

 User Rating: 1015   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

Actaully I think it would be very useful for developing purposeat the least. I haven't messed with any of the parsers but I assume they are fairly easy to use. If so it would provide a quick easy way to maintain data during development. And it could be easily replaced once large scale testing is required with a simlar but compiled binary form of the data.

 User Rating: 1070   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

quote:
Original post by ALH
I liked your article a lot, it is a great idea using XML in games and your examples are fitting also, but I harshly object in using it on multiplayer games, as stated in this article:
"Surely, in the days of object-orientation and massively-multiplayer online games, there must be a better way? I think XML can fill part of the gap."

That would certainly eat up a lot of bandwidth and some unecessary processing power; Resources wich are to be preserved in your grasps in game developing. Maybe its interesting in some other types of online applications, but I wouldnt agree on online gaming.


Oh, heh... I wasn't suggesting XML should be applied to multiplayer games - I was being rhetorical, and trying to give some impression of the game industry having come a long way, and now achieving technically impressive things. My bad, I guess that's not totally clear.

It would eat up bandwidth and processing power, yes, but only when used in realtime. If it's being sent straight between the client and server *anyway*, then you lose some of the benefit of XML - such as the fact that it's human-readable.

However, I would not say that 'because it's a multiplayer game, XML cannot be used.' There are still plenty of opportunities to use it - a very large part of a multiplayer game is held in common with a non-multiplayer game.

I can also think of one further interesting application - format negotiation. If one server is used by a suite of MMO games, and each game requires different types of data from the server, then XML could be used to describe to the server the format of data that the client is expecting. Just an idea.

Superpig
- saving pigs from untimely fates, and when he's not doing that, runs The Binary Refinery.

 User Rating: 2118   |  Rate This User  Send Private MessageView ProfileView JournalView GD Showcase Entries Report this Post to a Moderator | Link

While I like the idea of using XML in games, I don't think XML is a very practical solution for saving/loading games or asset management (as suggested in the article), unless your game worlds are very small.

A typical 3D level, for example, contains thousands of elements (boxes, doors, buildings, aliens, etc.) which, when stored as XML, are going to take up a *lot* of harddisk space. Loading the level (by parsing the XML file) is probably going to take forever... and a 5 MB XML file isn't really human-readable anymore.

There's plenty of practical uses for XML though (config files, object type descriptors, etc.). But it's applicability is not without limits.

Jim Offerman
lead developer
Crevace Games
www.crevace.com

 User Rating: 1015   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

Yes, there certainly are limits

Tried to do a little larger database with about 80 000 elements.
Hehe, just say it choked badly

Nice article by the way!

 User Rating: 1024   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

quote:
Original post by jofferman
While I like the idea of using XML in games, I don't think XML is a very practical solution for saving/loading games or asset management (as suggested in the article), unless your game worlds are very small.

There's plenty of practical uses for XML though (config files, object type descriptors, etc.). But it's applicability is not without limits.


Oh, agreed. There's a risk of 'golden hammer' syndrome here (when you've got a golden hammer, everything looks like a nail)... that's when you begin twisting the technology to fit the problem, rather than using the correct technology - my adventure game example was also one I felt was a little contrived, as there are better solutions to the problem.

I disagree when it comes to asset management, though. There's nothing that says all your XML need be in one file... perhaps one XML document to describe a module would be sufficient. But XML, if you use it for asset management, would be a godsend for modders (IMO), because it's so much simpler than adhering to a particular directory structure, or having the developer provide some 'index' file format. XML becomes something like the Universal Save project; tools for 'mod packaging' could become available to help modders pack their files in a common way.

Superpig
- saving pigs from untimely fates, and when he's not doing that, runs The Binary Refinery.

 User Rating: 2118   |  Rate This User  Send Private MessageView ProfileView JournalView GD Showcase Entries Report this Post to a Moderator | Link

To kinda follow up on the last strand of comments about size and such, here is something of note.

Age of Mythology used a huge number of XML files for tons of stuff, including gamedata. In the final release they were compiled into XMB files, which a simply a commpressed binary representation of the XML file. I don't know the specific's on how this all worked, but anone intrested might take a look around the AOM community as there seems to be an XMB->XML converter out.

 User Rating: 1070   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

XML in games are of particular interest to me.
Check out http://www.naltabyte.se/liquid to see what I mean..


(^-^)7

 User Rating: 1015   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

Buster: you're an idiot
how can one be so rude against someone trying to _contribute_ to the game development scene?? well taste this:
quote:

http://www.w3schools.com/xml/xml_whatis.asp

We strongly believe that XML will be as important to the future of the Web as HTML has been to the foundation of the Web and that XML will be the most common tool for all data manipulation and data transmission.



"HTML has been to the foundation of the Web"

sure this post is late, but "nigga pliz"...

"No lies of sugar can sweeten the sournes of reality"

}+TITANIUM+{ A.K.A. DXnewbie[onMIRC]

 User Rating: 1352   |  Rate This User  Send Private MessageView ProfileView Journal Report this Post to a Moderator | Link

XML is great... it has all of the disadvantages of a text-based file format, and none of the advantages of a binary format!

Hey cool, I've made my data twice as large... and it's not even encrypted! Neat!

 User Rating: 1015    Report this Post to a Moderator | Link

quote:
Original post by Seriema
Buster: you're an idiot
how can one be so rude against someone trying to _contribute_ to the game development scene?? well taste this:
quote:

http://www.w3schools.com/xml/xml_whatis.asp

We strongly believe that XML will be as important to the future of the Web as HTML has been to the foundation of the Web and that XML will be the most common tool for all data manipulation and data transmission.



"HTML has been to the foundation of the Web"

sure this post is late, but "nigga pliz"...


Chill, Seriema; originally the article *did* say 'HTML, the foundation of the Internet,' and I agree that it is wrong (though I don't think much of the way Buster chose to express his opinion). The article was updated to read 'foundation of the Web' *after* Buster posted. So, down boy

Superpig
- saving pigs from untimely fates, and when he's not doing that, runs The Binary Refinery.
Enginuity1 | Enginuity2 | Enginuity3 | Enginuity4

 User Rating: 2118   |  Rate This User  Send Private MessageView ProfileView JournalView GD Showcase Entries Report this Post to a Moderator | Link
Page:   1 2 »»
All times are ET (US)

Post Reply
 Last Thread Next Thread 
Forum Rules:
You may not post new threads
You may post replies
You may not edit your posts
You may not use HTML in your posts
Jump To:
Administrative Options: