🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Visual tricks for a strategy game’s map

posted in jhocking
Published July 28, 2019 Imported
Advertisement

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!


View the full article

0 likes 0 comments

Comments

Nobody has left a comment. You can be the first!
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement