How To Make Enemies Smarter: AI Weighted Decision-Making

14,887
0
Published 2023-05-07
Ever create a non-playable character that was as clever as a rock? Don't be so mean. Your NPC just needs some nurture and education. In this tutorial, Slyddar teaches you how to make your enemies smarter with AI-weighted decision-making. Turn your NPC into Einstein.

You will learn how to code a system of weighted options which will help your AI make smarter choices.

The tutorial is in GameMaker Language (GML) for GameMaker.

You can get your free copy of GameMaker here and try it out: opr.as/DownloadGM-YT

Find the project here: www.mediafire.com/file/stl9r8w4jn3y2fp/Designing_S…

youtube.com/slyddar
slyddar.com/
twitter.com/slyddar

00:00 Introduction
00:44 AI Dungeon Demo
03:31 AI Multiplayer Demo
04:10 Sample Project Setup
04:33 Create Event
05:23 Step Event - Intro
06:01 Target Parent Object
06:07 Step Event - Collision Check
06:48 Step Event - Find Instance Weight
09:34 Step Event - Find Highest Weight
10:57 Allowing AI to Path

All Comments (21)
  • @lemonberries
    Great explanation of weight values. Also, these videos are very well produced
  • The only thing I would add to the code is give the min and max weight values to the o_target_parent so every time you add a new item to weigh you don't have to increase the size of the switch statement. You can simply tune the min and max on each new added item.
  • @azrhyga
    Great tutorial!! Good job for Slyddar making it!!
  • This was great, thank you for laying this concept out so well!
  • @NoLootStudios
    Could be really cool to use this. Gave me an idea for a new enemy atleast. Big thanks!
  • @emeryro
    Thanks for this, nicely done! One remark: couldn't you save the highest weight (and corresponding item) already in the first _num loop? That way you don't have to browse the array twice
  • Hey guys could you make a state machine for a platformer tutorial please? It would be very helpful
  • @timcal1968
    Sorry if I'm being thick here, but the video mentions that there should be a link to the demo project, however I can't find it?
  • @nemo9396
    The AI is not making choices, it is following established paths. A choice is an option you can ignore, but an algorithm is a path you must follow, no matter what you want to do.