Skip to content

Optimizations, Steam improvements, predictive interpolation#26

Merged
Extremelyd1 merged 33 commits intoExtremelyd1:steam-p2pfrom
diamondpixel:ExtremeOptimisations
Jan 23, 2026
Merged

Optimizations, Steam improvements, predictive interpolation#26
Extremelyd1 merged 33 commits intoExtremelyd1:steam-p2pfrom
diamondpixel:ExtremeOptimisations

Conversation

@diamondpixel
Copy link
Contributor

No description provided.

diamondpixel and others added 27 commits December 16, 2025 17:00
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 5 to 6.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](actions/upload-artifact@v5...v6)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
updated-dependencies:
- dependency-name: Hamunii.BepInEx.AutoPlugin
  dependency-version: 2.1.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
- Add RequiresX capability properties to IEncryptedTransportClient
- Server-side Steam clients now correctly skip UDP sequencing logic
- Lazy-init managers only when needed (saves memory for Steam)
- Remove HolePunch stubs (to be replaced with pre-processors)
…d lobby management system with Steam integration and some improvements to the system
…ions

# Conflicts:
#	MMS/MMS.csproj
#	MMS/Models/Lobby.cs
#	MMS/Program.cs
#	MMS/Services/LobbyService.cs
#	SSMP.sln
#	SSMP/Game/Server/ModServerManager.cs
#	SSMP/Game/Settings/ModSettings.cs
#	SSMP/Game/SteamManager.cs
#	SSMP/Networking/Client/ClientTlsClient.cs
#	SSMP/Networking/Client/DtlsClient.cs
#	SSMP/Networking/Matchmaking/MmsClient.cs
#	SSMP/Networking/Server/NetServerClient.cs
#	SSMP/Networking/Server/ServerUpdateManager.cs
#	SSMP/Networking/Transport/HolePunch/HolePunchEncryptedTransport.cs
#	SSMP/Networking/Transport/HolePunch/HolePunchEncryptedTransportServer.cs
#	SSMP/Networking/Transport/SteamP2P/SteamEncryptedTransport.cs
#	SSMP/Networking/Transport/SteamP2P/SteamEncryptedTransportServer.cs
#	SSMP/Networking/UpdateManager.cs
#	SSMP/SSMP.csproj
#	SSMP/Ui/Component/LobbyConfigPanel.cs
#	SSMP/Ui/ConnectInterface.cs
…meOptimisations

# Conflicts:
#	SSMP/Game/GameManager.cs
Copy link
Owner

@Extremelyd1 Extremelyd1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few comments about optimizations that I think are not significantly improving memory usage. The others about various other small issues.
The reorganization of the PacketManager is much appreciated! That class was getting a bit too packed with dictionaries.

@diamondpixel
Copy link
Contributor Author

Greetings.

I did a bunch of testing yesterday and today. The GC allocation optimisations do drop the memory usage but eventually with enough playtime or being AFK(don't know why)the memory allocations eventually creep up to 600MB+ until I assume the GC triggers.

I tried using dotTrace and dotMemory, Visual studio profiler, Unity profiler nothing seems to be working.Moreover BepInEx's profiler is just a simple csv with thread/call counts/function/runtime/allocation and provides no clear indication of what is happening.
(One lead I have is that our Loops with ManualResetEvent, on the wait handles allocate cancellationTokens without freeing them, thus causing this leak. This has been patched in newer versions of NET 6+, but Unity have choked themselves into a corner with Mono and netstandard 2.1)

Our only left option is PerfView and I honestly don't have the knowledge and time to get to know it.

In conclusion--You can do as you please with this PR. It is not necessarily a problematic or bad pr but it doesn't solve the true problem it only masks it for X amount of time.

@diamondpixel
Copy link
Contributor Author

diamondpixel commented Jan 8, 2026

I found sometime yesterday and modified the SimplerProfiler from BepInEx.Debug repository. I have added DLL filtering and flamegraphs and some more features to help figure out the allocations. These are my findings, i have attached a test run with SSMP and one without for reference.

For some reason we are allocating a bunch of memory with DTLS encryption / SmartCopy. But the most interesting to me is the Playmaker allocations.

PSA: After some more investigation the allocations cannot be eliminated (at least easily without trading functionality) and they are here to stay.

image image

…. Change data send type to k_EP2PSendUnreliable from k_EP2PSendUnreliableNoDelay for better bandwidth effeciency. Updated & enabled interpolation
@Extremelyd1
Copy link
Owner

I'm assuming these changes are still worth merging even though they do not completely address the memory usage?

@diamondpixel
Copy link
Contributor Author

Yeah, I was playing with a friend and we noticed that Steam was really laggy. It also had issues leaving a lobby and rejoining the same one.

Copy link
Owner

@Extremelyd1 Extremelyd1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some more change requests. Also, it seems that you haven't addressed the changes from my previous review yet. See all unresolved comments please.

@Extremelyd1 Extremelyd1 changed the title Extreme optimizations Optimizations, Steam improvements, predictive interpolation Jan 23, 2026
@Extremelyd1 Extremelyd1 merged commit e7c947b into Extremelyd1:steam-p2p Jan 23, 2026
3 checks passed
@diamondpixel diamondpixel deleted the ExtremeOptimisations branch January 23, 2026 13:09
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