I cannot realy say why, but once YouTube suggested a video about an Genetic Alogirthm to me, well it really flashed me, someone made the google chrome no internet jump&run play alone by an learning AI. Well since i'm programing plugins for Minecraft i got an idea to make an PvE Based Gamemode with an self learning AI (The Genetic Alogrithm), but right now i'm confused where to start, i can make the Fitness depended on the Kills of the Zombie, or on the damage dealt, but i dont know how i can reproduce this again, somehow i have to control the movement, the shots and so on with the AI, and i got no clue how to do that, i hope someone can help me, and you understand my question.
-
There are many ways to approach this, and therefore I do not think this is a very good question for Stack Overflow. I would say https://www.reddit.com/r/gameai/ is the place to go for this kind of question, but since the community is not that big there you could also try https://www.reddit.com/r/gamedev/. You can come back to Stack Overflow with your algorithm when you have fleshed it out some more yourself and are stuck on how to continue, but alternatively you can also go to http://gamedev.stackexchange.com/ then. It might also be useful if you read https://stackoverflow.com/help/dont-ask. – PJvG Apr 13 '17 at 07:47
-
Thanks, yes i have to agree, hard to find a categoryfor this question since its basic AI knowledge, but also about game development. – Justin G. Apr 13 '17 at 13:23
-
I can understand that it's hard to find a place to ask your question. If you read through the [tour] it is very clearly stated that questions that are likely to generate discussions are not very suited for Stack Overflow. If you ask something like "where to start with game AI?" you really are asking for opinions. There cannot really be one best answer on such a question and is therefore not a good question for Stack Overflow. If you want discussions or opinions it's best to go to a forum or to reddit. I hope the links I provided you earlier are useful to you. – PJvG Apr 13 '17 at 13:47
2 Answers
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

- 6,489
- 5
- 30
- 73
-
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. – Justin G. Apr 13 '17 at 13:01
-
@JustinG. if you're completely new to game AI I would suggest to start with a Finite State Machine or a Behavior Tree first for writing NPC behavior. Once you've made a few programs like that and you understand how you can control NPCs, only then would I try to start with *learning algorithms* such as *genetic algorithms* or *neural networks* to generate/learn NPC behavior. The following site also provides lots of information about game AI to get you started: http://www-cs-students.stanford.edu/~amitp/gameprog.html#ai – PJvG Apr 13 '17 at 13:58
-
NeuroEvolution of Augmented Topologies would be a good solution to the problem, this uses a genetic algorithm to modify the structure and weights of a neural network. I would do as @PJvG has said, start small, then go big - machine learning is far from simple, there is a lot you have to understand. – SpunkyDonutz Apr 13 '17 at 16:38
I suggest you do some research on genetic algorithms, it looks like you're trying to run before you've learned to walk.
Ideally, if you want the AI to learn how to move, shoot, and other activities, you need to create a fitness function that can score based on all of these things. You then need to figure out at what point you're going to evolve/mutate/mate your AI/s, the product of this should start with the initial score of 0, as you will need to rescore the AI, as there is a possibility it could have taken a step backwards, rather than forwards.

- 86
- 7
-
-
http://www.ai-junkie.com/ might be a good starting point; academic papers are also useful for all AI subjects. – SpunkyDonutz Apr 12 '17 at 22:02