How to get data out of the game?

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

How to get data out of the game?

Postby nine2 » 09 Dec 2014, 13:08

I want to write a mod that writes game data out somehow. I don't really care how it is done but just want to know how to do it.

I actually want this for fifty reasons but for example - I want to write out number of engies for each team every second. Later I will write an app to process this data.

At the moment I am doing this by writing to the log file but it's pretty bad. I wonder if I could write a gpgnet proxy and just pass all the information backwards and forwards and then sneak in some extra messages from the game that are just for me (and dont get forwarded to real server).

I would love to
- be able to write to a my own file on the disc
- send some data to a my own url
- anything that is more cleaner and faster than writing to log file

Any ideas?

Thank you!
nine2
Councillor - Promotion
 
Posts: 2416
Joined: 16 Apr 2013, 10:10
Has liked: 285 times
Been liked: 515 times
FAF User Name: Anihilnine

Re: How to get data out of the game?

Postby Sheeo » 09 Dec 2014, 13:39

partytime wrote:I want to write a mod that writes game data out somehow. I don't really care how it is done but just want to know how to do it.

I actually want this for fifty reasons but for example - I want to write out number of engies for each team every second. Later I will write an app to process this data.

At the moment I am doing this by writing to the log file but it's pretty bad. I wonder if I could write a gpgnet proxy and just pass all the information backwards and forwards and then sneak in some extra messages from the game that are just for me (and dont get forwarded to real server).

I would love to
- be able to write to a my own file on the disc
- send some data to a my own url
- anything that is more cleaner and faster than writing to log file

Any ideas?

Thank you!


To get the stuff out of the game you either need to write to the log as you're doing (But it's slow), use the gpgnetsend function calls or use the replay. I haven't done much with this myself yet, but since we'd like to get more stats from games anyway, I think it'd be nice to put this in the replay, given that these stats are ones we can use generally anyway.

You can put arbitrary data in the replay using simcallbacks. These are defined in this file: https://github.com/FAForever/fa/blob/de ... lbacks.lua.
Support FAF on patreon: https://www.patreon.com/faf?ty=h

Peek at our continued development on github: https://github.com/FAForever
Sheeo
Councillor - Administrative
 
Posts: 1038
Joined: 17 Dec 2013, 18:57
Has liked: 109 times
Been liked: 233 times
FAF User Name: Sheeo

Re: How to get data out of the game?

Postby nine2 » 09 Dec 2014, 13:44

When I view someone elses replay (who didnt use my mod), but I load it with my mod (via my own init file) I can still write to log file.

However simcallbacks wouldn't do anything for me in that scenario (the replay has already been written).

And I'm not sure would gpgnetsend work when viewing a replay?

Thanks for your time
nine2
Councillor - Promotion
 
Posts: 2416
Joined: 16 Apr 2013, 10:10
Has liked: 285 times
Been liked: 515 times
FAF User Name: Anihilnine

Re: How to get data out of the game?

Postby Sheeo » 09 Dec 2014, 14:10

partytime wrote:When I view someone elses replay (who didnt use my mod), but I load it with my mod (via my own init file) I can still write to log file.

However simcallbacks wouldn't do anything for me in that scenario (the replay has already been written).

And I'm not sure would gpgnetsend work when viewing a replay?

Thanks for your time


I think it's possible to keep the lobby connection alive during a game, so gpgnetsend would work. But you're right, steps would need to be taken to ensure it doesn't die.

Watching a replay is just like playing a game, except that commands are issue from a special replay commandsource. You can write the replay you get from watching a replay, and then your simcallbacks would appear :)
Support FAF on patreon: https://www.patreon.com/faf?ty=h

Peek at our continued development on github: https://github.com/FAForever
Sheeo
Councillor - Administrative
 
Posts: 1038
Joined: 17 Dec 2013, 18:57
Has liked: 109 times
Been liked: 233 times
FAF User Name: Sheeo

Re: How to get data out of the game?

Postby Domino » 19 Feb 2015, 23:10

Hey,

use the miniserver zep made?

i have a copy here that i have modified if you want the server i can send you link..

it lets me write my editor direct into a file, it can be tailored to write anything in any format, its a pyphon server.

Dave
Domino
Priest
 
Posts: 315
Joined: 14 Mar 2012, 21:07
Has liked: 3 times
Been liked: 75 times

Re: How to get data out of the game?

Postby nine2 » 20 Feb 2015, 03:15

Thanks Domino,

Could you explain how it works?

How do you send data to it?
nine2
Councillor - Promotion
 
Posts: 2416
Joined: 16 Apr 2013, 10:10
Has liked: 285 times
Been liked: 515 times
FAF User Name: Anihilnine

Re: How to get data out of the game?

Postby Domino » 20 Feb 2015, 03:29

partytime wrote:Thanks Domino,

Could you explain how it works?

How do you send data to it?


its quite simple really, you simply use


Code: Select all
GpgNetSend(functionName, data, data, data, whatever, table )


because its using python, the actual function is on the server and it can do whatever you want it to do.

for instance if i use:

Code: Select all
GpgNetSend("WriteSaveData", ScenarioId, FormatData.GetFormattedData( saveData ) )


i format it on the server to write this to a file exactly like this. (which is how i need and want it)

http://pastebin.com/7wrQLUW8

Dave
Domino
Priest
 
Posts: 315
Joined: 14 Mar 2012, 21:07
Has liked: 3 times
Been liked: 75 times

Re: How to get data out of the game?

Postby nine2 » 20 Feb 2015, 03:47

Hmmm sounds interesting. And then I guess you need to launch with the /gpgnet command line arg?

Well that sounds like a nice way to do it, may I have the link to the miniserver please?

I had thought about doing this but thought I would have to replicate too many 'real' server functions
nine2
Councillor - Promotion
 
Posts: 2416
Joined: 16 Apr 2013, 10:10
Has liked: 285 times
Been liked: 515 times
FAF User Name: Anihilnine

Re: How to get data out of the game?

Postby zeroAPM » 26 Feb 2015, 20:01

Can this program be used to analyze replays and categorize them?

This would be useful if one wanted to look for replays where certain stuff happened (eg, filter all games featuring Aeon, filter all games that had UEF T3 Static artillery, filter all replays featuring Rambo SACUs, filter replays featuring Telemazor Cybran ACU and so on).

This would make things quite easier when it comes to analyze replays, though it would be necessary to change the Replay manager, not to mention the large amount of processor time required in order to analyze all replays already in the vault
zeroAPM
Priest
 
Posts: 452
Joined: 21 May 2014, 20:39
Has liked: 3 times
Been liked: 52 times
FAF User Name: Impressingbutton

Re: How to get data out of the game?

Postby nine2 » 27 Feb 2015, 03:47

It is technologically possible, but not practical to do what you describe. There are 4500 replays made a night and no way we can analyze them all ... unless someone has a farm of 20x computers that we can use and 20x FA licenses.

Perhaps though wheneve anyone manually analyzed a game, the special stats could be uploaded to a common server that everyone could search through.

Really though, Sheeo has ideas about putting what you describe into the main game anyway. Basically when the game finishes it would upload stats like how many of each unit were built.
nine2
Councillor - Promotion
 
Posts: 2416
Joined: 16 Apr 2013, 10:10
Has liked: 285 times
Been liked: 515 times
FAF User Name: Anihilnine

Next

Return to Contributors

Who is online

Users browsing this forum: No registered users and 1 guest