Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (780)
Games in Android Showcase (233)
games submitted by our members
Games in WIP (856)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Using genetic algorithms to 'train' my AI  (Read 7415 times)
0 Members and 1 Guest are viewing this topic.
Offline Netherlords

Junior Devvie

Medals: 1

« Posted 2013-08-01 15:17:39 »

My name is Peter Norberg and I've previously written about my game AI in this thread: AI in a turn based strategy game. It's been a while since my last update and due to this I thought it would be best to start a new thread. But there's been a lot done on the AI and it's now quite developed and able to do most of the needed actions as well as simple diplomacy.
Now I've just started to see if I can 'train' the AI by using genetic algorithms. I'm not sure if this will be a success or not. At my blog, Words from the Netherlords, I've described how I intend to do it and my intention is to write down my conclusions when I'm finished with it, good or bad...
Rising Empires uses an utility-based AI which depending on the sitiuation and its free resources can make multiple decisions each turn.
All thoughts on the subject are welcome!

'Words from the Netherlords' - News and updates about Rising Empires…
Offline zngga
« Reply #1 - Posted 2013-08-01 18:16:05 »

Once you have a system that can develop good AI's you can incorporate it into the game, have the AI learn with the Player and become better at defeating / defending against the Player as the game goes on.

My code never has bugs... it just develops unexpected features!
Offline Netherlords

Junior Devvie

Medals: 1

« Reply #2 - Posted 2013-08-07 18:10:11 »

The first results and comments on my trials have now been added to the blog. I've tried to improve the Human and Greenskin races and at least the Greenskins show some promising improvements. I intend to fine tune my algorithms a bit (I hope I remember to add the code in my next update) and try two of the other races as well.
This is very fun! Smiley

'Words from the Netherlords' - News and updates about Rising Empires…
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline wessles
« Reply #3 - Posted 2013-08-08 01:34:04 »

Crap, this is gold. I probably will try a bit of my own spin of it. I didn't have time to read the entire blog post, but the idea itself brought this to my head (aka, Idk if this is what you already did). You make the game, and have people play it. You make the enemy ai start with 2 actions. Attacking, and defending. They attack, and see how much damage occurred. The first time will be the baseline. That will be what they remember, and compare all other attacks to. Anyways, after that, they take damage while defending. Again, that will be a baseline. After that initial data, they will shake stuff up every generation. Like maybe spin before they attack, or whatever. But, here is the catch. If they die in a battle, and did not pass on their skill to the next generation, that skill will be lost. Similar to 'Survival of the fittest.' So, after about 40 generations, they will get more and more advanced in their attacks, and defenses. And the other catch, is once their current stats are 150% of the original data, they will be a new species, and that bar where it is a new species rises in that species. So the first division of species will be set at 150%. Next, 200%. Until it gets to the maximum attack range.

Thanks for giving me the idea! I might try this myself, but my hands are kind of full at the moment.
Keep up the good work! Grin
Offline Netherlords

Junior Devvie

Medals: 1

« Reply #4 - Posted 2013-08-27 16:57:41 »

Thanks wesley.laferriere. Remember that you need to randomly test new skills and in what order to use them for the AI to develop. It might be that the spin before the attack won't be effective and then it won't be used, but it might also be that the spin is only effective in combination with another special attack and for that to evolve you must mutate randomly, i.e. test new crazy stuff. Most times it won't be anything good but once in a while a new interesting attack will evolve.

I've completed the third part of my tests to see if I can improve my AI with the help of genetic algorithms. If you're interested it can (as usual) be found at my blog. Training the Elf and Ende races didn't give as good results as did the Greenskins...

'Words from the Netherlords' - News and updates about Rising Empires…
Offline EmanP

Junior Devvie

Projects: 2
Exp: 3 years

Satisfaction never guaranteed.

« Reply #5 - Posted 2013-10-02 20:36:56 »

Be careful with this adaptive AI, if it's not flexible enough, it may find a suitable method that becomes repetitive to the player over time!
Try to keep the player from taking advantage of it, you don't want the player to lose several times so the AI loses it's good strategies so that the player can have an easy epic win to upload to youtube and brag.
Also if you decide to have the AI save results, make sure it doesn't take a chunk of memory.

And be aware that having an adaptive AI means that players may have to become extremely adaptive, or may just brute-force their moves from a lack of it's understanding- You can help this by using 'inequalities', choices that cannot be compared to each other, e.g. apple + orange.

Signed- EmanP
Pages: [1]
  ignore  |  Print  

hadezbladez (703 views)
2018-11-16 13:46:03

hadezbladez (347 views)
2018-11-16 13:41:33

hadezbladez (688 views)
2018-11-16 13:35:35

hadezbladez (171 views)
2018-11-16 13:32:03

EgonOlsen (2362 views)
2018-06-10 19:43:48

EgonOlsen (2474 views)
2018-06-10 19:43:44

EgonOlsen (1463 views)
2018-06-10 19:43:20

DesertCoockie (2128 views)
2018-05-13 18:23:11

nelsongames (1904 views)
2018-04-24 18:15:36

nelsongames (2572 views)
2018-04-24 18:14:32
Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08

Deployment and Packaging
by gouessej
2018-08-22 08:03:45

Deployment and Packaging
by philfrei
2018-08-20 02:33:38

Deployment and Packaging
by philfrei
2018-08-20 02:29:55

Deployment and Packaging
by philfrei
2018-08-19 23:56:20

Deployment and Packaging
by philfrei
2018-08-19 23:54:46 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!