rrlog: Exporting replays as JSON

All things BZFlag - no [OT] here please
Post Reply
User avatar
allejo
Breaker of Builds
Breaker of Builds
Posts: 809
Joined: Sun Feb 17, 2008 10:01 pm
Location: /dev/null
Contact:

rrlog: Exporting replays as JSON

Post by allejo »

About a year ago I announced BZFlag Postgame and it's been pretty well-received :D I also announced that at the core of that project was the bzflag-networking.php library.

Another tool I built at the same time (but never shared it on the forums) was my PHP port of rrlog. The original rrlog tool is included in the BZFlag source code but isn't distributed as a binary; running it is also kinda weird as it doesn't really show you much useful information.

For my final project in a spatial statistics grad school class, I picked BZFlag to perform some spatial analysis. I used my rrlog port to translate a replay of a match into JSON and then I was able to perform an analysis using that JSON data.

Here's an example of player movement from a replay

Code: Select all

{
    "playerId": 0,
    "state": {
        "order": 19,
        "status": 1,
        "position": [
            207.28,
            -216.76,
            0
        ],
        "velocity": [
            -22.5,
            10.88,
            0
        ],
        "azimuth": 2.6910541722610244,
        "angularVelocity": 0,
        "physicsDriver": -1,
        "userSpeed": 0,
        "userAng_Vel": 0,
        "jumpJetsScale": 0,
        "sounds": 0
    },
    "packetType": "MsgPlayerUpdate",
    "timestamp": "2020-04-25T02:51:24+00:00"
}
And here's someone using /lagstats.

Code: Select all

{
    "playerFromId": 0,
    "playerToId": 253,
    "message": "\/lagstats",
    "packetType": "MsgMessage",
    "timestamp": "2020-04-25T02:51:26+00:00"
}
As an example, here are some images I was able to generate based on this data for my class. This work is gonna be coming to Postgame in the coming months!

Player Positions.png
(722.09 KiB) Not downloaded yet
Player Density.png
(412.1 KiB) Not downloaded yet

Github: https://github.com/allejo/rrlog
Downloads: https://github.com/allejo/rrlog/releases
User avatar
kierra
Lieutenant, Junior Grade
Lieutenant, Junior Grade
Posts: 4107
Joined: Wed Mar 23, 2005 1:02 am
Location: outer Slovenia
Contact:

Re: rrlog: Exporting replays as JSON

Post by kierra »

Love the BZFlag Postgame!
Allejo, all I can say is that you never cease to impress!
Thank you for your continued work for the project!
"Sometimes people try to expose what's wrong with you, because they can't handle what's right about you."
"Measure your words -- they determine the distance of your relationships"
"If serving is beneath you, leadership is beyond ypu."
User avatar
Sub[FR]
Private First Class
Private First Class
Posts: 22
Joined: Wed Jul 02, 2008 2:51 pm

Re: rrlog: Exporting replays as JSON

Post by Sub[FR] »

Wahou , very impressive!
User avatar
allejo
Breaker of Builds
Breaker of Builds
Posts: 809
Joined: Sun Feb 17, 2008 10:01 pm
Location: /dev/null
Contact:

Re: rrlog: Exporting replays as JSON

Post by allejo »

rrlog v0.1.3 now has support for embedding the world in a JSON structure in the exported file 🥳
Post Reply