XSD, XML and C++
Moderator: Coders of Rage
- MadPumpkin
- 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++
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
For God so loved the world that he blessed the thugs with rock
Re: XSD, XML and C++
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.....
- MadPumpkin
- 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++
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.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.....
While Jesus equipped with angels, the Devil's equipped with cops
For God so loved the world that he blessed the thugs with rock
For God so loved the world that he blessed the thugs with rock
- TheBuzzSaw
- 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++
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. ^_^
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. ^_^
- MadPumpkin
- 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++
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.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. ^_^
While Jesus equipped with angels, the Devil's equipped with cops
For God so loved the world that he blessed the thugs with rock
For God so loved the world that he blessed the thugs with rock
- TheBuzzSaw
- 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++
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.
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.
- MadPumpkin
- 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++
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?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.
While Jesus equipped with angels, the Devil's equipped with cops
For God so loved the world that he blessed the thugs with rock
For God so loved the world that he blessed the thugs with rock
- TheBuzzSaw
- 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++
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.
- MadPumpkin
- 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++
Alright, well if you have any ideas toward it I would be happy to know :P.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.
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
For God so loved the world that he blessed the thugs with rock
- dandymcgee
- 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++
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!
- MadPumpkin
- 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++
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.dandymcgee wrote:Just an FYI, Aquaria is open source: http://hg.icculus.org/icculus/aquaria/
While Jesus equipped with angels, the Devil's equipped with cops
For God so loved the world that he blessed the thugs with rock
For God so loved the world that he blessed the thugs with rock