Modding support for my February game

It's been a long time, and I've been hard at work for tons of real life stuff. I've also worked a bit on my February game.

I can tell you this much: it's a 2D top down reverse tower defense game, which currently has no name. What do I mean with reverse tower defense? Well, it's simple. Take the formula of a tower defense game, and reverse it! The towers have already been placed, and you, the righteous (or evil, that's yours to decide) invader must select units to send in and conquer the barbarian defenders.

But here's the cool thing: the game content was designed to be almost entirely moddable. While in its core, this game will always have the same kind of gameplay, you can edit a lot of stuff:

  • Add new units (scouts, tanks...) and unit sprites
  • Design new levels
  • Add new kinds of towers, which attack stronger or faster
  • etc.
Here's a small tutorial on how you will be able to mod the game.


All of the game content is stored inside the /etc/-folder. There's a folder settings, which contains the game settings such as resolution, full screen mode, etcetera. Then there's the actual folders that are useful for modders: levels, sprites, towers and units. I will now discuss how to create levels, sprites, towers and units, in greater detail.


Levels in the game are created using a third party tile editor, called Tiled. You should google on how to create levels in this editor if you want to do that. There are tons of great tutorials out there and it makes no sense for me to try and rewrite them. Just make sure the tiles are 30x30 pixels. Let's say you've created a level myLevel.tmx with a tileset myTileset.png. You should put this level (.tmx file) inside the /etc/levels/ folder, and the tileset goes inside the /etc/levels/tilesets/ folder. Open this .tmx file using a text editor such as Notepad, Emacs or VIM, and make sure the <image source>-tag refers to tilesets/myTileset.png. Here's an example of that line using a 300x300 png tileset:
<image source="tilesets/myTileset.png" trans="f000ff" width="300" height="300"/>
The game engine needs to know where the path is the units can follow, and where the towers are placed. This is done by creating a text file in the /etc/levels/ folder, called myLevel.tpinf. Make sure this file has the correct extension (.tpinf), even on UNIX systems, and has the same name as your Tiled (.tmx) file.
Then, using your Tiled file, add each path tile (in the correct order, i.e. the order in which units are to move across the path) as follows:
p x y

Here's an example for a path from (0,0 to 2,1):
p 0 0
p 0 1
p 1 1
p 2 1
Then, add each tower tile as follows:
t x y name
Here's an example for an Arrow tower on the position 0,1:
t 0 1 Arrow
 The game engine will then create a path and spawn towers in the correct position.

This leads us to the next step in modding the game: adding new towers.


Towers are made by creating a new file in the /etc/towers/ folder. These files are properties files. Properties file, put simply, consist of key value pairs, seperated by an equals sign. Each tower should have the following properties: damage, speed, range and projSpeed. For example values, take this "Arrow" tower that I've made to test the game with:
You can make new towers by editing these files or creating new ones. You can put new towers in a level by editing a level's .tpinf file as seen above.

Of course, towers shoot projectiles. These projectiles can be given sprites (of any dimension) by adding a file <TOWER_NAME>_proj.png to the same folder in which you put your tower.properties file. For the Arrow tower, this gives the following filename: Arrow_proj.png. The game will then automatically make the tower shoot projectiles with this sprite.


Now that we know how to create towers and levels, what about units? Units are also created using properties files, but those are put in the /etc/units/ folder. Units have the following properties: health, damage, speed, sight and sprite. Sight is a value to determine how much the unit will move the fog of war (this will make more sense if you've played the game). Sprite is the name of an image file (without the extension) that is used to represent this unit. These sprites are .png files stored in /etc/sprites/. Here's an example unit:
This unit has a scout.png sprite in the /etc/sprites folder, deals 10 damage when it reaches the end of the path, has 100 health, a certain speed and sight.

This was the tutorial. You should now know how to mod the game once it is released. If there are any questions, leave a comment or tweet me.

Let's hope the game is finished soon! See you next time.

Geen opmerkingen:

Een reactie plaatsen