Discover this podcast and so much more

Podcasts are free to enjoy without a subscription. We also offer ebooks, audiobooks, and so much more for just $11.99/month.

GDD 011 : Beginner’s Guide To Enemy AI

GDD 011 : Beginner’s Guide To Enemy AI

FromThe Game Design Dojo Podcast


GDD 011 : Beginner’s Guide To Enemy AI

FromThe Game Design Dojo Podcast

ratings:
Length:
59 minutes
Released:
Apr 7, 2014
Format:
Podcast episode

Description

Crash course in how to set up AI for your game, complete with pro tips from our resident AI programming expert, Ike.

GDC 2014 has come and gone, we give a little recap of our highlights of the conference. The most exciting part was after Brian's speech at the Unity Booth fans from this podcast came up and talked to us. So just wanted to give a shout out to those that approached us, Thank you!

In other news, Brian's company Fenix Fire will launch a Kickstarter campaign for "Source" which will be available for Xbox 1, PS4, and Steam Greenlight for PC. We want to be as transparent as possible so you can learn from this experience. We'll be showing and discussing the approach, marketing, press, social media, numbers and much more. This is an exciting an unmarked territory challenge and we're looking forward to sharing it with you.
Enemy AI
This podcast is a beginner's guide on how to set up a basic enemy character and how to organize basic functionality. Ike uses his 15 years of experience and gives some black belt examples and ideas while Brian keeps it on a simpler level so wherever your skill level is this will be a helpful podcast for your game development.

3 Key Elements of Enemy AI

Goals
Movement
Responding to player

Goals
First split up behavior between unconscious decisions and conscious decisions. Separate your actions, behaviors and animations into which category it's going to be in and understand the unconscious decisions take priority over the conscious decisions.

A good exercise when starting out is to write down all the conscious and unconscious actions that you're Enemy AI will do. Keep it at a high level.

Conscious Decisions

Patrol - trying to find the player, but not necessarily seeking them out
Idle - waiting for something to happen
Moving - to a specific location
Attack - aggressively of lightly

Give a sense of urgency  to each goal this allows you to swap in different animations later and when you have the character respond the same for starters it also gives flexibility later on. However, different states of urgency is more of an advanced feature, the next layer so to speak but it's one that has to be developed early on because it's hard to add later and it creates a more life like complex character for human behavior.

Unconscious Decisions:

Hit reaction - hit by bullet
Falling - fell off a ledge
Thrown on the ground
Death Sequence
The character doesn't think about what's happening to them, they're a victim of the environment

Step by Step in Unity
Next, we go though a detailed explanation of diving in and creating an example using Unity.

Here are some definitions and explanations of terms we've used:

Pathfinding: Basically the study of how do you get from one location to the other when the direct path is unavailable.

Character Controller: Certain kind of entity that you can put on to an object and it all of a sudden assumes and absorbs a lot of the nice functionality for moving characters around.

Ray Cast: Imaging looking through binoculars or a telescope and you're looking down a very pinpoint vision, a cone of vision but can see very very far and anything that is interrupting that can be sensed because you're using a ray cast. Basically you pass in a starting positions and an ending position in 3 dimensional space and the first thing that it comes in contact with from the starting position you can get data on it.

Switch Case Functions: A little bit different than an if then statement in programmer talk. Brian gives a detailed example of how he uses this with his Enemy AI
Helpful Advice
We're big believers in tracking and recording the state changes of your NPC. Create a change state function and have all the state changes go through there then put it out to your debug window to always have it around. Because one thing with AI is it's really hard to reproduce the same situation over again sometimes and it's a really good idea to ...
Released:
Apr 7, 2014
Format:
Podcast episode

Titles in the series (26)

All About Game Design, Production, and Publishing in Today’s Fast Paced Global Market