🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Meet Bob

Published April 12, 2020
Advertisement
This is Bob

Meet Bob

Bob is a Zombie. Bob now appears on screen. This may not sound like much of an accomplishment, but it took a bit of work to make this happen. I am happy to report that I am now getting the hang of adding things like Bob to this engine. Bob starts life as a tag in an XML file containing map data for a level.

      <Actor
        Name="Bob"
        X="5"
        Y="3"
        Control="player"
        Team="0"
        SpriteSource="TrashMobs.Zombie"/>

During GPVM.LoadLevel(), the XmlDocument containing Bob gets parsed for various child nodes using C#'s very friendly System.Xml library. Bob's node gets passed as a parameter to the Actor constructor. Actor then creates the Game Logic Character object and the Graphics Sprite object. Creation is now going to start going “top down” this way from the Model to the lower layers. It may sound like a strange thing to get upset about but it's been bugging me for a while that I was creating from bottom, to up, to bottom again. Obstacles and Props currently start as tags, go to the GL objects, then the model objects, then the graphics objects. I'll be putting an end to that silliness soon.

The nice part about doing it this way is if I decide I want to change the Character class or the way they're encoded as XML data (which is probably going to be happening a lot soon), then the game engine does not care. The only places I have to make changes are the character class and the maps. No other part of the engine looks at what is in the tags it's just a messenger that doesn't check what is in the mail.

Soon Bob will start moving. Stay tuned

0 likes 0 comments

Comments

Nobody has left a comment. You can be the first!
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement