fivem icon indicating copy to clipboard operation
fivem copied to clipboard

feat(net): Configurable peer timeout

Open tens0rfl0w opened this issue 1 year ago • 1 comments

Goal of this PR

Clients that don't send or accept data for a longer period of time can have a negative impact on the gameplay behavior of specific game modes (especially PVP-focused), due to the nature of existing RAGE net code and missing patches for any server-authoritative control over synced entity data that is game-state critical (position correction, damage control system, etc.)

Some examples:

  • Player 'teleporting': clients that reconnect before timing out do not get reset to the last known server position
  • Dropped damage data: clients that don't receive game frame updates don't have their entity states updated afterward.
  • ...

While the goal should be to have some sort of correction for these types of desync issues, this is probably not accomplishable in the short run. In the meantime, we can allow servers to define shorter (or longer) peer timeout values to at least give them some sort of countermeasure for the above-described problems, as the default value of 30 seconds is quite long.

How is this PR achieving the goal

This change introduces a new replicated ConVar named 'sv_peerTimeout' that allows to configure a per-server peer timeout, which can be set via the (server-sided) console command 'set_peer_timeout [timeout]'.

The (client-sided) enet timeout will get reset to the default value of 30 seconds after disconnect.

This PR applies to the following area(s)

FiveM, Server, Net

Successfully tested on

Game builds: Not applicable

Platforms: Windows, Linux

Checklist

  • [x] Code compiles and has been tested successfully.
  • [x] Code explains itself well and/or is documented.
  • [x] My commit message explains what the changes do and what they are for.
  • [x] No extra compilation warnings are added by these changes.

Fixes issues

/

tens0rfl0w avatar Oct 21 '24 08:10 tens0rfl0w

any news on this pr?

n3xuuu avatar May 01 '25 21:05 n3xuuu