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

Randomize the location in svs.clients array for new clients #148

Closed
wants to merge 1 commit into from

Conversation

osm
Copy link

@osm osm commented Dec 20, 2024

Players are assigned the first available spot in the svs.clients array when they connect. On an empty server, this means that player1 is placed at svs.clients[0], player2 at svs.clients[1], and so on.

KTX iterates over svs.clients at the start of a match to decide where each player will spawn. This becomes problematic when there are fewer spawn points than players. A good example is dm3, which only has six spawns.

In the scenario where players connect to an empty server, they occupy the indexes 0 through 7 in the svs.clients array and are processed in this predictable order. This means player1 gets a random spawn before player2, player2 before player3, and so forth.

When it reaches player7, all spawn points are occupied. A random spawn is selected, and the player at that spawn point will be telefragged. Similarly, player8, the last to be processed, will also cause a telefrag.

By randomizing where new players are placed in the svs.clients array, we eliminate the possibility of predicting where in the array a player will be located, and thus also remove the possibility of manipulating the telefrag outcomes.

Players are assigned the first available spot in the svs.clients array when
they connect. On an empty server, this means that player1 is placed at
svs.clients[0], player2 at svs.clients[1], and so on.

KTX iterates over svs.clients at the start of a match to decide where each
player will spawn. This becomes problematic when there are fewer spawn points
than players. A good example is dm3, which only has six spawns.

In the scenario where players connect to an empty server, they occupy the
indexes 0 through 7 in the svs.clients array and are processed in this
predictable order. This means player1 gets a random spawn before player2,
player2 before player3, and so forth.

When it reaches player7, all spawn points are occupied. A random spawn is
selected, and the player at that spawn point will be telefragged. Similarly,
player8, the last to be processed, will also cause a telefrag.

By randomizing where new players are placed in the svs.clients array, we
eliminate the possibility of predicting where in the array a player will
be located, and thus also remove the possibility of manipulating the
telefrag outcomes.
@tcsabina
Copy link
Collaborator

From slime on discord today:

we need to hold off merging it for a while, oddjob applied the patch on some of his servers and it appears some mvds are broken when playing them through ezquake

@osm
Copy link
Author

osm commented Dec 29, 2024

I will close this PR and implement a more targeted fix in KTX instead, as demos recorded with this feature turned on sometimes break playback in ezQuake and the FTE QTV player on the hub. While the demos play fine in the FTE locally and the demo player on the hub, indicating that the issue is client-side, I still want to avoid causing problems for the QTV stream on the hub and older versions of ezQuake

@osm osm closed this Dec 29, 2024
@osm osm deleted the randomize-svsclients-location branch December 29, 2024 18:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants