Hello, I am interested in exporting data from replays from games I have played in Spring into an external program so that it can be parsed, analyzed and stored into a database.
I am a programmer, but I have no Lua experience, and I am wondering how I would go about coding something like this.
It is my intention on sending the data using sockets, as I would like it to be fairly fast, and the program that parses the data could potentially be run on another PC, is this possible with Spring's implementation of Lua?
What kind of information can I expect to extract? I would like to know things such as when/how/where a building/unit gets built, what players are playing, when they leave and the result of the game.
I additionally would like the ability to do this in real-time, so I could write programs that could guess certain things such as how long it takes for my opponent to upgrade to stronger AA, or if he doesn't build anti-nukes, how soon would he switch to T2, what units he gets owned by, what his favorite units are, etc.
I have a feeling that someone may of attempted to do something like this already, I would like to hear the experiences they had doing so.
I need suggestions on making a script
Moderator: Moderators
- BrainDamage
- Lobby Developer
- Posts: 1164
- Joined: 25 Sep 2006, 13:56
Re: I need suggestions on making a script
replays are a list of orders by the players, you can already extract the infos you want directly from the replay file itself without running spring at all.PhailQuail wrote:What kind of information can I expect to extract? I would like to know things such as when/how/where a building/unit gets built, what players are playing, when they leave and the result of the game.
I additionally would like the ability to do this in real-time, so I could write programs that could guess certain things such as how long it takes for my opponent to upgrade to stronger AA, or if he doesn't build anti-nukes, how soon would he switch to T2, what units he gets owned by, what his favorite units are, etc.
check demoanalyzer in the spring repository for a replay parser example.
Re: I need suggestions on making a script
ask Error323, he's been doing replay analysis IIRC.
-
- Posts: 35
- Joined: 17 Sep 2008, 15:54
Re: I need suggestions on making a script
I am interested in more than just the orders players give, call me lazy, but I just don't feel like re-implementing Spring's engine in it's entirety to find out what unit attacks which.
I intending on extracting this information while watching replays, since I would also be able to extract this information in real-time (although, understandably, less verbose than watching a replay).
I intending on extracting this information while watching replays, since I would also be able to extract this information in real-time (although, understandably, less verbose than watching a replay).
Re: I need suggestions on making a script
You may want to look at the statistics gadget in CA. As far as realtime, it's not too messy to build luasocket for spring and load it. More info or a dll for 78.2 if you want it.
-
- Posts: 35
- Joined: 17 Sep 2008, 15:54
Re: I need suggestions on making a script
Anything CA-dependent is fine, since that is all I play anyway.
Any further info would be greatly appreciated, as I have no experience with Lua or the inner workings of Spring.
I may consider releasing what I make to the community (open-source, ofc) if it gets to a point where I am happy with it.
Any further info would be greatly appreciated, as I have no experience with Lua or the inner workings of Spring.
I may consider releasing what I make to the community (open-source, ofc) if it gets to a point where I am happy with it.
Re: I need suggestions on making a script
Not dependent, as something for you to take code from.
http://evolutionrts.info/~lurker/stuff/ ... ketwoo.zip
http://evolutionrts.info/~lurker/stuff/ ... ketwoo.zip
-
- Posts: 35
- Joined: 17 Sep 2008, 15:54
Re: I need suggestions on making a script
I am having some trouble with the sockets library, the problems mainly involve me not knowing what I am doing.
The examples (if that's what they were) were only slightly helpful, at this stage, I have no idea on how to load the socket library.
I did manage to echo when units got damaged, etc, so I am making progress.
The examples (if that's what they were) were only slightly helpful, at this stage, I have no idea on how to load the socket library.
I did manage to echo when units got damaged, etc, so I am making progress.
Re: I need suggestions on making a script
require("socket") or something, unzipped into your spring folder
-
- Posts: 35
- Joined: 17 Sep 2008, 15:54
Re: I need suggestions on making a script
OK, I have made significant progress, but now I have run into issues with the UnitDamaged callin.
weaponID, attackerID, attackerDefID and attackerTeam are always nil, I am using a replay of a FFA CA game I played.UnitDamaged() --> "unitID, unitDefID, unitTeam, damage, paralyzer, weaponID, attackerID, attackerDefID, attackerTeam"