我真的不能说为什么,但是一旦 YouTube 向我推荐了一个关于遗传算法的视频,它真的让我眼前一亮,有人让 google chrome 无法通过学习 AI 单独跳跃和运行游戏。好吧,因为我正在为 Minecraft 编写插件,所以我有了一个想法,用自学 AI(遗传算法)制作基于 PvE 的游戏模式,但现在我很困惑从哪里开始,我可以让健身依赖于杀戮僵尸,或造成的伤害,但我不知道如何再次重现这个,不知何故我必须用人工智能控制运动、射击等,我不知道该怎么做,我希望有人可以帮助我,你理解我的问题。
2 回答
I think what you're trying to do is far more complex than you might think.
If you really want to train autonomous AI for zombies, you're going to need neural networks. But I think this is far too complex for a PvE game.
If you don't want to use neural networks, you have to set up a handful of parameters that define how the zombie acts, like:
- Damage
- Speed
- Health
But it's illogical to use a genetic algorithm for this - you already know that maxing out these values will return the best zombie, so you might need to create more distinct parameters like:
- Speed after hitting a player
- Potion effect after hitting a player
If you want to stay to the 3 points named above, then you should create a maximum value - and make the genetic algorithm find the optimal distribution of this value.
That's the main part sorted out, then you want to get started on the genetic algorithm
- Generation, generate zombies with random properties
- Evaluation, let the zombies play a game, determine their fitness on: damage dealt, kills made, distance travelled
- Selection, select the individuals ripe for crossover
- Crossover, create offspring
- Mutation, modify some values with a chance of
x
I'm quite interested in your project. I advise you to start training some zombies on a local server, and then use these trained zombies as a base for the online version - so the first waves of zombies aren't too easy :)
With regards to your comment:
Actually i want to improve the movement and fight skills ov Zombies, meqans that they go back when they attack delay is colding down when enemys are really defensive and so on, and the zombies try to catch some single players when they play aggressive etc, but not sure how to do something like this, i dont know how to control movement with an AI, and when to attack etc, I know its a lot to do, but i'm realy interested in this.
This definitely requires a neural network. A neural network can have x inputs, these must all be environment variables, like:
- distance nearest player
- speed nearest player
- health nearest player
- etc. nearest player
- its own health
And will compute outputs, which could be:
- movement direction
- movement speed
- hit (true/false)
And you have to evolve the neural network through neuroevolution. You can definitely do this, but heads up; it's hard. Especially with a lot of environment variables.
But read some articles on neural networks, then read some articles on genetic algorithms. Then implement neuroevolution, for example through NeuroEvolution of Augmenting Topologies
我建议您对遗传算法进行一些研究,看起来您在学会走路之前就在尝试跑步。
理想情况下,如果您希望 AI 学习如何移动、射击和其他活动,您需要创建一个可以根据所有这些事情进行评分的健身功能。然后你需要弄清楚你将在什么时候进化/变异/匹配你的 AI/s,这个结果应该从初始分数 0 开始,因为你需要对 AI 重新评分,因为有一个它有可能向后退了一步,而不是向前。