godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.16k stars 97 forks source link

Add a debugging button for toggling network connection in the Editor #2096

Open icolwell opened 3 years ago

icolwell commented 3 years ago

Describe the project you are working on

Online multiplayer game with clients connecting to a server.

Describe the problem or limitation you are having in your project

It is difficult to simulate loss of internet or intermittent connectivity between client and server.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

The editor has an existing "Network Profiler" tab in the debugger which is helpful for viewing RPCs. It would be nice to include a toggle button on this tab that lets the user "disconnect" networking to the running game/app as they wish.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

Simply a toggle button that enables/disables or allows/blocks networking on the running app.

If this enhancement will not be used often, can it be worked around with a few lines of script?

No, external tools could possibly be used (I'm not aware of any at the moment), but this feature would be a huge gain in convenience compared to using external tools.

Is there a reason why this should be core and not an add-on in the asset library?

It relates to the core editor functionality.

Additional Notes

This was originally mentioned by https://github.com/godotengine/godot/issues/28582. That issue mentions other features like packet lag and loss rate which would also be great, but I think a simple network toggle is hugely useful and the first step in that direction.

Calinou commented 3 years ago

That issue mentions other features like packet lag and loss rate which would also be great, but I think a simple network toggle is hugely useful and the first step in that direction.

If packet loss simulation is implemented, simulating offline mode is as simple as simulating a packet loss rate of 100% in both incoming and outgoing directions.

icolwell commented 3 years ago

Certainly! I just assumed an on/off toggle would be much easier to implement than packet loss simulation, and an immediately very useful feature. Basically a lower-hanging but still very large fruit. That being said, if there is sufficient motivation/resources to implement packet loss simulation, maybe it's overall less work to start with that and simulate 100% loss to achieve this proposal at the same time.

Thanks for reading and considering this proposal!

FMNSSun commented 2 years ago

To be honest it would be really cool if you could simulate lag within godot itself such that for example unreliable rpc calls are actually unreliable when testing on local machine and even more so if you can specifcy a delay range (such as random between 100 and 120ms) such that you can actually simulate lag and out-of-order arrival of unreliable rpc calls.

Because otherwise you have to set-up some form of local testing network with a router that can do that (which costs a lot of money) or use different phone ISPs (which costs a lot of money) to do proper testing without having a team of alpha/beta tester available.