Unfortunately, I didn’t get as much work done on Splatterfield as I wanted. I did make some good progress in Chivalry: Medieval Warfare, however. I discovered that if swap weapons to the dagger after throwing a javelin, the next javelin is actually reloaded faster. I’m not sure if it’s a bug or not, but it seems quite powerful. Man, I love using the javelin.
My goal was to populate the world with a basic character and to have that character able to fire a basic weapon, randomly destroying blocks. I didn’t get that far, but I did make some more progress.
Career in modeling
The first stumbling block that I ran into with characters was the issue of models. While I have a little bit of experience using 3D modeling programs, I don’t think that it would be a good use of my time at the moment.
So, I went on a quest to find some basic models for the soldiers… and failed. I must have spent an hour and a half this morning combing through the depths of the Internet, but I couldn’t find anything that I thought would work well. The models were either too expensive (as in, not free), or the wrong format, or without any animations whatsoever. I don’t need much, just a stick figure with a walking animation and maybe a firing animation.
In the end, I decided that I would use a baby dragon model that came with Panda3D. It looks a little weird as the default green texturing is designed to be used with a cartoon filter, which is something that I would like to do with the game at a later stage.
If anyone knows of a good site for free models for Blender, please let me know!
After loading in the dragon model I had to make a fair number of additions to the code in order to get them into the game world. The first was the creation of the
Unit class. This will hold basic information about each unit in the game, such as the owner, health, and position on the map.
I leveraged the existing code for adding and removing blocks as much as I could, though I had to make some modifications to the logic to account for the new type. For instance, there were a few places where I had used Python’s
isinstance function to look for blocks, and I had to replace these to use a more generic function that would look for
Unit instances. Most of the functions worked pretty much the same and soon I was able to hit the good old “g” key to add dragons all over the map.
Dragons are particularly sticky in the world of Splatterfield: they can be placed on the map without needing to stand on anything. I’ll say that they’re just really good fliers, even though their wings are pathetic. They aren’t even animated properly yet, so I’m not sure how they’re flying so well.
Once the unit was in the right place in the logical representation of the battlefield, it became relatively easy to display the dragon. I had to scale it way down, attach a collision sphere, and fiddle with the positioning for about ten or fifteen minutes, but overall it was quite quick. Animations will take a fair amount of work, but I don’t foresee needing more than a handful for the entire game.
I choose you
Another feature that I added today was the ability for the player to select a specific block. When mousing over a block and hitting the “s” key, a block becomes selected.
This doesn’t do anything just yet, but it will be useful later. I may need to move a selected unit to a specific location, for instance. However, I’m not sure that this works with the
Unit class yet.
And that’s saddening, because selecting units is generally a necessity of strategy games.
One thing at a time, though.
Another thing that I spent some time doing today was cleaning up my code. As the game gets more complex it will be increasingly important to organize the code. So, that meant stripping out redundant sections and writing helper functions.
It’s not the most fun work, especially since I never feel like I have something new working. But, in the long run they will save me a bunch of time and will make the code more stable. If I need to change something I’ll be able to fix it in one place, rather than three. Woot!
There are a number of things that I’m going to try to get accomplished before I take a minor break for Thanksgiving. I really only have a couple of days (after work, nonetheless) so I doubt that I’ll be able to get everything done, but I’ve got a list going:
- Fix selection on units
- Add ability to save the state of the game to an external file and load it back into the game
- Add “move” command for units. Transports the unit to the targeted block.
- Add “fire” command for units. Fires a projectile at the targeted block, destroying it.
- Bonus: Make the “fire” command a particle effect
I think I’ve definitely got my work cut out for me when it comes to this project.
Onward and upward! Now with dragons!