The Path of the Game Dev — Day 23

Saving progress…

— —

Oh man is this all getting more and more exciting!

The next section focused on building the enemy AI for the guards of the stealth game level. Similar to the player, the guards also use the NavMesh to move around the environment. The key difference here, however, is that the player moves with input from the mouse. The guards are meant to automatically move around the level on their own. So how do we do this?

With UnityEngine.AI and SetDestination, you can make waypoints for the guards to move between. However, you have to set parameters to account for any weirdness that comes along with incrementing and decrementing values outside of the list size. This took a lot of thinking through specific conditions, if statements, and pausing and replaying the game to make sure things weren’t breaking.

Working with the animator these past two days has been quite the experience. Everything was going smoothly for the player character and then suddenly I get to the guards and… well. Let’s take a look.

Dancing guards in a stealth game

The guards have no problem cycling through their walking animation and moving to each waypoint but once they start their idle animation they rotate back and forth on the Y-axis. At first I thought it had something to do with the coroutine since that’s the method that is called when they start their idle animation, but no, everything in there was fine. I tried looking back through Update to see if there was anything messing with it there, but I also couldn’t find the source of the rotation. Maybe more research is necessary.

Biggest takeaways from the day: AI is fun to work with! Animation is not (for now).

— —

Progress saved!




Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

How to link accounts to your Alexa App?

If you like Screaming Frog you will love this new SEO spider

Creating a Ledge Grab System

LeetCode Problem#163 Missing Ranges

RPC vs. API: What’s The Difference?

Pentester Lab Pro Subscription Giveaway

How to Deploy (for Free) an Angular App to GitHub Pages Without Using Any Libraries (Step-by-Step…

Spring MVC

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Gabrielle Igarta

Gabrielle Igarta

More from Medium

Procedural Content Generation through a Data-Driven Approach

Should Video Game Remakes Adhere to its Source Material?

Screenshot of Resident Evil 4 Remake, the main character is looking out of a car window.

My first level design experience — few tips and tricks to build nice levels.

Atlas Terrain Editor for Unity 3D