foxssake / netfox

Addons for building multiplayer games with Godot
https://foxssake.github.io/netfox/
MIT License
359 stars 14 forks source link

Reduce bandwidth on RPCs by having arguments be single letter #290

Open warsang opened 1 week ago

warsang commented 1 week ago

Hi!

Just a proposal as I was reading through https://github.com/jonathaneeckhout/jdungeon/blob/main/documentation/networkingsync.md which has some interesting info on Godot RPCs;

Godot sends the full argument name over the network when performing an RPC call. While this makes the code a bit less readable, changing arguments to 1 letter should reduce the size of RPCs sent over network and improve bandwidth; You can always rename the arguments once received to something more readable or add a comment to make sure the code is easily maintainable.

TheYellowArchitect commented 6 days ago

You may also note that argument names for these functions are a single letter. This is intentional due to Godot needing to send argument names when performing RPCs.

Thank you for sharing this. That's awful. I will go open a godot proposal for this

As for the rest of this issue, netfox with forest-brawl as tutorial must be as readable as possible, given the complexity of rollback. I think this optimization shoud be project-specific instead of being automatically applied to all RPC calls.

That said, this optimization does have merit, so in the docs, or in some comment, there should be a suggestion to use single-letter RPC parameters :+1:

Faless commented 2 days ago

As explained in https://github.com/godotengine/godot-proposals/issues/10885 the statement is wrong.

Godot does not send the arguments names, nor the function name.

The RPC sends: