Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 08 Sep 2012
Offline Last Active Jun 09 2014 11:32 PM

#5089542 Using genetic algorithms to 'train' my AI

Posted by on 27 August 2013 - 10:55 AM

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...

#5088140 Using genetic algorithms to 'train' my AI

Posted by on 22 August 2013 - 11:24 AM

Yes, I let the winner from each generation pass to the next generation unaltered. Sometimes I see a 'freak' AI win a single game and in the next generation the winner looks more normal again. I'll soon publish the next part, it's written but I must proofread the text before I publish it.

#5083919 Using genetic algorithms to 'train' my AI

Posted by on 07 August 2013 - 12:12 PM

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! biggrin.png 

#5082209 Using genetic algorithms to 'train' my AI

Posted by on 01 August 2013 - 09:17 AM



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 had 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!

#5052498 AI in a turn based strategy game

Posted by on 12 April 2013 - 10:54 AM

The work on our AI for Rising Empires goes forward and today we release the 4th version. The articles on my blog do not contain much code snippets at the moment but if you're interested in my thoughts as the AI gets more and more complex head over to 'Words of the Netherlords':
Let me know if there is any specific part of the AI code that you want me to discuss in an article.
I hope you all have a good weekend! Cheers!

#5049213 AI in a turn based strategy game

Posted by on 02 April 2013 - 10:22 AM

It seems that the Rising Empires GUI is a little tough to get into. We should, of course, has anticipated this but better late than not at all. I've written a short tutorial over the buttons and things a player need to do in the first turn of playing Rising Empires. It can be found on our blog:
Later this evening we'll upload a new version of Rising Empires to Google Play. This is purely bug fixes to remove some of the most common bugs that has been detected.
I would also like say thank you to all of you who've tested Rising Empires.

#5047983 AI in a turn based strategy game

Posted by on 29 March 2013 - 08:04 AM

We've now uploaded the first beta build of Rising Empires on Google Play:



The AI is now halfway to it's fourth version and can do plenty of different actions. It has not been trained yet which mean that it has trouble selecting the best action every time (= it's quite dumb rolleyes.gif ). Anyway, if you are interesting of giving it a try we value all opinions about the AI and GUI and all else.



#5029999 AI in a turn based strategy game

Posted by on 08 February 2013 - 01:43 AM

Before christmas I told you I would write an article on my AI class and I finally got around to actually doing it yesterday. The article goes through the AI class but more importantly we take a closer look the AI.update method, the method that runs the AI process, and in which order all sub-AIs and advisors are processed.


This is important as, for example, the scout AI generates information that later is needed by other sub-AIs. The article can be found here:



I've also 'completed' how the AI attack other empires cities and towns and is now trying to make the AI able to react to attacks as well. If it sees an enemy army coming it must be able to rush some armies to defend it or in the worst case mount a counter attack to retake the city. This is fun to do but also rather complex. When a city is captured we must create a dedicated garrison army for it. Might sound easy but I must go back and change the code for how settlement AIs and the planner work with garrisons as the best choice it to split off a part of the conquest army to create the garrison, not create an objective with the task of building a new army and sending it to the captured city (which gonna take a long time).


I hope you'll have a good weekend!

#5023143 AI in a turn based strategy game

Posted by on 19 January 2013 - 04:02 AM

Time passes quickly around christmas but work continues on the Rising Empires AI and I'm proud to say that the first version is completed. I've run a number of simulations to test it's features and abilities and summarized it in this article: http://www.risingempires.com/netherlords/?p=430.


So far I've only been checking some global statistics when I've been running my simulations in order to see how it changes as I optimise the different sub-AIs performance. When I start to run simulations for the next version of the AI which will be capable of attacking and defending itself I'll need to check the performance of the individual AIs as well. Note that these simulations is done to test and optimise sub-AIs and I've yet to come to optimising the strategic AI. This will first be done when there is plenty of more actions that it can perform.

#5010531 AI in a turn based strategy game

Posted by on 14 December 2012 - 02:51 AM

I've now completed the article about the strategic AI. This is an utility-based AI with the capacity to perform multiple actions each turn, all depending on the available resources. We haven't implemented economy in its reasoning but when that's complete we'll have an AI that can control its empire with some sucess.

If you're interested you can read more and look at the code here:

I'm not sure what next article will be about. I'll probably take a look at the AI class and how it operates. I hope you all have a good weekend! Posted Image

#5003739 AI in a turn based strategy game

Posted by on 24 November 2012 - 07:29 AM

The work with the AI goes forward at a good pace. I've now completed the articles on the first version of the settlement AI. This is the AI that handles all cities and towns in an empire.

A general description of the settlement AI can be found here:
I then discuss how the settlements does to keep it's population well fed:
... and I ended today with a post on how we decide what buildings to construct:

Next I'll start writing about the strategic AI, the AI that (when completed) will handle all the major decisions in the empire...

#4997469 AI Architectures: A Culinary Guide (GDMag Article)

Posted by on 05 November 2012 - 01:13 AM

Great article! Thanks for sharing it. Posted Image

I thought that the AI system I'm working on is similar in its function to a behavior tree but it's actually an utility-based AI. My intention is to use genetic algorithms to train the AI to value each 'action'. It will be a while til I get that far though...

#4995331 AI in a turn based strategy game

Posted by on 30 October 2012 - 02:44 AM


We're doing some real progress on our AI for Rising Empires. In the last posts I've talked about the Scout AI sub-routine:

In the first post I talk about how I want it to work:
... and in the second post I discuss how we analyze different land masses:
... and in the third post I discuss the movement algorithm for scout armies:

To be honest I must say that designing an AI is very rewarding. As you step by step see how the computer are able to manage more things in an empire, how it actually do things as you intend it to do, it feels great. At the moment there isn't much to see as only scout armies move around on the map. But I'll try to see if I can make a movie of it and post it on the blog.



#4987970 AI in a turn based strategy game

Posted by on 08 October 2012 - 06:17 AM

I've now completed the overview of the AI. Part two can be found here:
... and part three:

It's a lot of text but I thought it would be important to define how the AI is supposed to work before I start writing code for it... Next installment will be a more detailed look on the Scout AI.


#4983131 AI in a turn based strategy game

Posted by on 24 September 2012 - 01:55 AM


My name is Peter Norberg and I've been working on a strategy game together with my brother since early 2011. Now that we are getting closer to launching the multi-player version we're starting to look at an AI for a single-player version. This is currently a side-project but I thought I would share our progress if anyone is interested. When I've searched for information about game AIs I've had lots of help from other sites and blogs (for example the blog by checkmarkgames also discussed here).

Anyway, I've only started by discussing our pathfinder:
... and an overview of the AI structure:

I'm new to this and hope to learn a lot with this project. Insights, ideas or thoughts are welcome!

Best regards,