AI in Unity3D
(and a bit more)
TGF workshop – summer 2013
Parvaneh Game (AI Programmer)
Impressive Engine 2D (Lead programmer)
Impressive Engine 3D (Lead programmer)
Financial Automation and MIS (Programmer)
Active Vehicle Locator (Lead programmer)
What does AI actually do ?
The most obvious is in the control of any NPCs in the game
Is another common use for AI
Widely seen in real-time strategy games
Finding a path to a target while avoiding collisions with other entities (NPC, players...)
Dynamic game difficulty balancing
Adjusting the difficulty in real-time based on the player's ability
Bests in Game AI :
Halo (Combat Evolved)
Far Cry 2
Advantages and requesties of impl. AI
Time and budget in a project
In most of projects, we (programmers) have no enough time to impl.
everything with a good operation
In other hand, budgets are limit, so the risk is not too logical...
Enough technical knowledge
Maybe you can impl. an AI engine from scratch with a few knowledge about
it, but will it works fine ? even with good performance ?
I don’t think so
Good points on impl. ?
Don’t have to pay performance for some unsuable features in a pre-built...
Impl. everything what you think it works, even it’s fake ?!
Somewhere, you may move your AI-Bots on a Path or use Pathfinding, which one
you’ll use ?
Advanced AI Pro
A complete AI solution, it has an industry-standard enemy, NPC, and friendly AI
A* Pathfinding Project Pro
Write a TD, RTS, FPS or RPG game, this is for you with heavily optimized
algorithms and a large feature set but yet simple to use
Easily create and modify dynamic AI Behaviors for your game project
This package contains three different enemy AI types that can be used for shooter
And some other are available in assetstore.unity3d.com
A* Pathfinding Project
Graph types : Navmesh, Grid, Waypoint
Graphs can be saved to files
Source code included
Search thousands of nodes/ms
Runtime graph update
Fully Penalty-Area support
Uses Recast algorithm for Navmesh
Good custom inspector and tools in edit-time
A bit more...
(Useful libraries and books)
So where’s my start point ?
Programmin Game AI by Example (Mat Buckland)
AI Game Engine Programming (Brian Schwab)
Search about Recast-Algorithm (If you didn’t before)
Impl. in Low-Level, Use in High-Level
Just do it with enough knowledge (To study, do it with basic knowledge)
Design it single-threaded and multi-threaded support
Alright, how ?
C code (Compile as DLL)
void PrintText(const char *Message)
C# code (Compile as EXE)
public class Test
static extern void PrintText(string Message);
public static void Main(string args)
PrintText("C# => C++");
I’m not FAN of Unity3D, just a simple developer !
Sometimes, AI can be so simple, even just a Plug-In
But sometimes, It should design larger
Everything is up to requesties
Don’t forget power of C/C++, Everything will be fine
Also, don’t forget GPU and it’s magical power, use it