Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WarAPI malfunctions during server restarts #92

Open
Kastow opened this issue Oct 11, 2021 · 13 comments
Open

WarAPI malfunctions during server restarts #92

Kastow opened this issue Oct 11, 2021 · 13 comments
Labels
API Issue Something seems wrong with the API

Comments

@Kastow
Copy link

Kastow commented Oct 11, 2021

Below is the output of dynamic data for Fisherman's Row at 14:18 GMT on October 11 2021.
It only outputs several types of objects, and those that it outputs, it does with teamId NONE. This issue occurs every day on most of the region servers, and it greatly hinders the systems that have an event log by producing a spam of false events.

{
  "regionId" : 15,
  "scorchedVictoryTowns" : 0,
  "mapItems" : [ {
    "teamId" : "NONE",
    "iconType" : 39,
    "x" : 0.50532764,
    "y" : 0.5625495,
    "flags" : 0
  }, {
    "teamId" : "NONE",
    "iconType" : 39,
    "x" : 0.6778407,
    "y" : 0.38638747,
    "flags" : 0
  }, {
    "teamId" : "NONE",
    "iconType" : 11,
    "x" : 0.39679545,
    "y" : 0.29804406,
    "flags" : 0
  }, {
    "teamId" : "NONE",
    "iconType" : 34,
    "x" : 0.6866246,
    "y" : 0.3947453,
    "flags" : 0
  }, {
    "teamId" : "NONE",
    "iconType" : 33,
    "x" : 0.7584116,
    "y" : 0.5286025,
    "flags" : 0
  }, {
    "teamId" : "NONE",
    "iconType" : 33,
    "x" : 0.36748582,
    "y" : 0.25986293,
    "flags" : 0
  }, {
    "teamId" : "NONE",
    "iconType" : 18,
    "x" : 0.53586024,
    "y" : 0.58132774,
    "flags" : 0
  }, {
    "teamId" : "NONE",
    "iconType" : 18,
    "x" : 0.4014841,
    "y" : 0.21975125,
    "flags" : 0
  }, {
    "teamId" : "NONE",
    "iconType" : 18,
    "x" : 0.7520729,
    "y" : 0.44829163,
    "flags" : 0
  }, {
    "teamId" : "NONE",
    "iconType" : 18,
    "x" : 0.6911762,
    "y" : 0.33260387,
    "flags" : 0
  }, {
    "teamId" : "NONE",
    "iconType" : 18,
    "x" : 0.7453215,
    "y" : 0.39947712,
    "flags" : 0
  }, {
    "teamId" : "NONE",
    "iconType" : 52,
    "x" : 0.55129033,
    "y" : 0.5582539,
    "flags" : 0
  }, {
    "teamId" : "NONE",
    "iconType" : 53,
    "x" : 0.5295013,
    "y" : 0.54276603,
    "flags" : 0
  }, {
    "teamId" : "NONE",
    "iconType" : 56,
    "x" : 0.38916466,
    "y" : 0.30496997,
    "flags" : 8
  }, {
    "teamId" : "NONE",
    "iconType" : 56,
    "x" : 0.7848051,
    "y" : 0.5246711,
    "flags" : 8
  }, {
    "teamId" : "NONE",
    "iconType" : 56,
    "x" : 0.7001385,
    "y" : 0.3840753,
    "flags" : 8
  }, {
    "teamId" : "NONE",
    "iconType" : 56,
    "x" : 0.4635182,
    "y" : 0.5267577,
    "flags" : 8
  }, {
    "teamId" : "NONE",
    "iconType" : 56,
    "x" : 0.39192638,
    "y" : 0.7305457,
    "flags" : 8
  } ],
  "mapTextItems" : [ ],
  "lastUpdated" : 1633961805874,
  "version" : 1
}
@hayden-t
Copy link

thank you kastow

@philipdiehl1 philipdiehl1 added the API Issue Something seems wrong with the API label Oct 12, 2021
@Yin117
Copy link

Yin117 commented Dec 24, 2021

Looking at the data shared by Kastow, I suggest two ways developers can assert that the data is "ok":

Solution 1)

Since all the mapItems return with "teamId" : "NONE" then simply check for the existance of anything else; so !!mapItems.find(({ teamId }) => teamId !== 'NONE') if this finds an item, then the data is ok (!! to turn to boolean).

Issue: In the unlikly event the factions result in turning every structure in a region 'white' then this will cause a false-positive.

Solution 2 now no longer applicable, see later comment.

Solution 2)

The data shared appears to lack even one instance of a 'Resource Node', it only contains one or more instance of the following:

  • Construction Yard
  • Hospital
  • Factory
  • Storage Depot
  • Shipyard
  • Seaport
  • CoastalGun
  • Town Base 1

Therefore, one could also do an assertion on if any of iconType exists, for the different resource structures (since every map reliably has atleast one of them):

  • 20: Salvage Field
  • 21: Component Field
  • 23: Sulfur Field
  • 32: Salvage Mine
  • 30: Component Mine
  • 38: Sulfur Mine
  • 41: Oil Well

So: !!mapItems.find(({ iconType }) => [20, 21, 23, 30, 32, 38, 41].includes(iconType))

@hayden-t
Copy link

I also think there is a problem with etag, as it seems when this junk/partial data is published the etag is incremented but then when the full correct data is published the etag is not incremented so it takes big delay with empty region data before a new etag is published, eg town lost/taken before that regions data is visible again, ie correct data replaces bad data because update is acknowledged and retrieved due to different etag

@Yin117
Copy link

Yin117 commented Feb 2, 2022

Solution 2 I orignally shared now no longer works, a Server Restart today contained a record for a Salvage Field (ID 20) so Solution 1 is the best bet; if all mapItems are 'NONE' for 'teamId'.

{
    "mapName": "MooringCountyHex",
    "regionId": 7,
    "scorchedVictoryTowns": 0,
    "mapItems": [{
            "teamId": "NONE",
            "iconType": 20, // Salvage Field
            "x": 0.40027395,
            "y": 0.12866499,
            "flags": 0
        }, {
            "teamId": "NONE",
            "iconType": 33, // Storage Depot
            "x": 0.7069431,
            "y": 0.61079615,
            "flags": 0
        }, {
            "teamId": "NONE",
            "iconType": 56, // Town Hall
            "x": 0.25232536,
            "y": 0.7418483,
            "flags": 8
        }, {
            "teamId": "NONE",
            "iconType": 56, // Town Hall
            "x": 0.47621775,
            "y": 0.49626058,
            "flags": 8
        }, {
            "teamId": "NONE",
            "iconType": 56, // Town Hall
            "x": 0.58230406,
            "y": 0.8069701,
            "flags": 8
        }, {
            "teamId": "NONE",
            "iconType": 56, // Town Hall
            "x": 0.7269787,
            "y": 0.6069284,
            "flags": 8
        }
    ]
}

@Yin117
Copy link

Yin117 commented May 24, 2022

It appears yet again, this can still break, where a Keep disappeared yet other structures such as Safe Houses and Storm Cannons remained, it seems there might not be an elegant -occurance solution to this problem, I will need to have a think on this.

{
  "statusCode": 200,
  "statusMessage": "OK",
  "body": {
    "regionId": 23,
    "scorchedVictoryTowns": 0,
    "mapItems": [
      {
        "teamId": "NONE",
        "iconType": 21,
        "x": 0.7032851,
        "y": 0.5030811,
        "flags": 0
      },
      {
        "teamId": "NONE",
        "iconType": 20,
        "x": 0.6152843,
        "y": 0.650545,
        "flags": 0
      },
      {
        "teamId": "NONE",
        "iconType": 20,
        "x": 0.4108844,
        "y": 0.5227383,
        "flags": 0
      },
      {
        "teamId": "NONE",
        "iconType": 20,
        "x": 0.4836215,
        "y": 0.3893222,
        "flags": 0
      },
      {
        "teamId": "NONE",
        "iconType": 20,
        "x": 0.3335382,
        "y": 0.23872396,
        "flags": 0
      },
      {
        "teamId": "NONE",
        "iconType": 40,
        "x": 0.6361567,
        "y": 0.7944353,
        "flags": 0
      },
      {
        "teamId": "NONE",
        "iconType": 40,
        "x": 0.6434175,
        "y": 0.7992877,
        "flags": 0
      },
      {
        "teamId": "NONE",
        "iconType": 41,
        "x": 0.7730739,
        "y": 0.53316474,
        "flags": 0
      },
      {
        "teamId": "NONE",
        "iconType": 41,
        "x": 0.77731854,
        "y": 0.52377045,
        "flags": 0
      },
      {
        "teamId": "NONE",
        "iconType": 41,
        "x": 0.63792866,
        "y": 0.13176328,
        "flags": 0
      },
      {
        "teamId": "NONE",
        "iconType": 41,
        "x": 0.571578,
        "y": 0.46689495,
        "flags": 0
      },
      {
        "teamId": "NONE",
        "iconType": 38,
        "x": 0.36002526,
        "y": 0.72508705,
        "flags": 0
      },
      {
        "teamId": "NONE",
        "iconType": 38,
        "x": 0.5650656,
        "y": 0.45490628,
        "flags": 0
      },
      {
        "teamId": "NONE",
        "iconType": 38,
        "x": 0.39856812,
        "y": 0.23455893,
        "flags": 0
      },
      {
        "teamId": "COLONIALS",
        "iconType": 39,
        "x": 0.5644424,
        "y": 0.58112377,
        "flags": 0
      },
      {
        "teamId": "COLONIALS",
        "iconType": 59,
        "x": 0.82182956,
        "y": 0.4969682,
        "flags": 0
      },
      {
        "teamId": "COLONIALS",
        "iconType": 59,
        "x": 0.81452525,
        "y": 0.5095244,
        "flags": 0
      },
      {
        "teamId": "COLONIALS",
        "iconType": 59,
        "x": 0.8036433,
        "y": 0.5055502,
        "flags": 0
      },
      {
        "teamId": "COLONIALS",
        "iconType": 59,
        "x": 0.5514574,
        "y": 0.55148053,
        "flags": 0
      },
      {
        "teamId": "COLONIALS",
        "iconType": 59,
        "x": 0.60176337,
        "y": 0.5426171,
        "flags": 0
      },
      {
        "teamId": "COLONIALS",
        "iconType": 59,
        "x": 0.51684296,
        "y": 0.49937055,
        "flags": 0
      },
      {
        "teamId": "COLONIALS",
        "iconType": 34,
        "x": 0.548507,
        "y": 0.56823903,
        "flags": 0
      },
      {
        "teamId": "WARDENS",
        "iconType": 33,
        "x": 0.4383599,
        "y": 0.21235,
        "flags": 0
      },
      {
        "teamId": "COLONIALS",
        "iconType": 35,
        "x": 0.5737536,
        "y": 0.5096398,
        "flags": 0
      },
      {
        "teamId": "COLONIALS",
        "iconType": 35,
        "x": 0.80386156,
        "y": 0.60538495,
        "flags": 0
      },
      {
        "teamId": "COLONIALS",
        "iconType": 35,
        "x": 0.5182901,
        "y": 0.5974323,
        "flags": 0
      },
      {
        "teamId": "COLONIALS",
        "iconType": 52,
        "x": 0.55002874,
        "y": 0.60511833,
        "flags": 0
      },
      {
        "teamId": "COLONIALS",
        "iconType": 53,
        "x": 0.5349655,
        "y": 0.5896058,
        "flags": 0
      },
      {
        "teamId": "COLONIALS",
        "iconType": 56,
        "x": 0.3710288,
        "y": 0.70452744,
        "flags": 8
      },
      {
        "teamId": "WARDENS",
        "iconType": 57,
        "x": 0.63115776,
        "y": 0.16847809,
        "flags": 8
      },
      {
        "teamId": "COLONIALS",
        "iconType": 58,
        "x": 0.80662173,
        "y": 0.5581778,
        "flags": 8
      },
      {
        "teamId": "COLONIALS",
        "iconType": 56,
        "x": 0.6334101,
        "y": 0.8071055,
        "flags": 8
      },
      {
        "teamId": "COLONIALS",
        "iconType": 58,
        "x": 0.54355395,
        "y": 0.52821034,
        "flags": 41
      },
      {
        "teamId": "WARDENS",
        "iconType": 57,
        "x": 0.42027625,
        "y": 0.20828061,
        "flags": 8
      },
      {
        "teamId": "WARDENS",
        "iconType": 45,
        "x": 0.6668634,
        "y": 0.3026566,
        "flags": 8
      },
      {
        "teamId": "WARDENS",
        "iconType": 46,
        "x": 0.33172438,
        "y": 0.295017,
        "flags": 8
      },
      {
        "teamId": "WARDENS",
        "iconType": 46,
        "x": 0.23364201,
        "y": 0.516728,
        "flags": 8
      },
      {
        "teamId": "COLONIALS",
        "iconType": 47,
        "x": 0.47152016,
        "y": 0.8022752,
        "flags": 8
      },
      {
        "teamId": "NONE",
        "iconType": 38,
        "x": 0.6477494,
        "y": 0.1322159,
        "flags": 0
      },
      {
        "teamId": "NONE",
        "iconType": 46,
        "x": 0.38521084,
        "y": 0.51096493,
        "flags": 0
      },
      {
        "teamId": "NONE",
        "iconType": 18,
        "x": 0.62182194,
        "y": 0.71171963,
        "flags": 0
      },
      {
        "teamId": "NONE",
        "iconType": 35,
        "x": 0.66617066,
        "y": 0.13686067,
        "flags": 0
      },
      {
        "teamId": "NONE",
        "iconType": 35,
        "x": 0.4558168,
        "y": 0.16799755,
        "flags": 0
      },
      {
        "teamId": "NONE",
        "iconType": 35,
        "x": 0.3734476,
        "y": 0.7792203,
        "flags": 0
      },
      {
        "teamId": "NONE",
        "iconType": 35,
        "x": 0.64016753,
        "y": 0.864507,
        "flags": 0
      }
    ],
    "mapTextItems": [],
    "lastUpdated": 1653398405778,
    "version": 465
  },
  "headers": {
    "date": "Tue, 24 May 2022 13:20:07 GMT",
    "content-type": "application/json",
    "content-length": "5472",
    "connection": "close",
    "etag": "\"465\"",
    "cache-control": "no-transform, max-age=3",
    "vary": "Accept-Encoding"
  }
}

@Yin117
Copy link

Yin117 commented May 24, 2022

In reviewing the data, the only thing that changed was a ''Relic Base 2' iconType: 46 disappeared from the API, all other data was the same.

This makes detecting these bugs extremely difficult, unless of course a Developer actually deleted and then replaced the Keep?

image

@hayden-t
Copy link

hayden-t commented Nov 4, 2023

this is still a big issue, trying to detect by all going noot and ignoring , would that not potentially end up ignoring a full resetat the start of war or resistance ?

@hayden-t
Copy link

hayden-t commented Nov 4, 2023

looking at my results from reset
image

and my event log, it would seem relic bases are not resetting, or are missing from the result

@hayden-t
Copy link

hayden-t commented Nov 5, 2023

image

@hayden-t
Copy link

hayden-t commented Nov 5, 2023

i worked out a logic to ignore resets:
i need to store the last real team (blue or green) between cycles
ignoring noots
and reset/start timer if last real team was different or there is no real last team

@Yin117
Copy link

Yin117 commented Nov 5, 2023

Let us know how it goes.
On the point of war end, I check the war state for that, and ontop of that I check if Devs mess with the buildings which is why this is such a pain when 1 structure is deleted.

@hayden-t
Copy link

Hey I worked out a way to stop this being a problem, now server restarts dont get shown on my map (foxholestats). Basically I dont reset my town cap timers (the counter that i use to calc the shading) unless the sector is taken by another team, just going noot (which happens during reset) doesnt. Since that my map has been fine.

@Yin117
Copy link

Yin117 commented Apr 24, 2024

Sounds like that'd help with timers, but not with detecting a server restart as a whole, but still good to know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Issue Something seems wrong with the API
Projects
None yet
Development

No branches or pull requests

4 participants