General > Developers Corner
Points by SteamID
Bytewave:
--- Quote from: roastchicken on September 10, 2016, 07:49:07 PM ---Yep. UniqueID's are terrible. I wish Garry or some other dev would just bite the bullet and phase them out. Make a native UID/SID table and just map UniqueID to SteamID.
--- End quote ---
But because we're so far down the line, you'd break backwards compatibility.
UniqueID has its purposes, but not so much anymore. SteamID32/64/3 are guaranteed to be unique, but SteamID64 is the only one of those that is numeric, and it's 64-bit (though, really, that matters very little these days). UniqueID is already used in so many places that it'd be difficult to change it. UTime even uses UniqueID, iirc, but don't quote me on that.
I am an advocate of depreciating UniqueID now that much better alternatives exist. But it can't be stripped entirely.
/ot
edit: The same issue of collisions exists with a global redirect table. Don't forget that.
roastchicken:
Why doesn't a redirect table work? UID->SID64. Net messages might break, but that's easy enough to fix. I can't think of anything else where the size of SID64 vs UID would matter. Sure, collisions still exist. But it's still better than keeping UID.
It would have been nice if Garry hadn't made UID in the first place, but we can't change the past. It might not be the most graceful change and there may be some bugs that are caused by it, but the same thing happened (on a larger scale, I believe) with the shift to Garry's Mod 13.
With all that said, I highly doubt the devs will do anything about Unique IDs. Oh well, I can hope.
Bytewave:
--- Quote from: roastchicken on September 11, 2016, 04:34:21 AM ---Why doesn't a redirect table work? UID->SID64. Net messages might break, but that's easy enough to fix. I can't think of anything else where the size of SID64 vs UID would matter. Sure, collisions still exist. But it's still better than keeping UID.
It would have been nice if Garry hadn't made UID in the first place, but we can't change the past. It might not be the most graceful change and there may be some bugs that are caused by it, but the same thing happened (on a larger scale, I believe) with the shift to Garry's Mod 13.
With all that said, I highly doubt the devs will do anything about Unique IDs. Oh well, I can hope.
--- End quote ---
A redirect table won't work because of the collisions issue.
CRC32 is highly prone to collisions--it's made for verifying message integrity over lossful network streams, not storing unique data.
Plus, how do you make a redirect table? Do you iterate over every possible SteamID? What if the spec changes for SteamIDs? Do you do it dynamically?
A redirect table would only end up being a cache of sorts anyway.
Another issue with the redirect table is that databases will expect numeric values for UIDs, not string values, which is what the UID is constructed from (see the wiki page). So the redirect table would have to map SID64 to UID, which isn't too impossible... until you realize that they're both numbers, and how would you tell them apart? Which one of these is a UID? Which one is a SID64?
There would be plenty of bugs. Addons like UTime use UniqueID internally, and changing that would break the entire UTime database without going through and updating every record to SID64, which you cannot do without having the players online. And there's no way you're going to get every player ever to join your server, and you likely won't want to reset your entire UTime database, especially with a larger community.
We're so far down with how long UID has been in the game that it would be detrimental to remove it now. Perhaps following some major release, sure, but do you see a major GMod release down the pipeline anywhere?
roastchicken:
--- Quote from: Bytewave on September 11, 2016, 09:08:22 AM ---A redirect table won't work because of the collisions issue.
CRC32 is highly prone to collisions--it's made for verifying message integrity over lossful network streams, not storing unique data.
--- End quote ---
Collisions exist already, without a redirect table. A redirect table can't make the collision problem any worse.
--- Quote from: Bytewave on September 11, 2016, 09:08:22 AM ---Plus, how do you make a redirect table? Do you iterate over every possible SteamID? What if the spec changes for SteamIDs? Do you do it dynamically?
A redirect table would only end up being a cache of sorts anyway.
--- End quote ---
I was thinking of just storing the UniqueID and SteamID64 of every player that joined. I guess 'cache' might be a better word for it.
--- Quote from: Bytewave on September 11, 2016, 09:08:22 AM ---Another issue with the redirect table is that databases will expect numeric values for UIDs, not string values, which is what the UID is constructed from (see the wiki page). So the redirect table would have to map SID64 to UID, which isn't too impossible... until you realize that they're both numbers, and how would you tell them apart? Which one of these is a UID? Which one is a SID64?
--- End quote ---
Why do you need to be able to tell them apart? If you're unsure, try using it to visit a Steam profile (http://steamcommunity.com/profiles/<SID64>); if it doesn't work, it's not a SteamID. As for doing it programmatically, there are functions to convert between the two SteamID formats and I'm pretty sure they just return false if it's not the correct format.
--- Quote from: Bytewave on September 11, 2016, 09:08:22 AM ---There would be plenty of bugs. Addons like UTime use UniqueID internally, and changing that would break the entire UTime database without going through and updating every record to SID64, which you cannot do without having the players online. And there's no way you're going to get every player ever to join your server, and you likely won't want to reset your entire UTime database, especially with a larger community.
--- End quote ---
The whole idea with a redirect table is to, well, redirect. Player:UniqueID() would just return the player's SteamID64.
--- Quote from: Bytewave on September 11, 2016, 09:08:22 AM ---We're so far down with how long UID has been in the game that it would be detrimental to remove it now. Perhaps following some major release, sure, but do you see a major GMod release down the pipeline anywhere?
--- End quote ---
I think the pros outweigh the cons, but I agree that the developers would probably only make a large change like this in a major release. Maybe in GMod 2, if they ever make it.
An Error Has Occurred!
array_keys(): Argument #1 ($array) must be of type array, null given
[0] Board index
Go to full version