Welcome to NPC Programming, the third course in Unity's Gameplay Programming Specialization!

This course is exam preparation for Unity's Expert Gameplay Programmer Certification Exam. This course will challenge you with a series of realistic programming problems in Unity video-game projects, inspired by one or more of the topics covered in the Expert Gameplay Programmer Exam. Throughout this course, you will work on a 3D “Dual-Stick Survivor” game project. This will help you practice programming NPCs within games, including scripting NPC logic and behavior, navigation and pathfinding, raycasting, and NPC spawning and placement.

This is an advanced-level course, intended for industry game developers or very experienced Unity enthusiasts who are looking to “level-up” their gameplay programming and implementation strategies. To succeed in this courses, you should have at least 2-3 years of experience developing games with Unity. You should be familiar with the full-game lifecycle (working from early concept to launch), creating and working with Prefabs, understanding game asset and animation pipelines, and have some experience with Unity Services. You should also have advanced programming skills, particularly in the C# language.


NPC Logic & Behaviour
-For the first week of this course you’ll introduce logic to your NPCs using State Machine Behaviors and scripts to drive Animation system States. You’ll need to evaluate the GDD to determine the correct logic, and analyze your scene to make certain it’s all performing as expected.

Navigation & Pathfinding
-This week you’ll add in pathfinding by evaluating your game’s NavMesh needs. Navigation will give new complexity to your NPC’s behaviour by accounting for Area Costs, triggers, Obstacle Avoidance, and Off Mesh Links. By updating this dynamically, you’ll give players the sense that the enemy is adapting to the environment.

-Raycasting is an important tool in video games for determining line of sight and validating interactions. Simple in concept, but with the number of objects in a common scene it’s important to understand how they work, and how they can be made to work more efficiently.

This week you’ll evaluate your game for its required raycasting functionality. This will require you debugging various mask configurations and optimizing raycast performance.

NPC Spawning & Placement
-NPCs are often the most interesting problem to solve in any game, and the issue of when and where to spawn them is a top priority. A wrong solution to this issue can hamper gameplay by making things boring or too difficult, not to mention tax the system resources of your target platform. This week you’ll be spawning NPCs into your game after evaluating where and how often they should be appearing. Analyzing what will best support gameplay and what the target platform can sustain are critical.