DevLog 001 — Minimap

Martin Sikora
badgermakesagame
Published in
2 min readJun 9, 2023

My long term approach is to make the game map and the world generator pluginable and thus reusable and isolated.

One feature I had in mind for quiet a while was how could I make a minimap that shows a viewport of the main map. The good thing is that I was finally able to verify that my presumptions were correct and it all works as I expected.

Map plugins & generator plugins

Right now I have two types of plugins:

  • Map plugin — is a plugin that interacts with the map itself and typically returns a layer that is placed on the top of the layer with hex tiles. There are three levels of layers (more on that and on texture caching in my next post).
    A typical map plugin is for example grid (the green edge around every hex) or the white hex coordinate inside white border of a hovered hex.
  • Generator plugin — Wraps a map plugin and adds functionality specific for the generator. Most typically this means defining menu items that are automatically added and controled by the generator UI (like enabeling and disabeling the map plugin).

My plan was that the generator UI and the actual game map will be both build around the same map component. They’ll just use different plugins.

The minimap itself is the same map canvas just zoomed out. So for me, a minimap is a generator plugin, that creates a custom component in an overlay. This component contains a map component with the same hex grid as the large map. Since the minimap is also pluginable, it has its own plugin that observes viewport position of the large map and renders a white rectangle on the minimap into a separate layer.

I’m glad this works without any major trouble and I’ve tested this approach with several other plugins. The generator UI needs to be easily extendable without me worrying about breaking other functionality which seems to be very promising at the moment.

--

--