Open addmix opened 2 years ago
Looks like it should be done as extension and not in core by default.
Looks like it should be done as extension and not in core by default.
I'm not sure if this can be implemented by an extension, especially if you want it to work with all networking APIs (StreamPeer, PacketPeer, high-level multiplayer, HTTPClient, WebSockets, WebRTC, …).
Clumsy 0.3 (Available here: https://jagt.github.io/clumsy/) is a suitable stand-in for this feature.
I disagree. Clumsy is only available for Windows.
I disagree. Clumsy is only available for Windows.
Linux has netem which should be more capable than Clumsy, although I have not tested it. https://wiki.linuxfoundation.org/networking/netem
netem and similar solutions tend to be annoying to work with if you don't have root permissions on your machine (also for sandboxed uses like Flatpak), so there may still be some use to having something built-in Godot for this.
I'd also like this to be built-in so the implementation can be more consistent across platforms (otherwise, each tool for each platform may have an inconsistent feature set).
Posting a snippet for anyone on linux trying to simulate latency on localhost (netem and root permission required)
enable:
sudo tc qdisc add dev lo root handle 1: htb default 12
sudo tc class add dev lo parent 1:1 classid 1:12 htb rate 56kbps ceil 128kbps
sudo tc qdisc add dev lo parent 1:12 netem delay 150ms
disable:
sudo tc qdisc del dev lo root
Simple to get it running, but I highly recommend studying it to simulate exactly what type of network problem you want
Clumsy 0.3 (Available here: https://jagt.github.io/clumsy/) is a suitable stand-in for this feature.
I took a quick look at the clumsy docs, it looks like it doesn't support UDP, and also doesn't work with loopback, both of which will probably be peoples most common use case for testing their multiplayer code.
It's also worth noting that sch_netem
isn't available on some distros, so there's not really anyway to do this on, for example, Arch.
Describe the project you are working on
A multiplayer VR PVP flight simulator.
Describe the problem or limitation you are having in your project
There is a complete inability to locally test inclement network conditions (latency, packet loss, etc) when running multiple instances of a game, but this is mostly limited to the lack of driver-level network emulators available for Windows 10.
(related #2096) https://github.com/godotengine/godot/issues/28582
Describe the feature / enhancement and how it helps to overcome the problem or limitation
It would add debugging tools for Network Emulation,
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
The "Network Debug" tools would have a global toggle, to enable/disable debugging of inclement network conditions.
Each tool would have an option to enable/disable, and apply each of these tools selectively to inbound and/or outbound packets.
diagram of network debug options
Selecting the "Network Debug" option will bring up a sub window diagram of network debug window
If this enhancement will not be used often, can it be worked around with a few lines of script?
This enhancement should be utilized during the development process of most networked programs, and does not have a convenient workaround. This proposal would implement nicely to the base packet transmission/retrieval system of Godot, to then effect all network communications.
Is there a reason why this should be core and not an add-on in the asset library?
This necessitates the prevention and/or delay of packets at the PacketPeer level, before the packets can be evaluated by higher-level networking components, so this functionality cannot be achieved without modification of the core.