Development Insight

On the importance of a comfortable development process and the time saved on automating repetitive tasks.

Posted by Trigger01 on April 20th, 2015
Lately I have made several improvements on the development-side of Terra Militia. In this post I will focus on the build tool that was created to save the time doing repetitive tasks manually.

First it takes all the sprites in a specific folder and makes a single large spritesheet out of them, saving the name, position and size of each of them in a text file. The game later uses this file to find the correct rectangles when drawing specific sprites.It also takes all the static non-moddable (mostly interface and menu) sprites in another folder and makes a spritesheet of them as well, although this time a code file is generated into the project containing the information for all of these sprites so that they may easily be used in code.

A section of the generated code file:
public static Rectangle Cursor_Attack { get { return new Rectangle(255, 862, 32, 32); } }
public static Rectangle Cursor_Food { get { return new Rectangle(965, 154, 32, 32); } }
public static Rectangle Cursor_Idle { get { return new Rectangle(193, 948, 32, 32); } }
public static Rectangle Cursor_Minerals { get { return new Rectangle(891, 254, 32, 32); } }
public static Rectangle Cursor_Repair { get { return new Rectangle(255, 896, 32, 32); } }
public static Rectangle Cursor_Target { get { return new Rectangle(193, 982, 32, 32); } }
public static Rectangle Cursor_Wood { get { return new Rectangle(227, 946, 32, 32); } }
What it finally does is to take the content of all the content folders (Animations, Audio, Buildings, Particles, Projectiles, Props, Resources, Sprites, Textures, Tiles and Units) and compress them into data files using 7z compression.

In goes 415 files and 23 folders, out goes 11 compressed files. This is particularly useful when the user updates the game, dramatically decreasing the amount of times the launcher stops to acquire new files. Content files can also be removed from the game without them staying on the clients computer (using space in vain and potentially bugging the game).

I noticed a tool like this was necessary when the time to constantly update and insert content into the game took too long to do manually. All it takes now is to put the files in the correct folder and run the tool. Making a spritesheet manually and then in code defining the rectangle for each sprite was also a huge time sink, all of which now are gone.

Having each sprite be contained in its own file also helped performance a huge bunch when editing them.

The process finishes on about three seconds and does everything from scratch, where the majority of time is spent compressing folders into files. Compare this to the manual time of doing it from scratch for all content which is around 45+ minutes, go figure.

A tool to build content files is certainly something I will create much earlier in future projects, as it makes constant updates and tests a breeze.

Leave a Comment:


shraif January 19th, 2038

cen i run this gaem i uses sli gtx980

plis tel me if i cen run gaem it looks verry wow


Trigger01 January 19th, 2038

[#172] Wow. Maybe. Very thanks.