Training a neural network to predict results of setons games

Post here if you want to help developing something for FAF.

Training a neural network to predict results of setons games

Postby Memto » 15 May 2015, 14:13

I'd like to train a neural network that can predict the outcomes of seton's games. Our ranking system is already able to give generic predictions on any map, but it does not take into account the map or the spawn positions of the specific players. Since we have a large database of finished setons games that have been played, I believe it is possible to improve the accuracy. The neural network may turn out to be better than the generic algorithm we use, but of course we do not know this beforehand. Even if it is better, I'm not proposing that it should replace the algorithm that is currently in use or be added in any official capacity, Instead I would merely like to make it and see how the network performs. Also, I need to finish a project like this for a university course. :oops: I could satisfy them with a more boring project, but I'd like to make something potentially useful instead.

After training, the network can implemented without special knowledge by any programmer. The details will depend on the architecture I choose for the network. To give you an idea, one possible architecture would mean two matrix-vector multiplications and applying a certain non-linear function to each component of a vector. I could do the implementing myself if needed, I believe I'm decent programmer. At the moment though I have no experience in modding the game or how the client works, so this task might be easier for someone else.

After two paragraphs we finally come to my point: I need data to train the network. I could probably construct the query for the database myself, but I do not know its structure and I do not have access to it, so I need help from someone.

I quick introduction to neural networks for those who are unfamiliar with the subject:
Spoiler: show
A neural network is trained with a large number of examples that show what kind of response is expected from a given input. After the training, the network is also able to generalize based on the examples it has seen into new situations. Neural networks have successfully been used to get computers do tasks that are traditionally thought to be hard to program, but are relatively easy for humans. Examples include character recognition or classifying websites based on their content.
Memto
Crusader
 
Posts: 24
Joined: 02 Dec 2012, 14:47
Location: Finland, UTC+2
Has liked: 0 time
Been liked: 0 time
FAF User Name: M_Memto

Re: Training a neural network to predict results of setons g

Postby Resin_Smoker » 15 May 2015, 14:30

Would be cool to use such knowledge to build an AI that's a worthy opponent in both single and multiplayer matches.

Resin
Resin_Smoker
Evaluator
 
Posts: 858
Joined: 14 Mar 2012, 17:58
Has liked: 54 times
Been liked: 104 times

Re: Training a neural network to predict results of setons g

Postby ZLO_RD » 15 May 2015, 14:46

That is pretty fun idea... But if you just make 4 separated ratings for every player, back front beach and rock and add the importance of spot you will able to predict outcome without any AI...
Useing an AI for that is just sounds fun anyway...
I also like idea about AI that would just mimic real player gameplay and tatctis... Maybe it is possible to use that neure network for that...
http://www.youtube.com/user/dimatularus
http://www.twitch.tv/zlo_rd
TA4Life: "At the very least we are not slaves to the UI"
User avatar
ZLO_RD
Supreme Commander
 
Posts: 2209
Joined: 27 Oct 2011, 13:57
Location: Russia, Tula
Has liked: 295 times
Been liked: 380 times
FAF User Name: ZLO

Re: Training a neural network to predict results of setons g

Postby da_monstr » 15 May 2015, 15:27

Out of curiosity : are you using a custom application (if so, what language are you using) or are you using Matlab?
Peace through superior firepower.
[Total Biscuit, comparing FA to SupCom2] "The scale and the sublime nature of the economy was ruined with Supreme Commander 2, which I absolutely despised. Oh god, I hate that game so very much."
User avatar
da_monstr
Priest
 
Posts: 443
Joined: 19 Aug 2012, 16:37
Location: Slovenia
Has liked: 14 times
Been liked: 20 times
FAF User Name: Mainstay

Re: Training a neural network to predict results of setons g

Postby zeroAPM » 15 May 2015, 17:05

ZLO_RD wrote:That is pretty fun idea... But if you just make 4 separated ratings for every player, back front beach and rock and add the importance of spot ...


Front=1
Beach/Rock=5
Back=9.99E99

I suppose this is correct
zeroAPM
Priest
 
Posts: 452
Joined: 21 May 2014, 20:39
Has liked: 3 times
Been liked: 52 times
FAF User Name: Impressingbutton

Re: Training a neural network to predict results of setons g

Postby ckitching » 18 May 2015, 16:16

In case it's of interest to anyone else, here is the database dump:

https://www.dropbox.com/s/7wtqe7zgkui99 ... sv.gz?dl=0

Go forth and built neural networks and suchlike. Or something else. This represents a few years worth of game history.
User avatar
ckitching
Avatar-of-War
 
Posts: 229
Joined: 03 Jan 2015, 12:51
Has liked: 2 times
Been liked: 69 times
FAF User Name: ckitching

Re: Training a neural network to predict results of setons g

Postby Ionic » 18 May 2015, 18:50

What is the best way to read and sort this data? Where do you see all the players and their spots and where does it list who won?
Ionic
Avatar-of-War
 
Posts: 252
Joined: 25 Nov 2012, 20:00
Has liked: 14 times
Been liked: 14 times
FAF User Name: Ionic

Re: Training a neural network to predict results of setons g

Postby ckitching » 18 May 2015, 19:29

Oh, I do beg your pardon, I forgot to post the explanatory accompaniment:

http://sprunge.us/LPcc

The datafile dumped is the output of:
Code: Select all
SELECT
login.login as player,
b.game_type as game_type,
game_player_stats.faction,
game_player_stats.color,
game_player_stats.team,
game_player_stats.place,
game_player_stats.mean,
game_player_stats.deviation,
game_player_stats.after_mean,
game_player_stats.after_deviation,
game_player_stats.score,
game_player_stats.scoreTime,
b.start_time start_time,
b.end_time as end_time,
b.map_name as map_name,
b.map_file as map_file

FROM
    game_player_stats
INNER JOIN
    login
ON
    game_player_stats.playerId = login.id
INNER JOIN
    (
        SELECT
            game_stats.id,
            game_stats.mapId,
            game_stats.startTime start_time,
            game_stats.EndTime as end_time,
            game_stats.gameType as game_type,
            table_map.name as map_name,
            table_map.filename as map_file
        FROM
            game_stats
       INNER JOIN
            table_map
        ON
            table_map.id = game_stats.mapId
    ) as b
ON
    game_player_stats.gameId = b.id


The fields in the output are separated by tab characters. The records are separated by newlines. The first record is the column names.

This format would be suitable for import into prettymuch any database system you might have, and spreadsheet software will probably happily take it as well (if it weren't so enormous, anyway). If you only want a narrow portion of it I suggest you use `grep` or some similar tool to filter it down to a more manageable size before having your way with it.

If you care about game count, notice that that field is implicit in the data set and must be determined by counting records for each player in chronological order. Also note that datestamps are sometimes missing, because ZeP, so your should probably use ID numbers as Lamport clocks if you're going to try and reconstruct that.
User avatar
ckitching
Avatar-of-War
 
Posts: 229
Joined: 03 Jan 2015, 12:51
Has liked: 2 times
Been liked: 69 times
FAF User Name: ckitching

Re: Training a neural network to predict results of setons g

Postby ckitching » 18 May 2015, 20:12

Ah.

Sheeo just informed me I missed a spot.

And by "a spot" I mean "Everything before mid-2014".

There will be a brief interlude while the several GB I missed are extracted :P
User avatar
ckitching
Avatar-of-War
 
Posts: 229
Joined: 03 Jan 2015, 12:51
Has liked: 2 times
Been liked: 69 times
FAF User Name: ckitching

Re: Training a neural network to predict results of setons g

Postby ckitching » 18 May 2015, 20:40

Here is the complete dump (minus the most recent couple of months):
https://www.dropbox.com/s/mukkqlx15s8ll ... sv.gz?dl=0

Enjoy.
User avatar
ckitching
Avatar-of-War
 
Posts: 229
Joined: 03 Jan 2015, 12:51
Has liked: 2 times
Been liked: 69 times
FAF User Name: ckitching

Next

Return to Contributors

Who is online

Users browsing this forum: No registered users and 1 guest