3 XML

posted in IBTL
Published July 23, 2006
Advertisement
I decided it was time to clean up my XML environment loader.

I had been using tinybind to bind everything, but it turned into a bit of a mess with all the map entities. Tinybind is easy to setup and use; it took all of about five lines to load my environment. The problem is, it produced XML like this:

"1.0"
?>

Dummy
DummyResources
FileSystem
../assets/maps/dummy
1


AmbientLight


Color
0.1,0.1,0.1,1.0




PointLight


Ogre Name
Light1


Position
0.0,0.0,50.0


Diffuse
0.5,0.5,0.5,1.0


Specular
0.0,0.5,0.5,1.0




FreeCam



StaticMesh


Mesh File
Table.mesh


Entity Name
TableMesh


Position
100.0,0.0,0.0




Robot







I also needed a little bit of special hackery majiks for map containers, since tinybind doesn't really support them. It is pretty likely that I'll be editing at least some of the XML environments by hand, so I decided I needed something cleaner. The result is this:

"1.0"
?>
"dummy">
"DummyResources" type="FileSystem" path="../assets/maps/dummy" />
"1" />

class="AmbientLight">
"Color" value="0.1,0.1,0.1,1.0" />

class="PointLight">
"Ogre Name" value="Light1" />
"Position" value="0.0,0.0,50.0" />
"Diffuse" value="0.5,0.5,0.5,1.0" />
"Specular" value="0.5,0.5,0.5,1.0" />

class="FreeCam" />
class="Robot" />
class="StaticMesh">
"Mesh File" value="Table.mesh" />
"Entity Name" value="TableMesh" />
"Position" value="100.0,0.0,0.0" />






Still a little clunky, but much cleaner and more compact. It uses straight tinyxml, so the actual loading code is a bit longer, but it is definitely worth it.

In case you're intrested, here's what the dummy environment looks like:



I'm *almost* back on schedule. I just need to finish integrating ODE into the rest of the engine and implement load/save. Then I'll just have to write game entities and create content and hope I can finish it all by the end of November.
Previous Entry pix
Next Entry Suggest an article!
0 likes 15 comments

Comments

Ravuya
Hey, this isn't candy.
July 24, 2006 08:48 AM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement

Latest Entries

Hurrr

1276 views

Hooray

1083 views

Hey...

937 views

Thanks for playing

1002 views

Happy Halloween

909 views

asdf

1068 views

butt

1109 views

a

886 views

c

855 views
Advertisement