A lot of moding going on now
Well, as I was working on getting the creatures modable I encountered a little brainteaser. That is the equipment some of the creatures have, the knight has his hammer, the orcs their shields, swords and axes.
We have been discussion having the possibility to equip creatures, this means that we would have a couple of swords in different levels, and shields armours and so on. But this doesn't mean that every creature should have individual armours and weapons, the orc for example should be able to pick up the knights hammer and do some damage with it.
So the way to solve this is that I will not have any item modelled as a package with the creature. The hammer itself will be regarded as an item that the knight can drop and replace with another weapon if he wants to.
This is easier said than done, because every creature has its own skeleton and holds the items in a certain way, which means that for every new introduced item into the game all the creatures will need to have some information on how to hold it and in most cases have their own model of the item to fit them.
Weapons, Shields and Resources
First of, items and weapons that are held in the hand is the easiest, this is because there is only the hand bone that is controlling the weapon. But it could still be a little bit annoying that I would have position every item in the game in the hands of the creatures as it is now. Therefore I have come up with this solution.
As seen here we have a bucket of water, but we also have a little arrow stuck to it. This is a handle arrow (as I call it
) that is positioned in the handle of the water bucket. The next step is this:
As you can see the the rouge also has an arrow in his hand that marks out his hand-handle, and as we already know how the water bucket should be located in relations to the arrow it will position itself there automatically.
So what does this mean; It means that all that is needed to be done is giving all the creatures this handle arrow and all the items this handle arrow and from there all creatures will be able to carry all items without any extra work from me or the one that wants to mod the game. Simple as pie
So back to the headline
I have reorganized the items folder a little, now it looks like this:
The game will automatically load in all xml files in this folder into the game. So if I were to make a new file named "Sword.xml" with some info to it we will have a sword item in the game. So let me show of what the water.xml file contains:
- name - The ID of this items, when other objects in the game is calling this item they will call its name, in this case "Water"
- path - The path to the item folder where its textures, icons, models resides.
- model - The filename of the model.
- texturecolor - Model color/diffuse texture.
- texturespec - Model specular texture.
- texturenormal - Model normal texture.
- icon - Item icon image.
- handle - Filename of the handle data I showed in the images above.
- language - Filename of the language file (will go into this soon).
- unlimitedresource - This is for resource management purposes, water is a unlimited resources and should only be pumped out of the well when it is needed.
- dropable - Some creatures will have some standard items on them as a default from start, like a wig (the impanzee hair for example) or jewellery. When moding the creatures the moder have the option to set default items/equipment on the creatures to create variation, but that don't mean that all these items should be dropped and pickupable by other creatures.
- foodvalue - This is what categorize the item as food and that it should be delivered to the bar room.
- drinkvalue - This is what categorize the item as drinkable and that it should be delivered to the bar room.
- equipmenttype - In this case it is just a resource like rock, fish and wheat. But if it were a helmet for example we need to make sure so that the creature don't equip two helmets.
So here we have the content of the water folder:
As the particle and projectile effects now is a part of the item moding I wanted to expand this topic a little. All items can now call on the particle effects by adding this code into the item xml file:
(projectilelight)255,196,64,128,1500(/projectilelight) (!--r,g,b,shine (0-255), radius / 1000--)
(projectilehitlight)255,196,64,128,5000(/projectilehitlight) (!--r,g,b,shine (0-255), radius / 1000--)
(projectilefirelight)255,196,64,128,2500(/projectilefirelight) (!--r,g,b,shine (0-255), radius / 1000--)
- (projectilemodel) - What model the item will use when it behaves as a particle, if no model is named here it will use the standard item model.
- (projectiledamage) - How much damage the projectile does in % of the creature melee damage, or of the damage the projectile gets at initialization. To clarify, when the cannon shoots it may input the damage 20 to the projectile and when the projectile hits its target it will do 75% damage of 20 = 15 damage to the target. If a creature throws a item it will maybe input 40 as damage to the projectile as it is its core melee damage and the when the projectile hits is will only do 30 damage.
- (projectilerotationX) - X spin of the projectile.
- (projectilerotationY) - Y spin of the projectile.
- (projectilerotationZ) - Z spin of the projectile.
- (projectiledamageradius) - If the projectile hits/explodes it will damage all creatures within this radius.
- (projectilefiresound) - The wav sound the projectile will do when it is getting fired.
- (projectilehitsound) - The wav sound the projectile will do when it hits the target.
- (projectilefireparticles) - The particle package the projectile will use when getting fired.
- (projectilefirelight) - The light the projectile emits when getting fired.
- (projectileparticles) - The particle package the projectile will use during its flight.
- (projectilelight) - The light the projectile emits during its flight.
- (projectilehitparticles) - The particle package the projectile will use on hit.
- (projectilehitlight) - The light the projectile emits on hit.
- (projectilespeed) - The speed of the projectile.
- (lifetime) - The lifetime of the projectile.
The item moding has actually expanded a lot as it can be used for more than just being an item. For example, I do have a "UnBakedBread.xml" file available as well, this item is only used to display unbaked bread on the baking table.
The user could also create an item named fireball and adding fireball particles to it and giving it fire damage and explosion and everything and have the creatures throw this item.
Another fun idea is to set the projectile speed to 0 and just let it live out its lifetime, if an enemy walks into the projectile while it is standing still it will hit him, and in this way work as a trap.
This will of course need to be expanded a lot more for more advanced spells, but I think it is a good start
All files here are rather self explanatory except the language.xml file. As noticed above in the item moding I wrote the filename for the language like this (language)language(/language) and not like this (language)language.xml(/language). The reason for this is that "language.xml" is the default language (in this case english), but everytime a new language is introduced to the game (lets say Swedish) the game will look for a language file named "languageSE.xml".
So at some point in the future I will have a language folder where people can just tell the game through other xml files that another language is introduced to the game and that it have the ending "SE", which means that for every language file in the game it will always check and see if there is one with SE in the end available.
Here is the language.xml file:
Armour and accessories
For some reason water is the easiest resource to get in the dungeon, but that is lucky for you because the production chain would fail without it! Just build yourself a well and let your imps fetch water from it.
Here is the tricky part. All the models have a different sizes and different skeleton. This means that one torso armour that fits on one creature will probably not fit on another. The easiest armour to create would be the helmet, but even that needs to be a little modified for each creature. I say this to let you know that this is something that will come in second. But I have some tricks up my sleeves to make this simple for both me and for anyone that would like to introduce new armours