Unreal Engine 5 Tutorial: Using State Trees for NPC Movement | UE5 Version 5.2+ | Part 1

แชร์
ฝัง
  • เผยแพร่เมื่อ 3 ธ.ค. 2024

ความคิดเห็น • 20

  • @D3kryption
    @D3kryption  7 หลายเดือนก่อน +3

    What do you think of StateTrees vs Behavour Trees then? Have you used any? Which do you prefer? Let me know below! :)

    • @kukukudoes458
      @kukukudoes458 7 หลายเดือนก่อน +1

      State tree all the way

  • @Al-Misanthropic-Bundy
    @Al-Misanthropic-Bundy 7 หลายเดือนก่อน +3

    Omg. Yes!
    Thank you so much for this one! Really wanna get into State Trees but couldn't find one concise enough.

    • @D3kryption
      @D3kryption  6 หลายเดือนก่อน +1

      Happy I could help! :D

  • @TheAmazingElys
    @TheAmazingElys 3 หลายเดือนก่อน +1

    Very usefull, a nice introduction to state tree and simple NPC Movements. I'm starting to implement IA for my game and it was one of the most useful tutorial I found to kickstart it.

    • @D3kryption
      @D3kryption  3 หลายเดือนก่อน

      I really love the state trees. They just need some more TLC from epic :D

  • @m3makesgames
    @m3makesgames 6 หลายเดือนก่อน +2

    I really hope you make more content around state tress this has been an amazing help for me. What is the best way to interrupt a state? the AI Move to or Move to Location or Actor will pause the task in the tree until the move is completed. This means say I have an enemy AI that moves to location, but upon his AI perception detecting my actor via sight i'd like them to stop moving and say move into the nearest cover and kick off a different set of actions. The only way I've found is to have the movement state wire up a hook into the AI Perception events and look for those AI perception events and then cancel the movement, which would fail the task and then the task would proceed down the tree, but I don't have a good way of saying. "no stop movement, you need to move into the attack state now"

    • @D3kryption
      @D3kryption  6 หลายเดือนก่อน

      Thank you! :D
      This is an interesting one. You could call Restart on the state tree which would stop the tasks and make the tree go back to the base.
      Another option is to try out the global tasks on the state tree.
      I'm not sure if a global task completing with a transistion to another state would cancel the other states or not (I'll have to test this)
      The other option, is to reduce the tick amount in class settings, and on your move to task, it checks if it needs to be interrupted :)

  • @davy4842
    @davy4842 7 หลายเดือนก่อน +1

    Nice video ! Have you done a quest board using narrative? Where quests have cooldown!

    • @D3kryption
      @D3kryption  6 หลายเดือนก่อน

      I've got this one noted down! Its a great idea :D

  • @sonic55193
    @sonic55193 2 หลายเดือนก่อน

    Hi do you know how to spawn and despawn NPC but simulate their task, health/status and even do combat on the backend even though the player is not around in the area. Give NPC's some form of persistence. I've been looking for some sort of tutorial like this but I can't seem to find anything about it online. I would like to know where to start in designing something like this in UE5.

    • @D3kryption
      @D3kryption  หลายเดือนก่อน

      Hey!
      Its an interesting question.
      I think you'd have to really think how much you want to be done.
      If you are having a hidden non rendered npc doing 100% of the work they'd do if you were right next to them, you might want to rethink the idea. Why are they doing the exact same task with you not in the same region? Do they NEED to do the tasks physically or can it be simulated?
      For instance, if were are talking something like an NPC farming. They need to farm whether you are there or not.
      When they are hidden / you are far enough away. Stop their AI logic / hide the etc..
      Then note down the current game time from the point they stopped renderering.
      Now you have a fixed point in time from when they stopped.
      When you go back in and they start renderering, you can hook into world parition to see when they came back online
      then check that last saved date.
      Work out how long it takes them to perform their farming action then muliply it based on the save time and the new current time.
      E.g. 3 minutes they've been out of action. Every 10 seconds they can farm 10 items.
      180 (3 minutes in seconds) / 10 - 18 * 10
      then you can artifically apply the updates making it LOOK like they kept working.
      Super optimised :)

  • @akib2161
    @akib2161 4 หลายเดือนก่อน +1

    I dont got it if we can just use state tree on ai controller then why its not working untless i add it to the character blueprint

    • @D3kryption
      @D3kryption  4 หลายเดือนก่อน

      Have you assigned your character blueprint the correct AI controller?

    • @akib2161
      @akib2161 4 หลายเดือนก่อน

      @@D3kryption yess i did and also the state tree don't have any decorator type function something to abort a task on the value changes

  • @CGPine
    @CGPine 6 หลายเดือนก่อน +1

    Hi. I have a question. StateTree AI needs a navmesh?

    • @D3kryption
      @D3kryption  6 หลายเดือนก่อน +1

      Hey!
      Depending how you create your state tree tasks (such as how you move your AI) you may have to create a navmesh yes.
      If you use Unreal's default AI stuff, then you will need it.
      If you use another plugin, it might not use it :)

    • @CGPine
      @CGPine 6 หลายเดือนก่อน +1

      @@D3kryption I’m just now trying to make a crowd, like L4D or Days Gone, but the usual crowd AI loads the system a lot. And I’m thinking of implementing this using mass AI, but I don’t know if it needs navmesh

    • @D3kryption
      @D3kryption  6 หลายเดือนก่อน

      @@CGPine I believe MassAI doesn't by default use the navigation system and simply simulates walking between multiple points.
      I found this link which claims to have done it but I've not tested it :D
      github.com/stopthem/MassZombies

    • @CGPine
      @CGPine 6 หลายเดือนก่อน

      @@D3kryption thanks