Jump to content
  • Advertisement
  • entries
  • comments
  • views

XML loading working

Sign in to follow this  


I hate these types of improvements since you can't even see them at the surface, in fact, the game has become worse since I haven't moved all the old monsters to the new system yet. I have basic functions for parsing the parsed XML and passing the values to any constructor. This involves two functions, (One for monsters, one for items) that are called for each class, each returning a function passed to the loader. The loader calls this function, which returns another function, this function should return a instance of the object, that can be passed on to the world. The main difference between this architecture and the old one is that classes usually don't register themselves, as this creates a circular dependency, with the classes having to call a function on the XML-loader, while being lower down in the hierarchy. The new system has the XML-loader import a list of modules, each of which can define any class instancing functions.
The advantage of the new system is that a lot less data is stored in code. While I still have to register classes, the classes no longer have to contain any data, and many monsters can just share a class.
Way to much of my time was spent replacing calls to the old system with calls to the new system. The API is similar, but now you have to reach it threw the world object rather then the loader being a global variable.
While working on this, I found a point of inflexibility in the code: Weapons can't define special attacks. The variation in weapons is a list of damage types, but I want to be able to define really weird weapons that don't use the normal system. I think that if a monster has a special attack, like "claw", but is wielding a weapon, it shouldn't be able to use it's weaponless default. If I define a "default attack" for every weapon slot, and modify monster that way, it might be more dynamic. I am unsure however how I should handle multiple weapon slots. Most games seem to work by either picking a random one, or all at the same time. Since for humans the default would be punching the enemy, neither is very realistic. I am thinking something along the lines of "Try to hit with your sword, if you miss, try to hit with your fist, if you miss, try to bite, etc. depending on what attacks are available. I would like your ideas about this.
Thanks for reading!
Sign in to follow this  

1 Comment

Recommended Comments

Keep on working. In a previous project of mine, once reached this point (let's move all this stuff in some external file!) I succumbed to boredom and left the project.

Share this comment

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!