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

ASA (Ark Survival Ascended): EpicGames api will return duplicate server object but one is wrong. #226

Open
ElBretxa opened this issue Oct 14, 2024 · 0 comments
Labels
bug Something isn't working protocol This is something regarding a protocol v0.5.X Things about v0.5.X
Milestone

Comments

@ElBretxa
Copy link

Describe the bug
This is a rare bug. I only found it in asa, but I dont know if it could happen with other games.

When doing a query to the epicgames api, it returns an array with the game servers in that IP. But sometimes, it may return one game server duplicated. But the difference is that the duplicate server total player count is "1" and I believe the game server id is different too.

Steps To Reproduce
I made my own library to query ark servers in a larger scale and save all ark servers info. Doing this is when I noticed, that sometimes we would get a duplicate server in the servers array and the wrong one would be the one with total player count 1.

As I had my own library, I went to ask a friend who used gamedig, and he told me he was having this issue every now and then, and he would just query the server again and again until he would be returned a server with a different player count than 1. But the correct one would be returned when the duplicated disappeared, or the find function would return the "correct" one.

So I noticed this by doing thousands of queries and checking the server object we would get from the epic games api.

Expected behavior
I ended up finding a "temporal" solution, as I dont know if a wrong game server object could happen even when a server is offline.

The duplicated server would be wrong as it would always show player count 1, so I ended up thinking, if there is more than 1 server with the same port, then we can get the one that player count is not 1.

But I say this is a temporal solution, as I dont know if I can get a player count 1, even when the game server is offline.

I want to shout out to cainthebest for making my fix much more cleaner and optimized. But as I mention above, I dont know if we can get this issue when the server is offline that would make us believe the server is online.

const allMatchingSessions = response.sessions.filter(hasDesiredPort);

const desiredServer = allMatchingSessions.length > 1
  ? allMatchingSessions.find(session => session.totalPlayers !== 1) || allMatchingSessions[0]
  : allMatchingSessions[0] || null;

if (!desiredServer) {
  throw new Error('Server not found');
}
@ElBretxa ElBretxa added the bug Something isn't working label Oct 14, 2024
@cainthebest cainthebest added protocol This is something regarding a protocol v0.5.X Things about v0.5.X labels Oct 14, 2024
@cainthebest cainthebest added this to the Backlog milestone Oct 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working protocol This is something regarding a protocol v0.5.X Things about v0.5.X
Projects
None yet
Development

No branches or pull requests

2 participants