The short answer
Godot's documentation says to open the server export preset, go to the Resources tab and pick "Export as dedicated server", which adds the dedicated_server feature tag automatically. Since Godot 4.0, any binary can also run without a window using --headless. Pair that with a fixed port and an honest test and you have a server a host can run.
Detect server mode in code
Godot gives you three ways to know you are the server:
func _ready() -> void:
if OS.has_feature("dedicated_server"):
start_server()
elif DisplayServer.get_name() == "headless":
start_server()
elif "--server" in OS.get_cmdline_user_args():
start_server()
Use one on purpose. A server that quietly starts as a client waits forever for a window.
ENet or WebSocket?
| ENet | WebSocket | |
|---|---|---|
| Protocol | UDP | TCP (WebSocket) |
| Browser web export | Not possible | Yes, over wss:// |
| Latency under packet loss | Better | Worse |
| Peer class | ENetMultiplayerPeer | WebSocketMultiplayerPeer |
Native-only games should use ENet. Games with browser players need WebSocket or WebRTC. Read WebSocket vs UDP.
The checklist
- Match versionsInstall export templates that match your editor version exactly, and use the same Godot version for client and server.
- Create a Linux x86_64 presetIn Project > Export add a Linux preset and choose the x86_64 architecture.
- Choose dedicated server modeOn the Resources tab pick Export as dedicated server. This adds the
dedicated_serverfeature tag and lets you strip visuals. - Start the right peer on a fixed portCreate
ENetMultiplayerPeer.create_server(port, max_clients)for UDP orWebSocketMultiplayerPeer.create_server(port)for browsers, then assign it tomultiplayer.multiplayer_peer. - Run it headless on LinuxExecute
./server.x86_64 --headless, check the port withss, and join from a real client on another network. - Keep saves under one pathWrite state under
/game/savesor another single known folder so a shutdown can checkpoint it. - Pack cleanlyArchive the export folder as
.tar.gzwith no symbolic links and no embedded tokens, then record the SHA-256 of the file you will upload.
Stripping the export
The export dialog lets each resource be exported with visuals replaced by placeholders, kept, or removed. Stripping textures and materials on the server shrinks the package and memory. Do not strip anything your server logic reads, such as collision shapes, navigation data or scene scripts.
Test it the way a host will run it
On a Linux x86-64 machine, extract the archive and start the server with the exact command you will declare. Check the port with ss -lunp for ENet (UDP) or ss -ltnp for WebSocket (TCP), then join from a Godot client on another computer or network. If the server prints errors about missing display or audio drivers, you started the normal binary without the dedicated server tag or --headless.
Common mistakes
| Mistake | Symptom | Fix |
|---|---|---|
| Export templates do not match the editor version | Export fails or the server crashes at start | Install the matching templates from the editor's export dialog |
| Client and server built on different Godot versions | Peers connect, then disconnect or desync | Rebuild both with one version |
| Server created only inside a UI scene | Nothing listens when run headless | Start the peer from an autoload or a scene that runs without a window |
| Stripped a resource the server reads | Missing node or script errors at startup | Mark only visual resources as stripped |
Hard-coded 127.0.0.1 or a random port | Reachable only locally | Bind the fixed declared port on all interfaces |
| Saved files written next to the executable | Lost on shutdown | Write under one declared save folder |
What a host needs from you
A declared start command such as /game/server.x86_64 --headless, the port and protocol (UDP for ENet, TCP for WebSocket), a health reply and, ideally, a join probe. The connection config guide lists each field, and the Godot ENet and Godot WebSocket pages cover the hosting side.
Frequently asked questions
How do I run a Godot server without a window?
Start the exported binary with the --headless command-line argument; since Godot 4.0 this works on any platform. If you export with Export as dedicated server mode, the dedicated_server feature tag is added automatically, which you can test with OS.has_feature, and the project can start in server mode without extra arguments.
Sources
- Godot Docs: Exporting for dedicated servers, accessed October 3, 2026
- Godot Docs: WebSocketMultiplayerPeer, accessed October 3, 2026