Game Devs Unleash Artificial Intelligence: Flocking Agents
- 2.5 hours on-demand video
- 2 articles
- 8 downloadable resources
- Full lifetime access
- Access on mobile and TV
- Certificate of Completion
Get your team access to 4,000+ top Udemy courses anytime, anywhere.Try Udemy for Business
- 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
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
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?
- Have a Problem
- Gather Relevant Data
- Formulate Hypothesis
- Empirically Test
- Neighborhood radius = abstraction of vision / interest radius
- Cohesion Behavior = form a whole
- Separation Behavior = avoid collisions
- Alignment Behavior = match heading and speed to stay in the flock
- Combine all Behaviors in different proportions
Structure our Project in a simple text file using Pseudocode
- position vector2 or vector3
- rotation vector or quaternion
- world reference
- void update(float t)
- void render()
- Vector cohesion() // cohesion behavior
- Vector separation()
- Vector alignment()
- Vector combine() // combine behaviors
- List<Agent> agents
- void init(int n)
- void update(float t)
- List<Agent> getNeighbors(Agent agent, float radius)// neighbors of agent inside radius
- float maxV// maximum velocity
- float maxA
- float Rc, Rs, Ra
- float Kc, Ks, Ka
Equations of motion
Euler forward integration
Stable integration methods, Runge-Kutta
- // cohesion behavior
- // return a vector that will steer our curent velocity
- // towards the center of mass of all nearby neighbors
- // get all my nearby neighbors inside radius Rc of this current agent
- // no neighbors means no cohesion desire
- // find the center of mass of all neighbors
- // steer our velocity towards the COM
- // make r have the length 1
Individual separation forces combine to give the resultant force
- // separation behavior
- // steer in the opposite direction from each of our nearby neigbhors
- // get all my neighbors
- // no neighbors no separation desire
- // add the contribution of each neighbor towards me
- // force contribution will vary inversly proportional
- // to distance or even the square of the distance
- // alignment behavior
- // steer agent to match the direction and speed of neighbors
- // get all neigbhors
- // no neighbors means no one to align to
- // match direction and speed == match velocity
- // do this for all neighbors
Update loop, Euler integration
Pseudocode + Unity = perfect match, best learning
Cohesion, Separation, Alignment
Ideas=Lines of Code=Simulation
Think it! Build it!
Emergence, split, merge, dance
Playground to experiment aspects of Flocking
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
- 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
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.
- 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.