This site requires JavaScript, please enable it in your browser!
Greenfoot back


You need to login to take part

Current Discussions


AI for Enemy Tank in Tank Game

By SushiLlama, with no replies.
Since i want my game to be singleplayer (Player vs COM) i need a way to tell the Enemy (COM) what to do. For now i implemented a method so that he turns towards the player and shoots when the turret i aligned. But that seems unrealistic and is kind of boring to be honest. So i came to an idea: Why not use AI for this? I want to use some kind of library since i dont think im able to make one myself considering my skills. I want to train the tanks by maybe fighting COM1 vs COM2 with fitness points for surviving time / killing (i dont know what to choose???). Although Neural Networks are really mathematic i understand how they work. I want my Enemy to be able to turn his turret left or right and or shoot (3 outputs). This should be done by the input of the map with the player tank (and obstacles on it). This sounds like a not too hard beginning for playing with AI. I tried following an AI tutorial but i couldnt figure out how to implement that for my game. Also, how would this minimap like overview of the Enemy Tank look as a input? And how many neurons should i have for the hidden layer? In conclusion: I need a library / easy adjustable code for beginners two steer the enemy turret either left or right or even not turning it and shooting/not shooting. How would i choose my input type? How many neurons in the hidden layer are recommended? How do i let tanks train and how can i save some of the best as a cast for new tanks created in each game? Is saving some AITank of Generation x and mutating him for each game even possible? Thanks for any answer given!