Advertisement

Genetic Algorithm FPS tratits optimization

Started by October 10, 2010 04:19 AM
4 comments, last by kirkd 14 years ago
I have to do a term project on Genetic Algorithms, and I had the idea of tuning the traits (i.e. weapons to be used , etc) of a first person shooter bot. For example, I would represent the traits in the form of a string, with first 10 bits representing probability of choosing weapon1, next 10 bits representing probability of choosing weapon2, etc. I would thus get the optimal string and thus be able to figure out what should be the optimal set of weapons the bot should use.

The obvious problem that I am facing is how to find the fitness values. My idea was that if I want to find the fitness of a string, I force the bot to use the corresponding weapons and play a game against it and use the final score of the bot as the fitness. The problem is that I would need to play a LARGE no of games.

Is there some sort of simulation that I can do? For example, can I somehow get a function f where I would feed in the bot's traits (ex : weapons, etc) and it would return the corresponding fitness values? Do open source FPS games provide such a library?

The other option would be to go into the source code of the game and then keep on simulating various scenarios and noting the score in each scenario. I would prefer not to have the added complexity of going into the source of the game, since this is a short(1 month) project.

Thanks
I blog here : http://lameness-prevails.com/
The information your GA is discovering is contained in a large number of played games; that is the search space, so there's really no short cut to actually executing the bot on many games. If there were some way to simulate the outcome, the result would only apply to the simulation, not the actual game playing.
--"I'm not at home right now, but" = lights on, but no ones home
Advertisement
The thing is, if I simulate by playing against the bot, the fitness value obtained would be very uncertain since a human player is playing against a bot. It would not be very standard, in some cases i might play well, in some cases i might now. Should i instead work on a game in which only a single player(the cpu) plays, so that the uncertainity because of the human goes away?
I blog here : http://lameness-prevails.com/
All the human is going to do is increase the number of generations you will need to hone in on a solution. Alternately, what will develop is a more vanilla strategy that will account for variations in behavior a little better. One solution is to include genes that take into account certain behavioral trends in the other player, but then your complexity goes way up.

Dave Mark - President and Lead Designer of Intrinsic Algorithm LLC
Professional consultant on game AI, mathematical modeling, simulation modeling
Co-founder and 10 year advisor of the GDC AI Summit
Author of the book, Behavioral Mathematics for Game AI
Blogs I write:
IA News - What's happening at IA | IA on AI - AI news and notes | Post-Play'em - Observations on AI of games I play

"Reducing the world to mathematical equations!"

Let the bot play against a mutated copy of itself. Let the looser be replaced by the winner's new child. Render with simple graphics once every second. Simplify physics so that only the important events are simulated. For example, skip dust particles but simulate deadly bullets with fast intersection. When I did evolution on my strategy game, it took 5 hours to balance the AI because some things could not be more simple. For fast evolution, try to start with a chess like game and add visual effects on top of it.
I would suggest a modification of Dawoodoz idea - have the bots in the population play against each other in your simulation. You could have each bot play against 10 other bots and average the scores, with scores being number of wins, time of survival - whatever works for you. Also, during the simulation I wouldn't render any graphics at all. Your simulation will have all the details necessary to determine the score and the graphics will just slow it down tremendously.

-Kirk

This topic is closed to new replies.

Advertisement