Map editorJanuary 31, 2017 — ForgeableSum
All of the maps in ST are created in-engine using the map editor:
While the UI needs work, the functionality is complete, which is essentially to create, save and load maps for use in Strike Tactics games.
There are hundreds of map objects you can use to make maps, including trees, rocks, plants, mountains and water; all in 4 different primary biomes: desert, snow, grass and volcanic.
One of my goals for the map editor was to make it really easy to make maps. Most of the maps you see in the trailer were made by myself in a matter of minutes. This is mostly possible through the use of custom seeding functions. You can seed any object on the map by hitting a "Seed" button, which will randomly place the object on the map:
You can seed one particular object, or you can seed a category of objects, such as "All Desert Plants".
Currently, the buttons seed a pre-defined, fixed number, which is based on the size of the map. Eventually, I will add functionality so editors can change that number at will.
I've always had this idea of getting rid of tile-based ground textures. In the Feudal Wars map editor demo I accomplished this, by creating a complicated system in which textures were blended together with a brush tool and the HTML5 canvas. The brush would essentially create a hole in textures, so you could see the layer underneath (the brush tool was in fact, an eraser!). Then I would move around the layers based on which texture you wanted to draw with.
This method was problematic because:
- It involved so much bitmap data manipulation, performance was atrocious on computers with bad graphics cards
- To save the maps, I had to literally save the blended images created in the map editor
For the Strike Tactics map editor, I've devised a much better system. Instead of creating custom textures for each blended image, I create one single blended image from each texture, which is used as an overlay. The blended image is created in-engine from the base texture:
The benefits of this system are tremendous:
- Maps can be procedurally regenerated using a set of instructions (i.e. I don't need to save the literal images in the map files, hence 100KB map files instead of 10MB map files)
- Performance is awesome - I only need to draw a single BMD for each texture used, and copy it each time it is placed on the map
All map objects have z-indexes, which determines the vertical stack order in which they are rendered. For example, a tree has a higher z-index than a mountain and will therefore be shown on top of a mountain:
If you place a mountain on top of a tree, the entire texture is instantly re-ordered and redrawn and the tree will still be drawn on top:
Eventually, I'll add functionality for custom z-indexes, so you can control the vertical stacking order.
I learned a lot from making the Feudal Wars demo. The more sprites you have, the worse performance gets. Thus, I've completely redesigned the map generation system for Strike Tactics. Instead of creating sprites for each individual terrain object (trees, rocks, plants, etc), objects are rendered to textures which make up the base texture tiles on the map. With this system, you can have 1 map objects in a tile, or 500, and the performance will be exactly the same.
Place as many objects on the map as you want, without having to worry about it slowing down performance.