Jump to content

  • Log In with Google      Sign In   
  • Create Account

#ActualSammieo

Posted 01 March 2013 - 06:32 PM

Hey guys. Complete game development beginner, but I've been working on a final-year uni project for the better part of three months, and the pressure is on to finish it by the end of March.


I'm making a computer game using the UDK engine, and it involves a simple scripted NPC in Unrealscript. I have much of its behaviours mapped out, but the core of its activity is going to be a search algorithm for the NPC to wander around the map until it sees something that makes it enter a function state.

1) A random world coordinate is generated to be the goal node.
2) Apply A* (or Best First) search to go to that coordinate.
3) If it sees the player, end the search and enter a ChasePlayer state
4) If it reaches the goal node, generate a new node and start again.

I'm no stranger to programming and I've worked with plenty of search algorithms several times in other projects, but never before in a game. My impression is that I'd be able to have a Searching state that contains the A* search algorithm written into code, and just go back and forth from there.

Now the main question - is there anything impossible or wrong with what I've just suggested? Is there something I should know about that'd complicate things in this way? I hear mixed reports about A* search in games, so I'd like to clear the air. Any advice you could give me would be hugely appreciated!

#2Sammieo

Posted 01 March 2013 - 06:29 PM

Hey guys. Complete game development beginner, but I've been working on a final-year uni project for the better part of three months, and the pressure is on to finish it by the end of March.


I'm making a computer game using the UDK engine, and it involves a simple scripted NPC in Unrealscript. I have much of its behaviours mapped out, but the core of its activity is going to be a search algorithm for the NPC to wander around the map until it sees something that makes it enter a function state.

1) A random world coordinate is generated to be the goal node.
2) Apply A* (or Best First) search to go to that coordinate.
3) If it sees the player, end the search and enter a ChasePlayer state
4) If it reaches the goal node, generate a new node and start again.

I've worked with plenty of search algorithms several times in other projects, but never before in a game. My impression is that I'd be able to have a Searching state that contains the A* search algorithm written into code, and just go back and forth from there.

Now the main question - is there anything impossible or wrong with what I've just suggested? I hear mixed reports about A* search in games, so I'd like to clear the air. Any advice you could give me would be hugely appreciated!

#1Sammieo

Posted 01 March 2013 - 06:29 PM

Hey guys. Complete game development beginner, but I've been working on a final-year uni project for the better part of three months, and the pressure is on to finish it by the end of March. I'm making a computer game using the UDK engine, and it involves a simple scripted NPC in Unrealscript. I have much of its behaviours mapped out, but the core of its activity is going to be a search algorithm for the NPC to wander around the map until it sees something that makes it enter a function state. 1) A random world coordinate is generated to be the goal node. 2) Apply A* (or Best First) search to go to that coordinate. 3) If it sees the player, end the search and enter a ChasePlayer state 4) If it reaches the goal node, generate a new node and start again. I've worked with plenty of search algorithms several times in other projects, but never before in a game. My impression is that I'd be able to have a Searching state that contains the A* search algorithm written into code, and just go back and forth from there. Now the main question - is there anything impossible or wrong with what I've just suggested? I hear mixed reports about A* search in games, so I'd like to clear the air. Any advice you could give me would be hugely appreciated!

PARTNERS