Visual tricks for a strategy game’s map

At work this past month I’ve been implementing some interesting visual tricks on a mesh-based map. While we aren’t making a game, I could totally imagine these techniques being useful for a strategy game, or maybe a tactical RPG. Let’s say you have a hex map. Well, you could easily do hexagons with a 3D mesh, and then boom you can can use all sorts of visual tricks developed for 3D games.

As just one example, you can easily tint the map with vertex colors. And this could even be overlaid on a pixel-based map visual; the mesh could just be semi-transparent tinting of the polygonal map spaces, while the underlying image could be a hand-drawn map.

And not just visual tricks actually, but user interaction and controls too. This may seem really mundane, but building a mesh representation of your game’s map is an awesome way to do mouse picking of spaces on the map. Just keep a Dictionary correlating triangle indexes with your map’s spaces (hexes, tiles, arbitrary polygons, or whatever your map is composed of). Then you can easily do a raycast directly against the map’s collider (as opposed to a general raycast into the scene) and Unity’s RaycastHit object includes a triangleIndex property (remember to put a Mesh collider on your map, not Box). Easy peasy!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s