loldevs / libOL

Reference implementation for League of Legends spectator dump decoding. Basically abandoned.
MIT License
13 stars 3 forks source link

How to translate positions in movement group to Riot API map coordinates? #12

Open giratikanon opened 10 years ago

giratikanon commented 10 years ago

When I run bin/libOL_test on sample chunks, I see MovementGroups, but the X and Y values go from roughly -3500 to 3500. Example:

MovementGroup: {
    "timestamp": 1342,
    "updates": [{
        "entityId": 1073741854,
        "position": {
            "x": 3541,
            "y": 3524
        },
        "waypoints": [{
            "x": 3460,
            "y": 3275
        }]
    }]
}

This is a range of 7000 in each direction, or half of the X/Y range of about 15000 as defined in the Riot Games API game constants.

I understand that the chunk positions have a 0,0 in the map center, but I don't understand how to translate them to match the Riot Games API positions. Should I basically just multiply by 2 and add 7,000 (or so)?

sathorn6 commented 10 years ago

From the IntWars project:

#define MAP_WIDTH (13982 / 2)
#define MAP_HEIGHT (14446 / 2)
float x = ((request->x) - MAP_WIDTH)/2;
float y = ((request->y) - MAP_HEIGHT)/2;

So basically you are correct. However these values are not exactly the same as on the riot api, and i have no idea where they come from.