Ranking
Original Post
[REL] Violence evolved: a script that uses a genetic algorithm to evolve openers
Hey,
I thought it would be interesting to see if a genetic algorithm would be capable of generating interesting new opening moves and here is the result. It works by generating 10 random moves, selecting the best of them and using these to generate the next 10 moves. All the settings are at the top of the file. I have only done some testing so if there are any bugs let me know. The best move is stored in best.txt and you can see what it looks like by running loadBest.lua. enjoy!
Attached Files
loadBest.lua (2.6 KB, 537 views)
openerGA.lua (7.3 KB, 465 views)
Great script


How about doing it twice.
An opener with two moves, and making it configurable. :o
Toriolympics - 2nd place | Fr_Death Leader |ORMO Member |
i wonder if this can be modified to "learn" someones fighting style, and beat them.

eg: it generates joint movements based on your actions, and if one configuration of movements doesnt work, if tries a new one, until it beats you. then it makes modifications off of that configuration to see if it can improve its score. repeat, and repeat, until you have an unbeatable AI
[ESSENCE]
this looks really cool. Im gonna check it out

how long did it take you to code this dude?

k i tested it and its cool but i dont get it... do i have to load every game? it only wants to do it once. one more thing... why does it way "round # indiv # fitness # every game? it is confusing me lol

PS: it wont hit uke... it keeps killing itself.
Last edited by darkdoom1; Mar 6, 2010 at 11:54 PM. Reason: TESTED :0
[SIGPIC][/SIGPIC]
Mammary Gland Holders of the Humanoid Lifeforms Commonly Known As, Homo Sapiens.
sorry, I really should have explained it a bit better. I wanted to see if this would work at all so I limited to one move against a static enemy. It was set up to work with classic mod in 250 frame matches. here is how the algorithm works:
(0) It starts by generating 10 random moves (aka individuals)
(1) it checks how good each move is (aka fitness value) by executing it
(2) The fitness value is: toribot_score - ukebot_score
(3) once all 10 individuals have had a turn it then takes the top 30% of the population
(4) These are then recombined using crossover(cutting in half, sticking back together) to make the next 10 individuals for the next round
(5) Some of the individuals are mutated just to keep things interesting
(6) goto (1)

this technique means that it could learn how to play any mod out there, so long as the fitness function is good enough (it doesn't understand disqualification... yet). I left it running over the weekend and it got pretty damn good, 151510 in damage in 1 hit, paste this in to best.txt if you want to see it (151510:4,3,1,2,3,2,3,2,2,1,2,3,2,3,3,3,3,2,3,3,1, 1,0). Compare that to the 20,000 I got from purely random search over last weekend.

So! The next step is to make one that does a combo, I hope to have it out this week. Also if anyone knows how to speed up the game (i've tried messing with reaction_time but with no success) because normally a GA works by evaluating 100's of moves per second, not one every 5 seconds, any help would be greatly appreciated!

Also all the settings described above are completely configurable, the variables are at the top of openerGA.lua and all of them have explanations beside them. If you have any more questions do not hesitate to ask me!
It would be nice if the move with the most dismembers would be in best.txt The best moves now are just hitting the head without dismember.

I saw a move with 3 DM and it wasn't saved in best.txt

Nice script
3rd Dan|Latvian|Baltic
A suggestion: you could add another variable, that checks whether it won or lost, and evaluate the moves based on it. As in, a move with low fitness but a "won" flag would rank higher than one with high fitness but a "lost" flag. That would teach it to deal with DQ, as in a high-damage move that makes it DQ would have lower chances to "survive" than a low-damage but winning one.
Last edited by Fatesight; Mar 8, 2010 at 06:58 PM.
Proud leader of [Renegade].