steam-multiplayer-peer
steam-multiplayer-peer copied to clipboard
Send Error k_EResultLimitExceeded
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
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!
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
- game_manager
- steam_manager
- multiplayer_controller
- multiplayer_input
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
- Run host (as editor or windows build) on one PC, and another build on a separate computer PC (broken on MacOS at the moment)
- Launch game, hit Use Steam
- Hit Host P2P on one computer
- On the client PC, Hit List Lobbies -> Click on the lobby
You should see the warnings spammed on the host within about 30 seconds.
Project Source
- https://github.com/BatteryAcid/godotsteam-steam-multiplayer-peer-bug-demo/tree/refactor-to-godot-steam
- branch
refactor-to-godot-steam
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
- https://partner.steamgames.com/doc/api/steamnetworkingtypes
- https://partner.steamgames.com/doc/api/steamnetworkingtypes#SteamNetworkingConfigValue_t
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
- 9 maps to the config name: "k_ESteamNetworkingConfig_SendBufferSize"
- 1 is the option type I wish to change: int32
- 1024 is the buffer size
var options = [[9,1,1024]]
var error = multiplayer_peer.create_host(0, options)
No luck.
- https://partner.steamgames.com/doc/api/steamnetworkingtypes#SteamNetworkingConfigValue_t
- https://partner.steamgames.com/doc/api/steamnetworkingtypes
- https://github.com/expressobits/steam-multiplayer-peer/blob/d8c1d80f8262647f98b81d7d9c3259d224e55a2f/steam-multiplayer-peer/steam_multiplayer_peer.cpp#L400
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
As per a suggestion from @miatribe in my Discord, I tried using different buffer sizes:
- 0, 1048576, and 2097152
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.
In version 0.1.1 I left easy-to-change options for the peer, one of which solves this problem.
Basically the problem happens because we are sending too much data, overflowing the default steam buffer, but to change this buffer now in version 0.1.1 just add this code before create_client or create_host
peer = SteamMultiplayerPeer.new()
peer.set_config(SteamPeerConfig.NETWORKING_CONFIG_SEND_BUFFER_SIZE, 524288)
peer.create_host(0)
I pulled down the latest version, upgraded to Godot 4.2.2, added the set_config call (before create_host/client) as stated above, and I'm still getting the error.
If needed, I can also upload my demo project, let me know! Thanks
This value I set is Steam's own default, increase its size.
Updated project.
All the configs are in steam_manager.gd, in functions _create_host and connect_socket.
Instructions for running are the same as my comment above.
- https://github.com/BatteryAcid/godotsteam-steam-multiplayer-peer-bug-demo/tree/refactor-to-godot-steam
- branch
refactor-to-godot-steam
NOTE: I commented out the jump functionality a while back for testing, the warning shows up without moving or doing anything. Takes about 10 seconds before it starts.
has this issue been solved? I am getting the same issue and it usually happens when the amount of data to sync gets bigger.
has this issue been solved? I am getting the same issue and it usually happens when the amount of data to sync gets bigger.
Apparently no, have you tried changing this option?
In version 0.1.1 I left easy-to-change options for the peer, one of which solves this problem. Basically the problem happens because we are sending too much data, overflowing the default steam buffer, but to change this buffer now in version 0.1.1 just add this code before
create_clientorcreate_hostpeer = SteamMultiplayerPeer.new() peer.set_config(SteamPeerConfig.NETWORKING_CONFIG_SEND_BUFFER_SIZE, 524288) peer.create_host(0)
I tried up to 2097152 but I still see those warnings showing up. Looks like I am sending too many rpc and steam doesn't like that probably? I see that those warnings actually have an impact at runtime. It's weird because it is not clear what is causing the issue.
Is it the sender or the receiver who has these log warnings?
it was on both. apparently as I changed the replication setting of pretty much all MultiuplayerSynchronizer nodes I put in the main scene from Always to OnChange... things started to work much better and I am not seeing the warnings anymore. I still think the library should be aware of the issue and be able to give a better message to know what is causing the issue itself. I will keep testing this on my side, but so far I am not seeing the error anymore.
Yes, I understand, I was in doubt about removing the error, but the logic makes sense to have the error, since it will be a lost packet when this "warn" occurs, in my game I admit to sending updates only with event changes and I end up having little data sent.
Closed for the reason that this warning must happen so that the developer knows that he is losing packages.