Hey there!
This week we want to take a look at the fog of war visualization and the new entity selector.

Fog of War Visualization

So, back in Research Log #08 we talked about how the Fog of War will work in Bio Colonies. This and last week, we finally implemented the visualization of it.

How the Fog of War currently looks like.

So how does it work? The core is calculating the fog of war data for every tile. First, we simply rebuilt the terrain every time something changed, but as we were expecting, this was very inefficient.

Instead, we’re doing something pretty simple now. We generate a texture representing the fog of war. Every pixel represents a tile in the world. Now, when something changes in the data, we write these changes into the texture.

An example fog of war texture.
An example fog of war texture.

The bright red pixels represent the visible sections. The dark red pixels are the foggy areas. We simply use just one of the RGB color channels (red in this case), as we don’t need the other ones and it would just duplicate data.

In case you’re wondering why the areas are weirdly shaped: These are actually hexagon shapes in the game, but due to the nature of pixels and textures being squares, we get this distorted version.

This texture is then fed into the shaders of the game. They calculate the position on the texture from their own world position and determine the color value. If it’s black, they just skip rendering. Entities only render in the bright red area. Terrain renders as grayscale in the dark red sections.

There are still some small bugs in the position calculation on the edges of terrain cells, but we’ll try to fix them in the near future.

Entity Selector

Besides the fog of war visualization, we’ve also been working on the UI and on the scenario for our Demo Version.
I managed to improve the UI’s performance again by rewriting our grid-panel control for the third time. It is now finally usable, so I also managed to implement the Action Panel and the Entity Selector.

A cell with the selector.
A cell shortly after being clicked on. The selector indicates that the cell is now highlighted, and actions can be chosen.

The Entity Selector gives visual feedback if an entity – a Cell, Bot or Swarm – is currently selected. If so, this entity can be set to execute an action, like moving somewhere, mining resources or attack an opponent (depending on the entity type, obviously).
As there’s still the one or other bug persistent, which I’d like to keep for myself until like next week, I’ll just show you the selector for now.

A selected cell from a little bit further away.
A selected cell from a little bit further away. Note that the selector itself doesn’t get smaller!

The main task of the next week is the creation of assets that fit the game better than these, well, placeholder ones. Stay tuned for more!

See ya next week!