Game Devs Unleash Artificial Intelligence: Flocking Agents
4.4 (52 ratings)
Instead of using a simple lifetime average, Udemy calculates a course's star rating by considering a number of different factors such as the number of ratings, the age of ratings, and the likelihood of fraudulent ratings.
823 students enrolled
Wishlisted Wishlist

Please confirm that you want to add Game Devs Unleash Artificial Intelligence: Flocking Agents to your Wishlist.

Add to Wishlist

Game Devs Unleash Artificial Intelligence: Flocking Agents

Artificial Intelligence for Game Devs in Unity to understand & implement the beautiful bird's natural Flocking Behavior
4.4 (52 ratings)
Instead of using a simple lifetime average, Udemy calculates a course's star rating by considering a number of different factors such as the number of ratings, the age of ratings, and the likelihood of fraudulent ratings.
823 students enrolled
Created by Razvan Pistolea
Last updated 3/2016
English
Current price: $10 Original price: $150 Discount: 93% off
5 hours left at this price!
30-Day Money-Back Guarantee
Includes:
  • 2.5 hours on-demand video
  • 2 Articles
  • Full lifetime access
  • Access on mobile and TV
  • Certificate of Completion
What Will I Learn?
  • Analyze, Decompose and Implement custom Flocking Agents for your own game or movie or personal simulation project
  • Understand and Create Emergence: simple rules that interfere to give rise to complexity
  • Appreciate emergent behaviors in nature around you
  • Gain problem solving skills
  • Understand and use Vectors and Vector Operations successfully in a Game Engine
View Curriculum
Requirements
  • You should already have basic Computer Science skills (minimum 6 months experience)
  • You should already be familiar with any game engine (minimum 3 months experience)
  • Have Unity 3D game engine installed or your own favorite game engine
  • Understand Pseudocode or C# or Java
Description

Learn how to create Artificial Intelligent Agents that have Flocking Behavior and apply them to your projects in games or movies. You have seen Flocking behavior in nature, in games, in movies and in architectural simulations but you might have missed it.

The course is project based with the best teach-apply loop:

  • a theoretical pseudocode (game engine agnostic) implementation
  • followed immediately by a practical implementation and application in Unity 3d

Both pseudocode and Unity C# lectures complement each other giving you a full perspective.

Best video quality 1080p full HD.

You will have access to the course forum where you can discuss each topic with like-minded, A.I. passionate, students like yourself.

With the help of this course you will be able to understand a piece of nature and replicate it, essentially reverse engineer a piece of nature. Invest in yourself and add Flocking to your A.I. skill set! Follow this Unleash A.I. series.

Still unsure? Dive in and learn, and if you are not satisfied you get a 30 day money back guarantee! No questions asked.

Who is the target audience?
  • The course is best suited to programmers who want to add realistic bird flocking or fish schooling or other emergent behaviors to their games, movies or simulations.
  • The course is best suited to programmers looking to improve their skills on working with Vectors inside the Unity 3d game engine
  • The couse if partially suited for students who want to learn emergent behaviour but do not have prior programming experience. The must have at least basic math or physics skills.
  • The course is partially suited for students who already know about emergence. They can use it as a refresher.
  • The course is not suited for students who do not have basic math or physics skills.
Students Who Viewed This Course Also Viewed
Curriculum For This Course
26 Lectures
02:20:20
+
Introduction
2 Lectures 02:50

Hi, Razvan Pistolea

What are Artificial Intelligence Agents with Flocking Behavior

Applications of Flocking Behavior in Games, Movies, Engineering and Architectural Simulation

Journey of exploration and implementation

Preview 01:51

Understand how Flocking Behavior appears in nature

Discover the mechanics and equations of Flocking

Implement Flocking


Funny scenario about a Big Movie Producer wanting a flock of sci-fi birds and a big money reward for you if you do it fast and believable

Problem Definition
00:59
+
Insights
3 Lectures 17:29

Carefully and analytically observe our Earthly flocking birds in their natural habitat

Homework: You must write at least 6 observations

  1. They repeatedly separate and combine...like quicksilver
  2. They move like a wave or a fluid
Observe Nature
08:21

Questions Answers Insights

Why do you think some birds fly together?

Their movement seems orchestrated somewhat. Does each bird have a sheet music telling it where to go?

Does this behavior seem completely random or do some patterns exist?

Can you think of other animals that are not birds but still "flock" as well?


Relevant questions for our hypothesis:

Does a bird look at all the other birds or just at a few of its nearby neighbors?

Do birds bump into each when they fly or are they separated?

Do birds in the same group or cluster fly in the same direction and with an approximately same speed?

Preview 05:07

Scientific method:

  1. Have a Problem
  2. Gather Relevant Data
  3. Formulate Hypothesis
  4. Empirically Test

Ideas:
  1. Neighborhood radius = abstraction of vision / interest radius
  2. Cohesion Behavior = form a whole
  3. Separation Behavior = avoid collisions
  4. Alignment Behavior = match heading and speed to stay in the flock
  5. Combine all Behaviors in different proportions
Hypothesis
04:01
+
Implement Basic Flocking in Pseudocode and Unity
14 Lectures 01:20:01

Structure our Project in a simple text file using Pseudocode


class Agent{

  1. position vector2 or vector3
  2. rotation vector or quaternion
  3. velocity
  4. acceleration
  5. world reference


  • void update(float t)
  • void render()
  • Vector cohesion() // cohesion behavior
  • Vector separation()
  • Vector alignment()
  • Vector combine() // combine behaviors

}

class World{

  1. List<Agent> agents
  • void init(int n)
  • void update(float t)
  • List<Agent> getNeighbors(Agent agent, float radius)// neighbors of agent inside radius

}

class AgentConfig{

  1. float maxV// maximum velocity
  2. float maxA
  3. float Rc, Rs, Ra
  4. float Kc, Ks, Ka

}

Structure Project in Pseudocode
07:27

Create a new project in Unity

Write a simple Move script

Add script statically or dynamically to object

Prefabs in Unity = template, blue print

Structure Project in Unity - Creating a New Project
05:05

Agent

World

AgentConfig

Spawn Function

Structure Project in Unity - Agent, World, AgentConfig
09:21

Equations of motion

time

acceleration

velocity

position


trucate acceleration

trucate velocity


Euler forward integration

Rocket science

Stable integration methods, Runge-Kutta

Preview 05:21

Unity uses the metric system


Equations of Motion in Unity
02:49

Go towards the center of mass of all nearby neighbors

Cohesion Behavior in Pseudocode
04:50

Vector cohesion(){

  1. // cohesion behavior
  2. // return a vector that will steer our curent velocity
  3. // towards the center of mass of all nearby neighbors
  4. // get all my nearby neighbors inside radius Rc of this current agent
  5. // no neighbors means no cohesion desire
  6. // find the center of mass of all neighbors
  7. // steer our velocity towards the COM
  8. // make r have the length 1

}

Preview 04:55

Individual separation forces combine to give the resultant force


Vector separation(){

  1. // separation behavior
  2. // steer in the opposite direction from each of our nearby neigbhors
  3. // get all my neighbors
  4. // no neighbors no separation desire
  5. // add the contribution of each neighbor towards me
  6. // force contribution will vary inversly proportional
  7. // to distance or even the square of the distance

}


Separation Behavior in Pseudocode
04:26

Separation Behavior in Unity
03:59

Match heading and speed in order to stay withing the flock

Alignment Behavior in Pseudocode
02:59

Update Prefab

Warning!

Tokyo Drift

LookAt function


Vector alignment(){

  1. // alignment behavior
  2. // steer agent to match the direction and speed of neighbors
  3. // get all neigbhors
  4. // no neighbors means no one to align to
  5. // match direction and speed == match velocity
  6. // do this for all neighbors

}

Preview 06:53

Combine all forces at the same time in different proportions

Combine All Behaviors in Pseudocode
03:35

Wrap around to keep inside the view

Combine All Behaviors in Unity
08:14

Structure problem

Update loop, Euler integration

Pseudocode + Unity = perfect match, best learning

Cohesion, Separation, Alignment

Tweek Parameters

Ideas=Lines of Code=Simulation

Think it! Build it!

Emergence, split, merge, dance

Complex->Pieces->Recombine

Playground to experiment aspects of Flocking



Summary for Basic Flocking Implementation
10:07
+
Refinements for Advanced Flocking Behavior In Pseudocode and Unity
5 Lectures 39:23

360 degrees default

180 degrees realistic

angle between 2 vectors

add the refinement to all behaviors

Field of View Refinement in Pseudocode
05:01

They move closely together

They are moving like a wave

Field of View Refinement in Unity
04:19

A solo creature or a small flock that wanders purposefully on the map

Jitter vs Smooth = Dumb vs Purpose

Generate a small random target that moves on a circle in from of the agent

Project the target from local space to world space

Preview 08:50

Update prefab to have a Default Transform

Warning ! the transform scale influences the projection from local space to world space

Adding Wandering Behavior in Unity
11:41

Extend the Agent Class to make a Predator Class

Avoid Enemies Behavior

Flee Behavior

GetPredators Function


Adding Avoid Enemy Behavior in Unity
09:32
+
Conclusion
2 Lectures 00:41
Student Projects
00:11

What's next
00:30
About the Instructor
Razvan Pistolea
4.2 Average rating
217 Reviews
7,743 Students
4 Courses
Source Code Painter

I am a Machine Learning Engineer, Deep Learning Engineer and even an Indie Game Developer with a Major in Compilers and a Master's degree in Artificial Intelligence from University Politehnica of Bucharest.

I am passionate about Games and Artificial Intelligence. I love to give life to A.I. agents in my project or my friend's projects and I want to teach you too.