expressobits / steam-multiplayer-peer

Steam Sockets Multiplayer Peer for Godot 4 via GDExtension
MIT License
110 stars 7 forks source link

Send Error k_EResultLimitExceeded #15

Open BatteryAcid opened 1 month ago

BatteryAcid commented 1 month ago

Receiving this error:

USER WARNING: Send Error (Unreliable, won't retry): k_EResultLimitExceeded at: SteamConnection::_send_pending (steam-multiplayer-peer\steam_connection.cpp:25)

This seems to happen with frequently replicated properties, like position of a Node2D.

Game still plays, but not sure why this is happening, any insight would be much appreciated!

Source of message in code: https://github.com/expressobits/steam-multiplayer-peer/blob/main/steam-multiplayer-peer/steam_connection.cpp#L25C1-L26C1

BatteryAcid commented 1 month ago

I wasn't able to replicate this using the demo-bomber project, so I'll be investigating further. But if you do have any insight as to why this message shows up, that could help me narrow it down. Thanks!

BatteryAcid commented 1 month ago

I dug into this for two days now with no luck - I'm not able to reproduce with the demo bomber project. I'm attaching my project in case anyone wants to take a look.

Relevant files

This seems to be related to the MultiplayerSynchronizer. I was able to reduce this error in one scenario where I restructured how some properties are synched, like didn't really need them, but ultimately it persisted.

Another case that it doesn't show is when I Host on a much older laptop, and then join as client on my newer PC. However, if I host on my new gaming PC it always shows this error on the host side. Client side never gets this error.

Technically I'm not even sure this is a problem, as it just shows as a Warning, so please let me know if this is just an oversight with logging...

Any feedback would be appreciated! Thanks


Setup

You should see the warnings spammed on the host within about 30 seconds.


Project Source

BatteryAcid commented 1 month ago

Found some docs on when this is thrown:

k_ESteamNetworkingConfig_SendBufferSize: Upper limit of buffered pending bytes to be sent, if this is reached SendMessage will return k_EResultLimitExceeded

BatteryAcid commented 1 month ago

While I don't see this as a legitimate fix (as it didn't change anything), I still wanted to try setting the k_ESteamNetworkingConfig_SendBufferSize to a higher value to see if it prevented the buffer error.

I tried both methods:

Method 1

Steam.setGlobalConfigValueInt32(Steam.NETWORKING_CONFIG_SEND_BUFFER_SIZE, 1024)

Method 2

Passing options array to create_host

var options = [[9,1,1024]] 
var error = multiplayer_peer.create_host(0, options)

No luck.

Truc4 commented 1 month ago

I also get this warning spammed sometimes, consistently when I have more than 2 players connected. I do not use multiplayer synchronizer as I have custom netcode, but I do send a lot of unreliable packets for my net sync. I would love to know if it is an issue with the plugin or with how I am using it, (or a steam limitation I am not considering) My game works perfect using Enet peer

BatteryAcid commented 1 month ago

As per a suggestion from @miatribe in my Discord, I tried using different buffer sizes:

As it's likely the values are in bytes, not kilobytes, but still same warning message spam. Again, I don't think increasing buffer size is the solution, but curious to see if it impacted result.