Hub

I made a post earlier today about a new library I'm working on. It deals with BYOND's hub-based features - medals, scores, and server lists. I didn't want to post it because BYOND's built-in world.SetMedal, ClearMedal, and GetMedal procs hardly ever work (which means the library's procs hardly ever work). I'm optimistic that this can be fixed in the near future. The medal portion of the library isn't the major attraction anyway.

The library provides the client.SetScore() and client.GetScore() procs. These procs are meant to be similar to this feature request. The SetScore() proc takes an operation so you can, for example, add 3 to an existing score's value with a single call to the proc:

client.SetScore("points", ADD, 30)

client.SetScore("highest-level", MAX, level)

client.SetScore("fastest-time", MIN, time)

The first line shows the ADD operation. The second shows the MAX operation, which would be used to keep track of the highest level a player has achieved. If the specified value is larger than what's currently on the hub, the hub's value is updated. This way the hub's score is only updated when you pass it a larger value. The last line shows the MIN operation, which is similar but only updates the hub when you pass it a smaller value. You could use this for keeping track of the player's record times in a racing game.

The library also includes a world.GetServers() proc, which returns information about publicly listed servers for a particular game. You can either pass the game's author and name as arguments (author first) or pass it no arguments and have it use world.hub by default.

You've provided an alternative syntax, but a library can't solve the complete feature request. BYOND lacks the proper tool. You're stuck using the same multiple calls so you have the same bandwidth and rollback issues.

It's the rollback that gets me. The problem should be likely to occur when dealing with multiple servers in a close time period. The chances increase with the duration of the lag and the amount of servers.

As long as each server has to make multiple requests, there will be lag between when it reads a score and when it sets that score. The last server to set the score will always overwrite the modifications made after its value was read. Any server reading the score after that point then receives the wrong value, updates based on that value and repeats the cycle.

If servers had the option to send modifiers instead of setting values directly then this problem wouldn't exist. Each server could send its updates and then read a value whenever it finds it convenient. Other servers would not be affected.

There's only so much a library can do in this case but I don't expect the built-in feature will be added. You'd really need to be playing two action games at the same time for it to be a problem - the second request (the set score call) happens immediately after getting the response so there's a very small window of opportunity for a problem to occur.

The problem involves multiple servers trying to communicate indirectly through the hub. A small (though network lag-dependent) window of time isn't small enough when there are a large number of servers. All it takes is overlapping get and set calls from two servers run at roughly the same time from anywhere around the world. The probability of an error increases with density.

As for the chances of the feature being added, may I suggest encouraging people to rate it up instead of claiming it has been addressed? That's really my only concern. I'm not trying to discourage you. I just don't want the feature request dismissed. =)

An action game will most likely update your scores more frequently. Even then, I don't think this problem is likely to occur. If it becomes a problem I'd suggest finding a better way to manage scores. Maybe there's some way to use a hidden score column to lock the scoreboard and manage transactions.

The feature request already has a lot of votes. I'd like to see lots of changes made to the hub scoreboards but I don't think its a matter of votes. If anything, making libraries to add features seems to be the way to spur them into adding the feature.