Minimap and fog of war


Througout the dev process of this week, the main issue I faced with was generating a minimap based on the random map and also generate fog of war. By constantly using another camera to render the whole map again is consuming performances, which is not good.

The solution I used with this issue was render the camera's view onto a texture, and save it as the minimap in the beginning of the map generating process. This only makes the camera render once since the map is a static object. Another challange is the fog of war. To achive that, I used a sprite mask as the top layer, and I put the map as the child of the mask. In the script, I combine a circle shape as the reveal shape with the current mask based on the player's position, so that it can masked out the unexplored areas. But the biggest issue is by doing so, it is causing a huge performance issue. I can't really solve this yet, but a quick fix I used is to record the last player's position and I only reveal the fog when the player is far enough from the last position. This significantly improved the performance, but still not enough. 

Right now I am considering using shader to implement this, and I am still working on it. Here is a current version of fog of war and minimap:


Author: Zeyuan Song

Posted on 04/19/2024

Get Suits of the Abyss

Leave a comment

Log in with itch.io to leave a comment.