简体   繁体   中英

What is the best way to input game objects positions into my neural network as summary data in Unity

So I'm doing some project for my Uni with my friends. We doing a game similar to diablo in Unity . My part is to code neural network for monsters in the game. Monsters can fight solo or in a group. Of course, I want monsters to behave differently depending on group size. To achieve proper behaviour when fighting in a group I need to input some summary data that represent relative monsters position. I want to have same number of inputs for every case. By that i mean same network structure for group of 1,2,3,4.... monsters.

For now I was thinking about inputting:

  • the distance between the closest monster and the current monster
  • the angle between closest monster and current monster - by that i mean angle between vector[monsterA.position - monsterB.position] and some const vector that represents north for example.
  • the distance between the farthest monster and the current monster.
  • the angle... same as above.
  • center of mass of a polygon that these monsters' positions create.

Do u have any advice for me? Is this a good idea, or there are better ways to do this?

Maybe establish a trigger called "battle area" or something around the player giving the current number of enemies inside of it to the enemy script when enemies enter or exit the area. I'm not sure if this is necessarily better but it would be really easy to implement and wouldn't be super taxing on performance.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM