gw2-api / issues

14 stars 0 forks source link

WvW Matchup returning incorrect data #81

Open Nithanim opened 4 months ago

Nithanim commented 4 months ago

Current Behavior

The WvW matchups endpoint returns incorrect objectives data, most of the time. I am still not sure what data it returns. It seems to be old data but it could also be wrong data. The most obvious error is that objectives are owned by the wrong team/world. Next easy to check data point is last_flipped when something changes owner and has buff in game but the api returns that it is owned by the same team for like one hour.

But there are times where the data lines up perfectly. At some point there is a very obvious re-synchronization point where all (most?) wrong data is suddenly updated to the correct one.

To debug the issue visually, you can use a tool like https://wvwintel.com/#2204 and join WvW in game. Compare the colors of the objectives. There is a high chance of discrepancies right away. If not, re-check in like 15 to 30 min. (At the "re-synchronization" point, the its text-to-speech goes bonkers, be warned!)

I do not know how long this has been an issue. I started playing with the api at the beginning of the last alliance beta. I also do not know if it is an issue specific to matchups of world 2204 (which I think is highly unlikely).

Expected Behavior

The data of the WvW matchups endpoint https://api.guildwars2.com/v2/wvw/matches/2-2 should return objective data that represents the same state as shown in game.

Steps To Reproduce

  1. Open game and join WvW
  2. Open the same matchup in some kind of visualizer of the api (e.g. https://wvwintel.com/)
  3. Compare the ingame owners of the objectives to the ones of the visualizer
  4. (If identical, wait 15 to 30 min and re-check)
  5. See that the owners of the objectives (and other data) do not align.

Happening since

At least since start of week 2 of last alliance beta.

Anything else?

A nice AI generated the following bash script:

#!/bin/bash

most_recent_date=$(curl https://api.guildwars2.com/v2/wvw/matches/2-2 -s | jq -r '.maps[].objectives[].last_flipped // ""' | sort -r | head -n1)

current_date=$(date -u +"%Y-%m-%dT%H:%M:%SZ")

most_recent_date_sec=$(date -u -d "$most_recent_date" +"%s")
current_date_sec=$(date -u -d "$current_date" +"%s")

diff_sec=$((current_date_sec - most_recent_date_sec))

echo "$diff_sec seconds difference"
echo "$((diff_sec/86400)) days, $(((diff_sec%86400)/3600)) hours, $(((diff_sec%3600)/60)) minutes difference"

It loads the extracts the latest last_flipped and shows the difference to the current time. In the case I just witnessed, it resulted in:

$ bash diff.sh                                                                                                                       
3666 seconds difference
0 days, 1 hours, 1 minutes difference
$ bash diff.sh                                                                                                                       
3780 seconds difference
0 days, 1 hours, 3 minutes difference
$ bash diff.sh                                                                                                                       
3863 seconds difference
0 days, 1 hours, 4 minutes difference
$ bash diff.sh                                                                                                                       
25 seconds difference
0 days, 0 hours, 0 minutes difference

As you can see, at the last line was the re-synchronization and the text-to-speech of https://wvwintel.com/ went completely bonkers because multiple objects "flipped" at the same time. (Which of course is completely wrong because objectives were flipped all the time in this hour.)

Nithanim commented 4 months ago

Is there an update on this issue? Pretty much after I reported I did not notice any issues anymore (or course...). Granted, I have not played that much and did not check thoroughly. Since it is "confirmed" I can't have been extremely wrong on this? Thank you!

darthmaim commented 4 months ago

No, there is no update. Maybe you got lucky now to get up-to-date data. Maybe you were unlucky before and it's usually correct.

Anyway, this is something ArenaNet should look into. It was already known that the WvW data is sometimes out of sync with the game, so it's good that you took your time to write it down here so it can be tracked.

Nithanim commented 4 months ago

Thank you for your help and insight! It is just a very weird timing. If I read the time on my first post correctly, it was Friday night when I finally found this place to vent my frustration. I am not sure now if I had problems that time. At Saturday evening, I got correct data and also when I checked at Tuesday evening + night and yesterday night.

Not sure how WvW ist architectured behind the scenes but the Friday (WvW reset) is another weird coincidence. On the other hand, re-links and restarts (because of updates) seemed not to fix the problem since data went out-of-sync again after.

Nithanim commented 3 months ago

So this has not been a problem since. Last week I did not play so I can't say anything about that time. Right now though, I had it on green border again. And exactly right now it synchronized 2024-04-13T22:05:00+02:00

MikaMika commented 3 months ago

The freezing happens more frequently than you think. Here is some bash functions to help you record and track it:

frozen () {
    >&2 echo 'Select relevant match in a var (1-1 by default)'
    match="${1:-1-1}"
    >&2 echo 'Save matches.json from api'
    curl --silent "https://api.guildwars2.com/v2/wvw/matches?ids=all" > matches.json
    >&2 echo 'Search for relevant match id and 7 lines after-context'
    >&2 echo 'and save it into a relevant match directory'
    mkdir -p "$match" # make dir if it hasn't been created already
    grep --after-context 7 "$match" matches.json > "${match}/frozen.$(date +%s).txt"
    >&2 echo 'Compare last 2 files from relevant directory'
    find "$match" | sort | tail -n 2 | xargs diff --brief --report-identical-files
}

loopme () {
    interval=${1:-300}
    match=${2:-1-1}
    >&2 echo "Loop started for $match, interval $interval sec, to stop press Ctrl-C"
    while true
    do
        frozen "$match" 2>/dev/null
        sleep "$interval"
    done
}

If the files are identical, the scores hasn't changed and the match is frozen. You can either use frozen 2-2 every so often, or use a loop every 10s (or 5 min by default)

loopme 10 2-2

I am already recording matches.json every 5 minutes and made a script to check the last 12 hours: https://mikamika.top/is-my-match-frozen/last12h.txt X when the score was identical to the previous one, . when it got updated. It's on 🔥 for like 1 hour straight 50% of the time.

Nithanim commented 3 months ago

Oh, wow! Genius!

So basically I can give up trying to find an obvious pattern. Thanks!

For reference, the txt file currently looks like this:

 _id _________________10h_ago __________________8h_ago __________________6h_ago __________________4h_ago __________________2h_ago _____________________now ____% 
 1-1 ?.......XXXXXXXXXXX....X XXXXXXXXXX.............. .XXXXXXXXXX.....XXXXXXXX .........XXXXXXXX....XXX XXXXXXXX......XXXXXXXXXX X......XXXXXXXX.....XXXX (57%) 
 1-2 ?XXXXXX.XXXXXXXXXXXX.... .........XXXXXXXXXXX.... ...........XXXXXXXXX.... .XXXXXXXXXXXX........... .................XXXXXXX XXXX.....XXXXXXXXXX...XX (51%) 
 1-3 ?XXXXXXX...XXXXXXX...... ..XXXXXXXXXXX..XXXXXXXX. .........XXXXXXXXXXX.... ..XXXXXXX.........XXXXXX X..XXXXXXXX.........XXXX XXXXX....XXXXXXXXXX...XX (60%) 
 1-4 ?XXXXXXXXXXX..XXXXXXX... ........XXXXXXXXXXXX..XX XXXXXXX..XXXXXXX....XXXX XXXXX..XXXXXXXXXXXX..XXX XXXX.................... XXXXXXXXXXX...XXXXXXXXX. (65%) 
 2-1 ?..XXXXXXXXX..XXXXXXXX.. ........XXXXXXXXXXXX.... .........XXXXXXXX....XXX XXXXXXXX.....XXXXXXXXXX. ......XXXXXXX.......XXXX XXXXXXX.............XXXX (55%) 
 2-2 ?....................... ..XXXXXXXXXX..XXXXXXXXXX X...............XXXXXXXX X.XXXXXXXXX............. ......XXXXXXX........... ..........XXXXXXXXX....X (39%) 
 2-3 ?XXXXXXXX..............X XXXXXXXXXXX.XXXXXXXXXXX. ...........XXXXXXXXXX... ..................XXXXXX XXX..................... .XXXXXXXXXXXX........... (43%) 
 2-4 ?XXXXXX.......XXXXXXXXXX X..........XXXXXXXXX.... ...................XXXXX XXXXXX.................. ...........XXXXXXXXXXX.. XXXXXXXXXXXX...XXXXXXXXX (48%) 
 2-5 ?XXXXXXXXX..XXXXXXXXXXX. ........XXXXXXXX........ .....XXXXXXXXXX....XXXXX XXXX.....XXXXXXX........ ........XXXXXXXXXXXX.... ........XXXXXXXXXXXXX... (55%)