Do Player IDs recycle after a player logs out

Here’s what I know so far:

Player IDs are numeric values that are assigned as players join a server, starting with “1” and incrementing each time a new player joins.
If a player leaves, then rejoins, they would be assigned a new number.

Here’s what I want to know:

When a player is assigned a number and then leaves does their old number go back into the rotation or are the numbers always sequential?

Player 1 joins. They are the first player so their ID = 1
Player 2 joins. They are the second player so their ID = 2
Player 1 leaves.
Player 3 joins. Is their ID = 1 (no longer in use) or is their ID = 3 (the third player to join)?

I can write code to test this. I’d rather ask and see if anybody knows the answer first.

I will answer my own question: They only ever go up, and are never ever recycled as far as we can tell.

I am using this information to pre-populate an array that tracks player health with default values. I made the array size 100 to leave space for players to join and leave throughout the session. Because the values are never recycled, I don’t have to worry about a new player inheriting stale data from a previous user.

Ultimately I’ll probably have to expand the array to accommodate scenarios where groups of players leave and re-join together, which for this particular world is likely.

1 Like