RobertBeckebans / RBDOOM-3-BFG

Doom 3 BFG Edition source port with updated DX12 / Vulkan renderer and modern game engine features
https://www.moddb.com/mods/rbdoom-3-bfg
GNU General Public License v3.0
1.37k stars 244 forks source link

Multiplayer fixes #848

Closed SRSaunders closed 3 months ago

SRSaunders commented 3 months ago

This fixes a number of multiplayer issues. Create Private Match with clients now works reliably at least on a local network. Not tested across internet but should work for known IP addresses. Did not look into online game browser or leaderboards.

The fixes are:

  1. Fixes regression #846 caused by an earlier, but broken memory leak fix on my part. The fix is almost identical to PR #847. I didn't want to duplicate but unfortnuately I had already added a commit at the start of this branch and didn't want to reset and start again. @RobertBeckebans should review and merge as appropriate.
  2. Fixes a critical issue with mis-reading network snapshot data on the client side, which caused no end of problems with mis-rendering, slowdowns, unstable connections, etc. The client was ignoring the entity network-synced flag which tells it whether it should read entity class-specific data. It was trying to read it all the time and sometimes coming up with null data which caused tons of problems with rendering and physics calculations (e.g. operations on NaN numbers). Simple fix was to respect the entity's network-synced flag on the client side but it makes all the difference.
  3. Fixes an incorrect assert on multiplayer VoiceChat shutdown.
  4. Allows r_useScissor cvar to be changed in multiplayer mode for use in bake* operations on multiplayer maps.
  5. Allows r_useParallelAdd cvars to to be changed in multiplayer mode for use in bake operations on multiplayer maps. This one is interesting, as I cannot duplicate the crash noted in the code if these cvars are not set to false. i.e. you can do the bake operations with them left on with no crashes. However, the interesting thing is that the bake operations are about 5-10% faster with them set to false. Unexpected but I can duplicate this across multiple platforms (Win, Linux, macOS). So in the end I left the logic in place but allowed the cvars to be changed in multiplayer mode.
  6. Fixed a couple of uninitialized variables that showed up in valgrind when in multiplayer mode.
  7. Added base/env/ to .gitignore since multiplayer bake operations write to this location in the install tree.

Tested on Win 10, Manjaro Linux, macOS Ventura with various cross-platform client-to-server connections.

RobertBeckebans commented 3 months ago

Very well done. I tested this between my desktop computer and laptop with netmap game/mp/d3dm1 and connect ip. Also a very interesting find with the missing && ent->fl.networkSync check.

SRSaunders commented 3 months ago

Thanks. Finding the sync flag check was tricky and time-consuming. However, a satisfying outcome given the simplicity.