
Hi everyone,
Sometimes, a person with a hammer views everything as a nail. Sometimes, people get tunnel vision. Sometimes, I waste days of my life on something that could have been done in 5 minutes. Today is such a story.
As John has been working on the tutorial island, I decided to continue fixing the map, with one thing that I consider particularly important: more accurately representing where soldiers can walk and where they can't. This is obviously important especially on the tactical map - the player needs to know exactly which part of a hill their soldiers can walk over (or get attacked from). The map we had didn’t properly reflect this, as the map so far didn’t take into account the new(ish) terrain rocks - and simply adding them to the render resulted in a very bad looking map that also didn’t accurately represent walkable areas.
The base layer of the map uses a camera above the terrain to take a snapshot of the landscape at the time of the start of the game, replacing the terrain material with a custom map shader. Having set it up like this originally and wanting everything to be automated, I naturally thought I could utilise the same concept to show the navmesh (or lack thereof) on the map. About a day and a half into setting up 9 different cameras, re-writing shaders, and getting rather frustrated with certain parts of Unity, I decided that this wasn’t going to work without either sacrificing a considerable amount of performance at the startup or throughout the entire game.
So, I decided to instead export the navmesh to Blender, to essentially invert the navmesh with Blender, after which I was going to re-add the new object into Unity, and could now do with a simple 3 camera setup that was going to just run at the start. A bit more work for me up front, but much more performant for the game in general. Of course, I hadn’t considered the issues I may run into with Blender. What I thought would be a simple boolean operation turned into a bigger problem of trying to separate and break down meshes, with John going as far as suggesting I should write my own boolean operator for Blender.
A day of frustration and setbacks later, I finally realised the obvious: I could simply take a picture of the navmesh in Blender, and invert it in an image editing program. This took me a whole 5 minutes, one camera, and zero performance impact in the game, not taking into account how stupid I’ve felt for not thinking of it earlier. So, after 3 days of frustrating attempts to automate things and 5 minutes of productive work simply taking a picture, the map now very accurately shows where soldiers can and cannot walk - and can easily be edited in Photoshop (result in today’s image). Goes to show that sometimes thinking before doing can save on a whole lot of doing.
Until next week!
