Skip to content

Multiplayer

Valk edited this page Feb 2, 2026 · 70 revisions

This page is WIP.

Multiplayer.Preview.mp4

Important

If you are running Mac or Linux you may need a Custom ENet Build

Note

Each packet comes with a small overhead, either 1 or 2 bytes, depending on configured reliability and a one-byte opcode to identify its purpose. Everything else in the packet is strictly the data we send.

Side Notes

  • Do not directly access properties or methods across threads unless they are explicitly marked as thread safe. Not following thread safety will result in random crashes with no errors logged to the console. Things on the client thread should stay on the client thread and things on the server thread should stay on the server thread. If you need to communicate between them use the existing ConcurrentQueues.

  • A common oversight is using one data type for writing and another for reading. For example, if you have an integer playerCount and you write it with writer.Write(playerCount), but then read it as a byte with playerCount = reader.ReadByte(), the data will be malformed because playerCount wasn't converted to a byte prior to writing. To avoid this, ensure you cast your data to the correct type before writing, even if it feels redundant.

Example netcode has been provided in res://Framework/GodotUtils/Netcode/Sandbox/TopDown/World.tscn

Clone this wiki locally