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!

Saturday, June 2, 2018

FP$: A Playthrough -- Completing the Shopping List!


So here's a playthrough video of me collecting all items on the shopping list.

It's a bit long so I included a little music to help the time pass.

Let me know what you think!

Friday, June 1, 2018

FP$ -- Clean up on Aisle 7


Look at this mess! Who's going to clean it up? The employees of course!

But uh...I don't have any employees. Really not sure how to make any. But I know if I want to start testing this game I need product on the shelves. And it doesn't take long to make a mess of this place.

Sooo, I decided to create a simple clean up script.

When the game starts, every product detects its current transform location in the game world. It then checks to see if its transform location changes. When that happens, it starts a timer (that can be set in editor) and once that timer is up, the product zips back to its original location.

But uh...I had trouble.

See, I'm comfortable with Transforms (x,y,z locations in 3D space), but rotation is another thing. I mean, they use terms in Unity like Quaternion and Euler to describe and change rotation. I've Wikipedia'd both those terms and came out more confused than when I didn't know anything.

So while products were returning to their initial location, they were also returning at really strange angles. One even returned to its spot while spinning in space. It was kinda cool, in a trippy way--just not what I needed.

So I took my confusion onto Unity Answers and to my surprise, someone kindly answered. Their Username is Dolzen (not sure if it's polite to share). They gave me exactly what I needed to make the objects return to their spot, and at the right angle.

The Script:




And this is how it works:


Ultimately, I would like the items to return to shelves when the player isn't looking. I'm not 100% how that should work. But I would like an NPC Employee to be there to imply they put everything back. Maybe they can say something snarky to the player as well.

Now that I'm caught up on the progress of FP$, I need to start making more progress.