최석근 avatar

[개발일지] 두덕용사 - 물고기 AI

nukunit

Published: 14 Jul 2017 › Updated: 14 Jul 2017[개발일지] 두덕용사 - 물고기 AI

[개발일지] 두덕용사 - 물고기 AI

안녕하세요. 넉근입니다. ^^
시골로 귀농한 주인공이 용사로 성장하는 게임 두덕용사 개발일지입니다.

참치가 제주도 앞바다에 나타났다고 합니다.
두덕용사가 가만히 있을 수 없죠.
어디 잡으러 가볼까요?

Honeycam 2017-07-15 01-03-36.gif

참치가 나타났긴 했는데,
뭔가 움직임이 이상하네요.

전 아래 사이트를 참고해서 구현해 보았습니다.

Understanding Steering Behaviors: Wander
https://gamedevelopment.tutsplus.com/tutorials/understanding-steering-behaviors-wander--gamedev-1624

// Calculate the wander force
private function wander() :Vector3D {
   var now :Number = (new Date()).getTime();
 
   if (now >= nextDecision) {
    // Choose a random position for "target"
   }
 
   // return a steering force that pushes the character
   // towards the target (the seek behavior)
   return seek(target);
}
 
// In the game loop, handle forces and movement just
// like before:
public function update() :void {
   steering = wander()
   steering = truncate (steering, max_force)
   steering = steering / mass
   velocity = truncate (velocity + steering , max_speed)
   position = position + velocity
}

요약해 보면,

  1. 일정한 시간간격으로 랜덤한 목적위치를 찾는다.
  2. 목적위치까지 일정한 속도로 이동한다.
  3. 조향장치(steering)를 이용해서 자연스럽게 회전하면서 이동한다.

일단 이정도로 구현해 보았습니다.
물고기 AI 어떻게 하면 좀 더 자연스러울까요?

알파고가 대신 구현좀 해줬으면 좋겠네요. ㅎㅎ
포스팅 봐주셔서 감사합니다. __

Leave [개발일지] 두덕용사 - 물고기 AI to:

Written by

블럭체인과 게임의 융합

Read more #kr posts


Best Posts From 최석근

We have not curated any of nukunit's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.

More Posts From 최석근