How to use Context Steering AI in Unity - P1 Overview

Published 2022-07-11
Creating a Context Steering AI in Unity that makes an Enemy move naturally can be tricky. In this video we will implement Context Steering Behaviors in Unity for Chasing the player while Avoiding Obstacles to make our Enemy appear smart.

Learn C# for Unity by making games:
courses.sunnyvalleystudio.com/

Previous tutorials about this system:
   • Unity RPG Mechanics  

Context Steering article:
www.gameaipro.com/GameAIPro2/GameAIPro2_Chapter18_…

Github Scripts
github.com/SunnyValleyStudio/Unity-2D-Context-stee…

Patreons Link - Full Project:
www.patreon.com/posts/68964987

𝗛𝗮𝘃𝗲 𝗮𝗻𝘆 𝗾𝘂𝗲𝘀𝘁𝗶𝗼𝗻𝘀? 𝗝𝗼𝗶𝗻 𝘁𝗵𝗲 𝗱𝗶𝘀𝗰𝗼𝗿𝗱!
discord.gg/RQEtYHz

𝗣𝗟𝗘𝗔𝗦𝗘 support the channel:
www.patreon.com/sunnyvalleystudio

00:00 Intro
00:49 What is context steering
02:51 Weights
03:22 Interest and Danger arrays
04:49 Selecting the movement direction
06:03 Enemy Wall Avoidance Problem


#unity2d #ai #gamedev

All Comments (21)
  • @aledjones8816
    Love this. I've played with A* in the past but I always wanted something a tad simpler and more lightweight, and this seems perfect. Your videos are awesome, keep up the great work!
  • @daveh5139
    I am so excited. I have been looking for something like this for months.
  • @alright4422
    I'm glad you're doing a video on Context Steering. I've known about Context Steering for some time, but I was still always surprised at how few resources can be found out there, even though the algorithm can be really useful.
  • @crunchyduck
    The idea of caching the last position has saved my path finding. I can't believe I didn't think of that! Thanks man :)
  • Thanks, your tutorials are brilliant among others on Unity & Gamedev, and offer good codestyle
  • @mbsnke2349
    Awesome stuff, thank you so much for this amazing tutorials!
  • @yairtayb8665
    your tutorials are on point, thanks for your guidance
  • @dappercthulhu4386
    Hello, I'm not using unity for my project (using godot), but your explanation of this algorithm is so succinct that I was very easily able to translate this into an entirely different engine. Thanks!
  • @tucccci
    Very good explanation! Looking forward to the code.
  • @gamedevbaiyi936
    This's what I need !!! I'm coding my own Pathfinding System, but pathfinding to a moving item is very costly. This is a new solution for me. Thank you bro !!! Have a good day. 😆😆
  • @Synith19
    I think this will be the solution I need for my current problem, thank you!
  • I love your tutorials so much! Im very lucky to found you on youtube! I have one question. How can i make that the enemy dont stack at each other? and spread around the player to attack.
  • @mehdikovic
    Hello there, thank your for your awesome tutorial. I just wondering, what is the performance penalty for using 8 (or 5) raycasts instead of navmesh baking and querying A* path in every update if any? Using raycasts and breadcrumbs is awesome
  • @ariyabayat5292
    Thanks so much for this tutorial, I really enjoyed it! You managed to make context steering sound simple! 6:03 About the enemy wall avoidance problem, do you think there's any way of getting past this with another solution? Testing this system out with complex environments like moving obstacles, the last cached position can end up at the other side of a moving obstacle so the enemy tries to run at it until the obstacle moves away. I was thinking about maybe somehow mixing pathfinding with this system. Do you have any suggestions?
  • Hi, thanks for tuts! Can I also use it for obstacle avoidance of enemies?
  • @peche87_gameDev
    How you manage more than one enemy if they should avoid between them? I think a good answer would be flocking or flow field… but I would like to see what you think. Great content :) Thanks!