FoG Machine Learning Prediction Project

Field of Glory II is a turn-based tactical game set during the Rise of Rome from 280 BC to 25 BC.
Post Reply
jomni
Sengoku Jidai
Sengoku Jidai
Posts: 1374
Joined: Thu Dec 03, 2009 1:20 am

FoG Machine Learning Prediction Project

Post by jomni » Wed Sep 18, 2019 3:56 am

Hi everyone. I am exploring the relationship of army composition and victory. I believe FoG2 battles are won and lost not entirely by tactical decisions. Army composition (appropriate to terrain and opponent) increases chances of success. So I would like to employ machine learning techniques to build a model that predicts success.

Machine learning is not AI by the way. These are just mathematical algorithms to derive patterns and predictions (linear regression is a basic method). I will be employing supervised learning so I need cases of victories and defeats as data sets.

I believe the game does not collect these data points by itself so I need help of the community in collecting. Battles can be vs human (any skill level) or AI (any difficulty). Only open battle.

Here’s what will be needed:

1. Player Army - would it be easier if everyone play the same army and opponent? You can report any game you have played but it would be faster if we can get a lot of data on one particular match up.
2. Opponent Army
3. Player Army Composition. Number of each unit fielded.
4. General Terrain type (woods, hills, open) - what is the best way convert this to something consistent?
5. Player Stance (defensive, offensive). Generally can be determined where the first melee clashes happen.
6. Terrain of first contact. This is the type of terrain where most of the battle line fist meet in melee.
7. Human or Computer Opponent
8. Battle Size - determines maximum of number per unit)
9. AI difficulty level - for those playing against computer.


Before setting up the google doc spreadsheet, I need comments on how to make items 4, 5, 6 clear for the contributor. If there is a preferred match up. And if there are any other relevant data points (modelling feature) to include.

For the devs, can there be logging features developed to make this sort of studies possible in the future? Not just the data points above. Can help in balancing, rules changes, AI opponent optimisation too.

rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 22199
Joined: Sun Dec 04, 2005 6:25 pm

Re: FoG Machine Learning Prediction Project

Post by rbodleyscott » Wed Sep 18, 2019 6:46 am

jomni wrote:
Wed Sep 18, 2019 3:56 am
For the devs, can there be logging features developed to make this sort of studies possible in the future? Not just the data points above. Can help in balancing, rules changes, AI opponent optimisation too.
First you would have to convince me that such a mechanistic analysis would actually have value.
Richard Bodley Scott

Image

jomni
Sengoku Jidai
Sengoku Jidai
Posts: 1374
Joined: Thu Dec 03, 2009 1:20 am

Re: FoG Machine Learning Prediction Project

Post by jomni » Wed Sep 18, 2019 9:13 am

rbodleyscott wrote:
Wed Sep 18, 2019 6:46 am
jomni wrote:
Wed Sep 18, 2019 3:56 am
For the devs, can there be logging features developed to make this sort of studies possible in the future? Not just the data points above. Can help in balancing, rules changes, AI opponent optimisation too.
First you would have to convince me that such a mechanistic analysis would actually have value.
Fair enough.

Based on the exercise above, if we are able to do a predictive model based on army composition, terrain, and general stance... the AI can run this algorithm to define general strategy. The AI is already capable enough for the tactical side.

Though it might be hard to implement because the trained predictive model is developed outside (uses python). And replicating the model in archon is not straight forward if we use advanced machine learning like decision trees, knn, svm, neural networks.

roguedjack
Senior Corporal - Ju 87G
Senior Corporal - Ju 87G
Posts: 78
Joined: Wed Oct 18, 2017 1:40 pm

Re: FoG Machine Learning Prediction Project

Post by roguedjack » Wed Sep 18, 2019 1:14 pm

This is interesting but wouldn't you need at least thousands and thousands of samples to train the model? I'm not sure the player base if large enough to provide enough samples. You'd be better served with automated offline/headless (no graphics, gui etc...) AI vs AI battles to generate samples but it would require massive changes to the engine and scripts.
"Rise Of AI" AI mod for Field Of Glory II

76mm
Major - Jagdpanther
Major - Jagdpanther
Posts: 1092
Joined: Tue Feb 09, 2010 12:08 pm

Re: FoG Machine Learning Prediction Project

Post by 76mm » Wed Sep 18, 2019 2:53 pm

jomni wrote:
Wed Sep 18, 2019 3:56 am
5. Player Stance (defensive, offensive). Generally can be determined where the first melee clashes happen.
6. Terrain of first contact. This is the type of terrain where most of the battle line fist meet in melee.
Interesting idea, but I would scratch the two factors above:
--In most of my games at least, I would be hard-pressed to say if I was attacker or defender...maybe I'm defending with my foot, and attacking with my horse, or vice versa, or attacking on the right but defending on the left, maybe both sides are attacking? Too confusing...

Similarly with the "terrain of first contact"--maybe part of the line is open, part on a hill, part in rough, maybe somebody pursued skirmishers, etc. Seems like which exact part experiences first contact is kind of irrelevant?

melm
Sergeant First Class - Elite Panzer IIIL
Sergeant First Class - Elite Panzer IIIL
Posts: 440
Joined: Sat Sep 29, 2012 9:07 pm

Re: FoG Machine Learning Prediction Project

Post by melm » Wed Sep 18, 2019 3:00 pm

It's very interesting to introduce computer-assist technique into game mechanism analysis. What I am worrying about is that not only the data quantity, as rouguejack mentioned, but also the data quality. I regard the match between human and AI has low data quality since human should always beat AI if both have the same amount deployment points. If we cast away Human vs AI data, then the rest becomes very limited. Even among them, the data should be divided into two groups, normal set and anomoly set. Because the players pool has a rank. From the top to the bottom, we assume that high-rank player beating low-rank player is normal, which goes to normal set, as rank(or we call it skill) may dominate any factors you are going to employ to train the model like army composition, terrain, battle size, etc. High-rank beaten by low-rank goes to anomoly set. In this way, the useful dataset shrinks more. In my opinion, the best way is to write script for automated match for both AI sides, which controls the skill level for both sides, and then run for at least 10000, which I don't think enough personally but considering the computing power we may have.

roguedjack
Senior Corporal - Ju 87G
Senior Corporal - Ju 87G
Posts: 78
Joined: Wed Oct 18, 2017 1:40 pm

Re: FoG Machine Learning Prediction Project

Post by roguedjack » Thu Sep 19, 2019 12:12 pm

I just remembered I know of a paper that might interest you : "TIGER: AN UNSUPERVISED MACHINE LEARNING TACTICAL INFERENCE GENERATOR" by David Ezra Sidran.
IIRC its a system that can analyze a battle map and classify it by comparing its tactical features to known historical battles. I guess the idea being that if you can match any random battle to a historical one, you can probably deduce the best strategy for this new battle.
There are possibly a number of ideas and algorithms in the paper that resemble what you want to do.
"Rise Of AI" AI mod for Field Of Glory II

jomni
Sengoku Jidai
Sengoku Jidai
Posts: 1374
Joined: Thu Dec 03, 2009 1:20 am

Re: FoG Machine Learning Prediction Project

Post by jomni » Thu Sep 26, 2019 5:12 am

Yeah I guess without the help of auto logging and AI vs AI play, it’s hard to get enough data to do the study even when getting community participation.

MarkShot
Senior Corporal - Ju 87G
Senior Corporal - Ju 87G
Posts: 79
Joined: Tue Dec 28, 2010 7:15 pm

Re: FoG Machine Learning Prediction Project

Post by MarkShot » Thu Sep 26, 2019 1:58 pm

Jomni,

I was going to tell you about this, but easier to read.

Traditional chess programming has been going on for about 30 years or so. You have basically 3 components:

(1) Open based on %s of all games ever played. (Table look up)
(2) Middle based on heuristic search and numerical rating of board positions (tweaked values) and transposition tables. (Recursive tree search)
(3) End based on pre-computed tables of perfect mates for remaining pieces on the board. (Table look up)

Google's neural net played something like 8 hours of games against itself and derived how to win without 500 years of human study or 30 years of human programming. It then proceeded to beat the highest ranked engine in existence.

But that isn't all. You should watch one of the games on YouTube with human grand master analysis. LC0 wasn't sacrificing pieces. It had the game won already. It was toying with Stockfish like a cat with a mouse before ripping it to shreds. The only time in my life I have ever been scared by hardware/software ... I concluded I share much with the Los Almos builders of the first A bombs; who loved their work, but built something horrible.

https://en.wikipedia.org/wiki/Leela_Chess_Zero

MarkShot
Senior Corporal - Ju 87G
Senior Corporal - Ju 87G
Posts: 79
Joined: Tue Dec 28, 2010 7:15 pm

Re: FoG Machine Learning Prediction Project

Post by MarkShot » Thu Sep 26, 2019 2:10 pm

My first reaction to the project was that you will destroy this game with your findings, but then I realized chess is still going strong despite the fact that my phone can beat Magnus Carlson (best player currently). {and chess engines have assisted in the analysis and enjoyment of the game for many}

1. e4 ?

MarkShot
Senior Corporal - Ju 87G
Senior Corporal - Ju 87G
Posts: 79
Joined: Tue Dec 28, 2010 7:15 pm

Re: FoG Machine Learning Prediction Project

Post by MarkShot » Sat Sep 28, 2019 6:03 am

One of the stats, I would have been interested in is how predictive is drawing first blood of a game win?

Post Reply

Return to “Field of Glory II”