godotengine / godotengine/godot
ENetMultiplayerPeer.Host.Compress Preventing Server Recreation "CantCreate"
- Dominant language
- C++
- Stars
- 117k
- Forks
- 26.8k
- PR merge metrics
- PR metrics pending
Description
### Tested versions
Found this issue with Godot 4.2, and updated today to 4.2.1 see if it would fix the issue but it was still present.
tested it out on 4.0 and 4.3Dev5 and got the issue in both cases.
### System information
Godot v4.2.1.stable.mono - Windows 10.0.19045 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 3060 Ti (NVIDIA; 31.0.15.5161) - AMD Ryzen 7 5800X 8-Core Processor (16 Threads)
### Issue description
Been trying to restart my server for a while, but always get an error "CantCreate"
Looked at numerous post about this but nothing was working.
### Steps to reproduce
Here is the snippet I used to test out things
```c#
private ENetMultiplayerPeer peer;
private void HostGame()
{
if (peer != null)
{
peer.Close();
peer = null;
}
peer = new ENetMultiplayerPeer();
Error error = peer.CreateServer(Port);
if (error != Error.Ok)
{
GD.PrintErr($"ERROR CANNOT HOST! : {error.ToString()}");
return;
}
peer.Host.Compress(ENetConnection.CompressionMode.RangeCoder);
Multiplayer.MultiplayerPeer = peer;
return;
}
```
If I comment out this error disapear.
`peer.Host.Compress(ENetConnection.CompressionMode.RangeCoder);`
I also tried different CompressionMode with the same result.
But, then I cant get client to connect to server.
### Minimal reproduction project (MRP)
[MRP.zip](https://github.com/godotengine/godot/files/14749520/MRP.zip)
Contributor guide
Research direction
Start with the linked MRP and the HostGame entry point, comparing server recreation with and without peer.Host.Compress using the provided compression modes. Confirm the behavior across the tested Godot versions; done means the server can be recreated with compression enabled and clients can connect.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, godot
- Domain
- game-dev, networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100