Jump to content

My old ReplayAnalyzer Tool


Recommended Posts

Hi,

back in 2009 I made a ReplayAnalyzertool with a friend.
Just found it (still looking for the sourcecode, i'll share should I find it again).

It features playerinfos(deck, apm etc. ), a replay browser, a basic replay function outside of skylords and the possibility to rename your replays (on buttonpress or automatically) from autosave to something that will be kept and includes maps/playername.

have fun:
http://torsten-lueders.de/replayanalyzer/skylords_replay_analyzer.zip 
( You will need a Java runtime for the tool and it still misses the maps and cards of "newest" Edition (Lost Units etc.) that will be displayed as unknown card. )

The falso also includes a command line tool (/parser) to get jsondata (orbs, played cards, winner, apm etc. ) from replays.
Used it on my webserver for a replay database and on a battleforge turney page to detect the winner(bfleague.com).
Works on Linux and Windows but you need a (v)server with commandline for it so you can install java and execute the command line.
Feel free to use it.

screen1.JPG

screen2.JPG

Edited by dreaddy
Link to post
Share on other sites

Uhh, that's really really cool. I was just thinking about creating a new replay website which automatically parses player names, map, orbs and winner from the file. On bfcards.info you had to manually put those information in.

How exactly does the parser work? How is the replay encoded?

Because I wouldn't want to use Java for the website, rather write my own. :)

Link to post
Share on other sites

I'm not really interested in the replay function, but the data gathering - especially PvP. If someone does this browser-based, please track map and deckcolour depending data. Else we don't have real data to work with for any numbers adjustment for balancing. We pretty much rely on player knowledge. :D

 

Thx for the tool ^^

Link to post
Share on other sites
13 hours ago, Kaldra said:

Uhh, that's really really cool. I was just thinking about creating a new replay website which automatically parses player names, map, orbs and winner from the file. On bfcards.info you had to manually put those information in.

How exactly does the parser work? How is the replay encoded?

Because I wouldn't want to use Java for the website, rather write my own. :)


About the parser:
call java -jar parsersender.jar test.pmv >> output.txt and you will get stuff like
"{
"cards":{
"1003":{"affinity":-1,"energy":100,"id":1003,"name":"{card:rv}","orbs":[1,1,0],"rarity":4,"type":2}
,"1004":{"affinity":-1,"energy":65,"id":1004,"name":"{card:rw}","orbs":[2,0],"rarity":1,"type":1}
,"1021":{"affinity":-1,"energy":70,"id":1021,"name":"{card:ai}","orbs":[4,4],"rarity":4,"type":1}" [...].

You can also call something like
$replayinfos = json_decode(exec("java -jar parsersender.jar test.pmv"));  in PHP

format:
Can't remember too much because it was 10 years ago.
But we viewed some replays in the hexeditor and were able to guess most things after a few hours and some coffee.
On the start there were basic mapinfos(mapname, difficulty...), followed by the players and their deck as cardids/upgradelevel/charges.
Search for your cardids in your replayfile( should be those https://auctions.backend.skylords.eu/api/cards/all as hex ) and you should be able to find the position of the decks.


Last things were the playercommands in order. Something like timestamp, playerid, action(attack, monument built, card played), x and y positions.
You can use them to detect the winner and the orbs played (but that can also be detected from the deck).
At some point it helps to view special replays like "playing Sunderer, leave game", "playing Sunderer, move it up, leave game".

Edited by dreaddy
Link to post
Share on other sites
5 hours ago, dreaddy said:


About the parser:
call java -jar parsersender.jar test.pmv >> output.txt and you will get stuff like
"{
"cards":{
"1003":{"affinity":-1,"energy":100,"id":1003,"name":"{card:rv}","orbs":[1,1,0],"rarity":4,"type":2}
,"1004":{"affinity":-1,"energy":65,"id":1004,"name":"{card:rw}","orbs":[2,0],"rarity":1,"type":1}
,"1021":{"affinity":-1,"energy":70,"id":1021,"name":"{card:ai}","orbs":[4,4],"rarity":4,"type":1}" [...].

You can also call something like
$replayinfos = json_decode(exec("java -jar parsersender.jar test.pmv"));  in PHP

format:
Can't remember too much because it was 10 years ago.
But we viewed some replays in the hexeditor and were able to guess most things after a few hours and some coffee.
On the start there were basic mapinfos(mapname, difficulty...), followed by the players and their deck as cardids/upgradelevel/charges.
Search for your cardids in your replayfile( should be those https://auctions.backend.skylords.eu/api/cards/all as hex ) and you should be able to find the position of the decks.


Last things were the playercommands in order. Something like timestamp, playerid, action(attack, monument built, card played), x and y positions.
You can use them to detect the winner and the orbs played (but that can also be detected from the deck).
At some point it helps to view special replays like "playing Sunderer, leave game", "playing Sunderer, move it up, leave game".

Regarding the format or specifically the cardId this doesn't hold true as those are different if you take a look at the api & compare it to the cardIds which are used in the parser e.g.:

api: cannon tower 700

parser: 51580

at least if i'm reading it correctly.

Link to post
Share on other sites
21 hours ago, Ultrakool said:

I was looking for this as well. Thank you! And @Kaldra I think there is still a demand for a replay website, similar to bfcards.info where you could upload replays for every map and state the colors etc

I'm currently trying to port it the Reader to C# and make it somewhat available for .Net & in reusable way. Even though I'm reading through the source of the parser some stuff does look weird at times.

On 1/19/2021 at 2:52 AM, dreaddy said:

Hi,

back in 2009 I made a ReplayAnalyzertool with a friend.
Just found it (still looking for the sourcecode, i'll share should I find it again).
 

If you can't find the source here are decompiled versions of the parser.
https://1drv.ms/u/s!AqD5CDsxk6MwluluQRoPtD67BrQYSQ?e=cD2rHz

Link to post
Share on other sites

you can extract the "real" cardid:
function sl_extractCardkey($filekey){
    return $filekey % 0x4240;
}

I found some Infos we made about the replayformat (->attachment) and I'm about half done with a PHP Library
I hope I will finish it this weekend and publish it afterwars.

format.txt

Link to post
Share on other sites
2 hours ago, dreaddy said:

you can extract the "real" cardid:
function sl_extractCardkey($filekey){
    return $filekey % 0x4240;
}

I found some Infos we made about the replayformat (->attachment) and I'm about half done with a PHP Library
I hope I will finish it this weekend and publish it afterwars.

format.txt 5.56 kB · 3 downloads

Do you know whether there are more "Actions", "Replay Keys" than which you listed?

Link to post
Share on other sites

Could you explain what exactly "Type.Fix" is as you use it rather often and I don't see it ever getting any data.

Nevermind apparently it's just plain useless and non existent in the files.

Edited by RaiNote
Link to post
Share on other sites
3 hours ago, RaiNote said:

Do you know whether there are more "Actions", "Replay Keys" than which you listed?

the actions after the header?
I think it covers most of them but there might be some new actions from the cards of the lost and amii expansions.
I slightly remember that I saw "unknown action" in the replayanalyzer actionlist a few times.
There are also some "UNKNOWN" Commands in the commandlist. SUB_BD_UNKNOWN_689 SUB_BD_UNKNOWN_686 SUB_BD_UNKNOWN_68A etc,

About type.fix:
I think it only assigns constants for increased readability.
result.put(ACTION_SUMMON, new Information[]{
            new Information("typ", Type.FIX, 0, null, "summon unit"),
            new Information("cast", Type.FIX, 0, null, true),
            new Information("card", Type.UNSIGNED, 2),
            new Information("cardx", Type.UNSIGNED, 2),
            new Information("who", Type.UNSIGNED, 4),
            new Information("byte", Type.UNSIGNED, 1),
            new Information("cardc", Type.UNSIGNED, 2),
            new Information("cardcx", Type.UNSIGNED, 2),
            new Information("charges", Type.INTEGER, 1),
            new Information("x", Type.REAL, 4),
            new Information("y", Type.REAL, 4),
            new Information("zero", Type.UNSIGNED, 4),
            new Information("#", Type.BYTES, -1)
        });

Edited by dreaddy
Link to post
Share on other sites
On 1/19/2021 at 10:21 AM, Ultrakool said:

I was looking for this as well. Thank you! And @Kaldra I think there is still a demand for a replay website, similar to bfcards.info where you could upload replays for every map and state the colors etc

yIjfYPf.png

You pinned it a couple months ago D:

I had somehow saved the tool over the years and was using it to rename replays en mass so thanks! 

Edited by Hirooo
Link to post
Share on other sites
14 hours ago, RaiNote said:

new Information("#", Type.BYTES, -1) any explaination regarding this because somehow it seems important yet irrelevant. The source isn't much of a help to understand what actually happens regarding that specific case.

No Idea ;). But I just finished my php port and didn't need anything like that. Maybe you can get the Infos from there. Und lets switch to that topic about that parser stuff.

 

Edited by dreaddy
Link to post
Share on other sites
  • 1 month later...

i just stumbled onto you'r replay analyser... i think it's quite cool. Is there the potential to get more data out of the replay? (like energy used, total energy lost from defeated units, total energy lost from defeated wells, total energy available etc). Are there even plans on extending the site?

 I do have coding experience in C, Java, a little C#, a little PHP, HTML, CSS (Bootstrap and plain), Javascript (Vue.js Library), and Microsoft SQL if you want any help ;)

 

Link to post
Share on other sites

I think I get almost everything out of the replaydata that I can. Some subevents are missing, ill fix that as soon as I have some time.
Energy used is something that can be calculated from the units, spells, obrs and wells played.

But for the other values the biggest problem is, there is no event when things get destroyed.
If a unit dies, a well is killed or someone has lost the game. So without simulating the whole game (which is ... unrealistic ;) ) there is no way to get that out of the replay.

And help is always appreciated, but I honestly think that I don't want to expand that kind of deprectated >10 year old Java Code myself ;).
I'll expand the php library and the page when I have the time. But at the moment I have some other things to do.
But feel free to download the code and improve it.
 

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Terms of Use