UE4 - Creating a RPG #24 - Smart Random AI Roaming

노기현·2024년 11월 28일
post-thumbnail

Today's Lesson: Smart Random AI Roaming

Summary

1. We take a look at how we can setup smart AI roaming with our enemy AI within Unreal Engine 4.

2. We move them to a random point within the reachable level, making them run around until the find the player.

3. We cover all the blueprints to setup this script.

Virtus Learning Hub


✅ Random Point로 AI 이동시키기

◼️ 블루프린트를 이용해 로직 구현
In Character Blueprint <SimpleAI>

  • New Variable: IsMoving
    Type: Boolean, Default Value: False
    AI가 이동 중인지 알려주는 변수
  • Event Tick → Delay(duration: 2.0)
    2초마다 로직 실행
  • IsMoving 변수가 False인 경우
    GetRandomReachablePointInRadius를 통해 Random Location을 생성하여
  • AI Move To를 통해 AI를 이동시킴
  • 완료 후 IsMoving 변수를 다시 False로 설정

✅ 플레이어를 무한히 쫓아가는 AI

◼️ Loop를 이용해 구현

✅ Result

  • Random Point로 AI 이동
  • 무한히 쫓아오는 AI
profile
RPG 기획자 지망생

0개의 댓글