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

Expose and expand respawn point selection logic options for dedicated server operators #284

Open
wants to merge 32 commits into
base: master
Choose a base branch
from

Conversation

GooberRF
Copy link
Contributor

@GooberRF GooberRF commented Oct 11, 2024

This PR adds several options under the $DF Player Respawn Logic: "group" in dedicated_server.txt. These options on the whole provide server operators with a level of customizability of the respawn point selection logic that they've never had previously.

The default values shown below are functionally identical to the stock game behaviour, with the only notable caveat that the RNG method is std::mt19937 (typically more performant and has better results) as opposed to rand.

Default values:

$DF Player Respawn Logic:
+Respect Team Spawns: true
+Prefer Avoid Players: true
+Always Avoid Last: false
+Always Use Furthest: false
+Only Avoid Enemies: false
+Use Item As Spawn Point: "" 0    (no default value)

Explanation of options:

  • +Respect Team Spawns - Self-explanatory: if true (default), respect team flags on spawn points. If false, ignore them. Option can be useful if for example, a server wanted to run TDM on a CTF map but use DM-style RNG spawn selection logic as if it were a DM map.
  • +Prefer Avoid Players - If true (default), players have a higher likelihood of spawning away from other players, though RNG is still applied (via the same method as in the stock game).
  • +Always Avoid Last - If true, avoid spawning the player at the same location twice in a row.
  • +Always Use Furthest - If true, remove RNG from the equation and always spawn the player at the furthest spawn point from other players. (unless that's the last one they spawned at and Always Avoid Last is also on - in that case, use the second furthest)
  • +Only Avoid Enemies - If true, when calculating the distance a spawn point is away from players (with either Prefer Avoid Players or Always Use Furthest), ignore teammates and only consider distance away from enemies.
  • +Use Item As Spawn Point - Takes item types from items.tbl. If any specified, when the level loads, generate additional respawn points at every instance of the item type specified. Add additional +Use Item As Spawn Point lines to specify additional item types for generated spawns. Expects format +Use Item As Spawn Point: "Medical Kit" 9
    • The number after the item type is the threshold. Additional respawn points will only be generated at that item type if the level has less than that number of Multiplayer Respawn Points. If the threshold is specified as 0, it will always generate them regardless of Multiplayer Respawn Point count. This is to allow server operators additional control - ie. only spawn players at Medical Kits IF the level has an insufficient number of spawn points configured. The idea behind this is that if the map has enough spawn points without generating more, it's best to just use those, however if the map doesn't have enough, generating additional spawn points would be needed to make it playable and allow the server operator to run that map in their rotation when they otherwise would be unable. (I plan to use this extensively at Game Night to expand the pool of playable maps)
    • In team CTF/TDM, generated respawn points will be restricted to the team whose flag they are closest to. In DM, anyone will be able to spawn at them.
    • Also attempts to find the "center" of the map by looking for items commonly positioned there (amp, invuln, super armour, etc.). If a likely "center" of the map can be found, generated spawn points will point there. Otherwise, they'll point in the direction of the item.

This PR also:

  • Raises the limit on number of multiplayer respawn points per level from 32 to 2048.
  • Updates the behaviour for when players attempt to spawn in multiplayer but the map has no multiplayer respawn points. Stock behaviour is to spawn players at 0,0,0, which is both unintuitive (since the Player Start object exists) and limiting in that it removes the ability for people to explore most single player maps with friends (since the origin is far out of the level bounds). This PR changes the behaviour such that if a map has no multiplayer respawn points, players spawn at the Player Start (just like in single player).

This PR revolves #56

game_patch/rf/level.h Outdated Show resolved Hide resolved
game_patch/misc/player.h Outdated Show resolved Hide resolved
@GooberRF GooberRF marked this pull request as draft October 14, 2024 04:22
@GooberRF GooberRF marked this pull request as ready for review October 25, 2024 21:25
@GooberRF
Copy link
Contributor Author

I've significantly overhauled this PR. It now provides the ability to customize and modify the stock game spawn selection behaviour, which is a substantially better approach.

It also ups the limit of spawn points from 32 -> 2048.

@GooberRF GooberRF changed the title Implement improved and flexible respawn point selection logic Expose and expand respawn point selection logic options to dedicated server operators Oct 26, 2024
@GooberRF GooberRF changed the title Expose and expand respawn point selection logic options to dedicated server operators Expose and expand respawn point selection logic options for dedicated server operators Oct 26, 2024
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