简体   繁体   English

将游戏对象位置作为 Unity 中的摘要数据输入我的神经网络的最佳方法是什么

[英]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 .我们在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.为了在团体战斗中获得正确的行为,我需要输入一些代表相关怪物 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.我的意思是1,2,3,4....怪物组的相同网络结构。

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.最近的怪物和当前怪物之间的角度 - 我的意思是向量 [monsterA.position - monsterB.position] 和一些代表北方的常量向量之间的角度。
  • 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.我不确定这是否一定会更好,但它真的很容易实现,并且不会对性能产生超级负担。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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