Navigate

Tuesday, June 26, 2018

FP$: Menus and Nav Mesh

It's been a while...

I joined a Game Developer Group. As part of the group, we're supposed to perform "assignments." It's a neat idea, and fun. But with as little time as I have to work on projects, our current assignment has distracted me.

Also, my wife got me Hyrule Warriors for Switch with a shiny new Pro Controller...so that was also distracting.

No regrets...

But I am making progress with FP$! Since the core of the game is playable and functional, I wanted to start building the structure of the experience, from beginning to end. It's not The Last of Us, but I do consider it a story driven game.

I started with a main menu. I've never made one before, but got pretty far messing around with canvas. Still, I wasn't sure how to get my button to send me to the first level. I tried looking up a quick fix on Unity Answers...but it wasn't super helpful. I eventually watched 30 minutes of an hour long menu tutorial to find the 30 seconds I needed.

Now it works.


It's not beautiful, but it was only meant to be a functioning stand-in.

After pressing start, the player is supposed to be playing a classic Doom-styled game. So I made a simple, square level for the occasion.


I even downloaded classic Doom textures for my walls, floor, and ceiling--just for proxy art.


The idea is that the player will be roaming the halls, killing an endless wave of beasts while the camera tracks backward to reveal the Doom game being played on a TV screen.  I had to look up how I would project the player's real-time activity of playing the Doom-Clone while tracking backward to reveal a TV.

The answer was quite simple. Unity has a Render Texture that's simple to use. So simple, I started to play with it and found a 3D option on the renderer. I don't know what it means, nor could I get it to work. So for now it's a mystery. I don't need 3D projection for this project, but it would have been cool to figure out.


Next--I needed baddies to kill. That means Nav Mesh. I've worked with it before while making Rundead, but the work was mostly performed by another team member. I quickly baked a mesh and placed a Nav Mesh Agent in the project. It took me a few minutes and some Googling to get the Agent to chase the player, but sadly--it was walking through walls

I finally found a video by Brackeys that detailed my needs, and it was under 12 minutes long! But his process required me to use a special Nav Mesh Surface component. When I tried to apply it--there was no such component available. That's when I learned it has to be downloaded as an extra. So I spent some time doing that...

But even after following the tutorial, the agent was still walking through walls. As my kids crawled on me and my keyboard, I messed around in the Nav Mesh menus. Turns out I had to tell Nav Mesh not to navigate on non-walkable layers. Odd thing to not be a default...

Anyway--it works now.

I then used a tutorial to add health to the Agent, but instead of turning off the object--I just have it reappear at a "spawn" location. This way, each time the player "kills" an enemy, it simply reappears somewhere in the level. I do want to add in some death effects eventually.


The project is moving along and I'm learning new stuff each day!

No comments:

Post a Comment