A change in scale

Compared to other complex optimizations it was time for a larger, necessary and more simple change.

Posted by Trigger01 on August 18th, 2014
In order to support massive maps, more units and avoid overly complex map designs it was decided to double the size of map tiles. From the previous 32 pixels across they are now 64 pixels wide and tall.

A map that was previously 256x256 tiles had a width and height of 8192 units, or pixels if you will. A map of this size now only consists of 128x128 tiles and is just as big, 8192 units. This results in a decrease of 65536-16384=49152 tiles.

What does this mean?


Firstly, 32x32 pixel objects previously contained on one tile have been enlarged to the new 64x64 minimum standard.

There was however only one such object, and those were the trees. Which, relative to the rest of the game objects were actually very small and could often be mistaken as bushes. Making the trees twice as big was not only necessary with the new change, but also made them look more natural and gave the game a more realistic sense of scale.

Two other buildings, houses and farms - which were previously 3x3 tiles (96x96 units) were updated to 2x2(128x128 units). Units and other buildings in the game remain at their original size.

Here's why


This decision was mainly for optimizing the game, enabling larger maps, but also provoked a design decision which I was more than satisfied with - which basically meant, make things that previously were small larger. While the trees simply could of been made 2x2, it felt stupid not to go all the way and reap all the positive effects this change meant.

A 1/4 the amount of tiles means 1/4 the work in many demanding operations. Fog of War is calculated four times faster. All operations checking for nearby units (aggro range etc.) also only have to check for a lot of less tiles for the same distance. The same goes for pathfinding; finding a walkable path from one point to another.

Terrain textures are also redone for 64x64 and as a result of less tiling it is harder to notice repeated patterns.

The best system of course would be to allow tiles of different sizes to be used for different operations and I have begun to work on one such system for pathfinding.

Nonetheless this has provided an enormous boost in performance and is a huge step forward in making the scope of Terra Militia truly gigantic.

Visual comparison (top old, bottom new)



Leave a Comment:

Avatar

Trigger01 January 19th, 2038

[#118] Hah, you're right! I knew something felt wrong writing that, but was too lazy to figure it out :p


Avatar

NoStyleGuy January 19th, 2038

Good read! Very small criticism, but you aren't just halving the number of tiles by reducing their size in half; you're actually reducing it to 1/4 the original amount. 256^2 = 65536, 128^2 = 16384. Even better!