• Create Account

We're offering banner ads on our site from just \$5!

### #ActualKnolanCross

Posted 26 July 2013 - 12:28 PM

There are a few algorithms to determine your actions, I believe the most simple one is the minimax (https://en.wikipedia.org/wiki/Minimax).

Here is my five minutes explanation to give you the main idea of the way it works (probably not really good, but there are thousands of great articles on the internet about it).

First must define an evaluation function that given an army, determines one score for each strategy, this is probably a hard and subjetive task and pretty likely you will need to put a lot of twinking on it. For instance of points you can check to determine the score of an strategy:

- you can check how well defended are the airfields, the shipping and the factories.

- In case of a direct conflict how many resources you will lost and compare it with enemy loses, you may also include some factor for resource aquisition (for instance, I will lose more resources, but I have a lot remaining, while my enemy has nearly none, so this is good for me) and rate of production (I will take 2 minutes to recreate the lost unities, my enemy will take 4, so this is good for me).

After you got this function, you run it for the possible strategies for your army, then you check the counter mesures your enemy would take and run the function to those, and so on. In the end you will have a decision tree (look at the wikipedia article, this forum won't let me post in svg format). Now you pick the best result when it is your turn, and the worst when it is your enemy's turn (hence minimax). In the end you will filter the path of the best strategy. Keep running this algorithm from time to time to assert if you should keep your plan.

This is one of multiple ways, I believe it is the most simple one, and a good one because it will make your logic more organized (as you just need to twink the evaluation function), otherwise you may end up in an if-else hell.

### #1KnolanCross

Posted 26 July 2013 - 12:26 PM

There are a few algorithms to determine your actions, I believe the most simple one is the minimax (https://en.wikipedia.org/wiki/Minimax).

In any case, you must probably define an evaluation function that given an army, determines one score for each strategy, this is probably a hard and subjetive task and pretty likely you will need to put a lot of twinking on it.

For instance of points you can check to determine the score of an strategy:

- you can check how well defended are the airfields, the shipping and the factories.

- In case of a direct conflict how many resources you will lost and compare it with enemy loses, you may also include some factor for resource aquisition (for instance, I will lose more resources, but I have a lot remaining, while my enemy has nearly none, so this is good for me) and rate of production (I will take 2 minutes to recreate the lost unities, my enemy will take 4, so this is good for me).

After you got this function, you run it for the possible strategies for your army, then you check the counter mesures your enemy may take and run the function to those, and so on. In the end you will have a decision tree (look at the wikipedia article, this forum won't let me post in svg format). Now you pick the best result when it is your turn, and the worst when it is your enemy's turn (hence minimax). In the end you will filter the path of the best strategy. Keep running this algorithm from time to time to assert if you should keep your plan.

This is one of multiple ways, I believe it is the most simple one, and a good one because it will make your logic more organized (as you just need to twink the evaluation function), otherwise you may end up in an if-else hell.

PARTNERS