XSD, XML and C++

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

Post Reply
User avatar
MadPumpkin
Chaos Rift Maniac
Chaos Rift Maniac
Posts: 484
Joined: Fri Feb 13, 2009 4:48 pm
Current Project: Octopia
Favorite Gaming Platforms: PS1-3, Genesis, Dreamcast, SNES, PC
Programming Language of Choice: C/++,Java,Py,LUA,XML
Location: C:\\United States of America\Utah\West Valley City\Neighborhood\House\Computer Desk

XSD, XML and C++

Post by MadPumpkin »

I need some help or direction on where I might find how to write an XSD file for use with my game and XML. I've googled lots of things like this but I have no idea where to learn more, most things are "XML for beginners" notes/tutorials. I will be using XML for my sprite animations (along with lua), map formats, character saves and design layouts, so any help would be greatly appreciated.
While Jesus equipped with angels, the Devil's equipped with cops
For God so loved the world that he blessed the thugs with rock
Image
Image
Image
N64vSNES
Chaos Rift Devotee
Chaos Rift Devotee
Posts: 632
Joined: Thu Aug 12, 2010 11:25 am

Re: XSD, XML and C++

Post by N64vSNES »

I've only started looking into XML since yesterday. But I thought the point of XML was just a format that anybody can create and parse through it however they pleased? I could be horribly wrong though.....
User avatar
MadPumpkin
Chaos Rift Maniac
Chaos Rift Maniac
Posts: 484
Joined: Fri Feb 13, 2009 4:48 pm
Current Project: Octopia
Favorite Gaming Platforms: PS1-3, Genesis, Dreamcast, SNES, PC
Programming Language of Choice: C/++,Java,Py,LUA,XML
Location: C:\\United States of America\Utah\West Valley City\Neighborhood\House\Computer Desk

Re: XSD, XML and C++

Post by MadPumpkin »

N64vSNES wrote:I've only started looking into XML since yesterday. But I thought the point of XML was just a format that anybody can create and parse through it however they pleased? I could be horribly wrong though.....
Oh no, that's definitely correct, but the thing is that an XSD file is what tells the XML file what each tag that you place in the XML is actually supposed to be, it's like altering HTML to your liking for example. (but much different) Look up XSD.
While Jesus equipped with angels, the Devil's equipped with cops
For God so loved the world that he blessed the thugs with rock
Image
Image
Image
User avatar
TheBuzzSaw
Chaos Rift Junior
Chaos Rift Junior
Posts: 310
Joined: Wed Dec 02, 2009 3:55 pm
Current Project: Paroxysm
Favorite Gaming Platforms: PC
Programming Language of Choice: C++
Contact:

Re: XSD, XML and C++

Post by TheBuzzSaw »

I'll just come out and say it: XSD and DTD are wastes of time for game development. It makes sense to have some kind of schema to verify the XML if you are attempting to publish some mega-national standard, but if you're just coming up with your own home-grown XML format, just have the C++ verify it. Seriously, there are not many good validation tools, and you won't really gain anything by having a matching schema anyway. The instant you lock the schema in place, you'll want to make a change and not be in the mood to change the schema to match.

I obviously cannot speak for everyone, but of the places I have worked, they pretty much all gave up on schema maintenance. "Oh, it's like 4 years old. Don't bother." It is definitely worth your while to document what the XML should define and how it should be structured, but I would not go much beyond using a simple DTD.

If you're doing this just for the sake of learning/practicing XSD, well, disregard much of what I said. I'm just trying to point out that they really don't add much.

It is ironic you brought this up because I literally started using XML + Lua for my 2D animations last night. I briefly considered using a schema but instantly stopped due to how rapidly my spec was changing based on my needs. If you want to know more, I can teach you a few things. I also have a massive XML reference book on my shelf. ^_^
User avatar
MadPumpkin
Chaos Rift Maniac
Chaos Rift Maniac
Posts: 484
Joined: Fri Feb 13, 2009 4:48 pm
Current Project: Octopia
Favorite Gaming Platforms: PS1-3, Genesis, Dreamcast, SNES, PC
Programming Language of Choice: C/++,Java,Py,LUA,XML
Location: C:\\United States of America\Utah\West Valley City\Neighborhood\House\Computer Desk

Re: XSD, XML and C++

Post by MadPumpkin »

TheBuzzSaw wrote:. . .
It is ironic you brought this up because I literally started using XML + Lua for my 2D animations last night. I briefly considered using a schema but instantly stopped due to how rapidly my spec was changing based on my needs. If you want to know more, I can teach you a few things. I also have a massive XML reference book on my shelf. ^_^
Alright! Thanks for all your help, what way would you suggest having C++ verify the tags and what have you? Also how do you use Lua with XML for your animations? For me it was mostly an idea and a plan not that I actually know how yet so haha :P any helps appreciated.
While Jesus equipped with angels, the Devil's equipped with cops
For God so loved the world that he blessed the thugs with rock
Image
Image
Image
User avatar
TheBuzzSaw
Chaos Rift Junior
Chaos Rift Junior
Posts: 310
Joined: Wed Dec 02, 2009 3:55 pm
Current Project: Paroxysm
Favorite Gaming Platforms: PC
Programming Language of Choice: C++
Contact:

Re: XSD, XML and C++

Post by TheBuzzSaw »

I have C++ "verify" the XML by simply explicitly hunting for tags. I don't just parse through linearly and read the string; I tell my code to search specifically for the "sprite" tag and then the "animation" tag and so on. If I ever fail a search, I report an error. It's that simple.

Lua itself does not control the animations. That is all handled with XML meta data and C++. The Lua is there to handle events and determine certain behaviors. It's mostly trigger based at this point.
User avatar
MadPumpkin
Chaos Rift Maniac
Chaos Rift Maniac
Posts: 484
Joined: Fri Feb 13, 2009 4:48 pm
Current Project: Octopia
Favorite Gaming Platforms: PS1-3, Genesis, Dreamcast, SNES, PC
Programming Language of Choice: C/++,Java,Py,LUA,XML
Location: C:\\United States of America\Utah\West Valley City\Neighborhood\House\Computer Desk

Re: XSD, XML and C++

Post by MadPumpkin »

TheBuzzSaw wrote:I have C++ "verify" the XML by simply explicitly hunting for tags. I don't just parse through linearly and read the string; I tell my code to search specifically for the "sprite" tag and then the "animation" tag and so on. If I ever fail a search, I report an error. It's that simple.

Lua itself does not control the animations. That is all handled with XML meta data and C++. The Lua is there to handle events and determine certain behaviors. It's mostly trigger based at this point.
Have you ever played Aquaria? if so, do you know how they did the character animations in that? I know that most of them are separate images and it's a sort of a 2D ragdoll system but some of them are a single image and still appear to bend and slither and things. Do you know how this is done?
While Jesus equipped with angels, the Devil's equipped with cops
For God so loved the world that he blessed the thugs with rock
Image
Image
Image
User avatar
TheBuzzSaw
Chaos Rift Junior
Chaos Rift Junior
Posts: 310
Joined: Wed Dec 02, 2009 3:55 pm
Current Project: Paroxysm
Favorite Gaming Platforms: PC
Programming Language of Choice: C++
Contact:

Re: XSD, XML and C++

Post by TheBuzzSaw »

I have Aquaria. The animation system is quite fascinating, but I know nothing about its technical side. I need to play it again to refresh my memory on what you are describing.
User avatar
MadPumpkin
Chaos Rift Maniac
Chaos Rift Maniac
Posts: 484
Joined: Fri Feb 13, 2009 4:48 pm
Current Project: Octopia
Favorite Gaming Platforms: PS1-3, Genesis, Dreamcast, SNES, PC
Programming Language of Choice: C/++,Java,Py,LUA,XML
Location: C:\\United States of America\Utah\West Valley City\Neighborhood\House\Computer Desk

Re: XSD, XML and C++

Post by MadPumpkin »

TheBuzzSaw wrote:I have Aquaria. The animation system is quite fascinating, but I know nothing about its technical side. I need to play it again to refresh my memory on what you are describing.
Alright, well if you have any ideas toward it I would be happy to know :P.
Yea, I have a small idea of what might be going on with those ones. What it seems like is that with the single image he put that one texture on a strip of rects, not just one rect, and use the same ragdoll system as he did with the other objects.
While Jesus equipped with angels, the Devil's equipped with cops
For God so loved the world that he blessed the thugs with rock
Image
Image
Image
User avatar
dandymcgee
ES Beta Backer
ES Beta Backer
Posts: 4709
Joined: Tue Apr 29, 2008 3:24 pm
Current Project: https://github.com/dbechrd/RicoTech
Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
Programming Language of Choice: C
Location: San Francisco
Contact:

Re: XSD, XML and C++

Post by dandymcgee »

Just an FYI, Aquaria is open source: http://hg.icculus.org/icculus/aquaria/
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches! :twisted:
User avatar
MadPumpkin
Chaos Rift Maniac
Chaos Rift Maniac
Posts: 484
Joined: Fri Feb 13, 2009 4:48 pm
Current Project: Octopia
Favorite Gaming Platforms: PS1-3, Genesis, Dreamcast, SNES, PC
Programming Language of Choice: C/++,Java,Py,LUA,XML
Location: C:\\United States of America\Utah\West Valley City\Neighborhood\House\Computer Desk

Re: XSD, XML and C++

Post by MadPumpkin »

dandymcgee wrote:Just an FYI, Aquaria is open source: http://hg.icculus.org/icculus/aquaria/
Yea I actually knew that, but thanks for the link I wouldn't have found it on my own >.<... Mostly I just didn't check it out because I wouldn't even know where to begin in the code to find such a thing.
While Jesus equipped with angels, the Devil's equipped with cops
For God so loved the world that he blessed the thugs with rock
Image
Image
Image
Post Reply