Declan Hopkins

software & game developer

[16] Terrain + Minimap Update

01/18/2020, 03:36pm

The game has seen some major improvements since the last post! I'm not ready to talk about all of it yet (Entity updates, NPC updates, new NPCs, new items), so I will save that for next time.

Tile Paint Tool

I finally got around to implementing the tile paint tool. As usual when adding some new data to the map, I had to update the world format on both the client and server. The world format now includes a paintmap, which stores the id of each tile. In the near future, I want to expand this so that each paint tile contains a foreground, background, and mask. This will allow interesting effects such as rounded paths and other irregular shapes. Right now each tile is just a boring square that does not blend with it's neighbors.

Maps are getting to be way more fun to build. With tile painting, you can make more detailed little mountain bits, bridges, and docks. The map generator will also take care of painting sand on beach areas and underwater (thanks sir!).

Basic Minimap

There's a little minimap now. I still have to implement blips (for NPCs, other players, items, etc). Also, trees are a little messed up due to some transparency stuff, I'll have to fix that too. The minimap is my favorite new feature - it really makes the world feel solid, and now that the world is larger it is useful for navigating.

Each client generates the base map image once they load into the server and acquire the world data. Then I just display it in a UI box (with a mask to keep it within the box) and do some rotation math so the minimap and compass face where they should. After months of thinking about this particular feature, I'm surprised I was able to get it in just a couple days.

I did lose some time because I attempted a different style of minimap. In this alternative style, an orthographic camera would be move across each chunk of the map, capturing an image of the terrain. All these chunk images would be stitched together for the final map. This was working well, but the big issue was that I could not get the water shader to play nicely with an orthographic camera. In addition, I felt this might limit me in the future, if one day I decide I don't like how a certain tile looks from the perspective of the minimap camera. They are textured with the purpose of being viewed a little closer, after all. Here's an image of that experiment, except with a perspective camera. It looks awesome, but won't work well when stitching multiple chunk images together.