Welcome

Netcode is Heathen Engineering’s family of networking tools for game engines. Netcode is the name of the product line, not of one package. It is built so the same ideas can serve any engine, and it starts on O3DE.

Netcode Foundation is version 0.1.0, an early release. Interfaces, the Schema format and the wire format may change before 1.0.

How Netcode is put together #

Like our other products, Netcode is split into layers, so you only take the parts you need and the parts that are not tied to an engine are not rebuilt for each one.

LayerWhat it isCost
CoreNetcode, a native, engine agnostic library written in C++17 with no engine headers. It holds the data model, sessions, synced state, messages and access control. It is designed to run on any engine.Free, open source (Apache-2.0)
FoundationThe functional base layer for one engine. It drives the Core from that engine’s tick and adds the engine’s components, tools and scripting. Netcode Foundation for O3DE is the first.Free, open source (Apache-2.0)
ToolkitOptional, paid add-ons that sit on a Foundation for a specific kind of game. None exists yet and none is promised.Paid

This is why you will see several repositories and names. The Core is its own repository, the O3DE Foundation includes it as a submodule, and the sample projects and the Steam Transport are separate gems. O3DE is where Netcode was created and is the only engine supported today. We expect to bring it to other engines, as we have with our other tools, but nothing is announced and no dates are committed.

Why Netcode #

Most networking tools make you think about bytes: what to serialise, when, and for whom. Netcode asks you to describe your game’s data once, and handles the rest.

  • Describe, do not serialise. You declare what each value means, for example a number from 0 to 3, or a position within a level’s bounds. The build packs it into the fewest bytes that hold it, and the subsystem’s own memory is the state that goes on the wire. There is no serialisation step to write or to get wrong.
  • Design the model in the Editor. A designer builds the data model on forms in the Netcode tool, and a developer connects it to game objects with components. If you have used the high level networking layers in popular engines, the shape will feel familiar: components on game objects, a spawner, owners and authority. The difference is that the state is declared as data rather than marked up in code.
  • Swap the transport. Delivery is a pluggable Transport, a concept you will recognise from many popular engines and networking tools. UDP and an in process test Transport are included, you can write your own, and several can listen at once.
  • Clients hold only what they may hold. Who can see what is part of the design, not an afterthought. The Any Server never sends a Client data it may not have, which is both access control and bandwidth saving.
  • A toolbox, not a framework. Connections, synced data, messages and access control are separate pieces. Use what your game needs and replace the rest.
  • Free and open. Apache-2.0, with an engine independent Core you can read.

We looked at a number of established tools while designing it (Mirror, FishNet, PurrNet, Netcode for GameObjects, Netcode for Entities, Unreal Engine replication, Photon Fusion, Colyseus, the O3DE Multiplayer gem and AzNetworking), and took our own route. Netcode is not a replacement for the O3DE Multiplayer gem, and we are not recommending one over the other.

A first look #

This is the whole path from nothing to a networked object, in five steps. Each is covered in detail on its own page.

  1. Add the gem to your project. See Install.
  2. In Tools, Netcode, create a Schema and add a type such as Crate with the fields it needs. See The Data Model.
  3. Put Net Record Access and Net Transform on a prefab, and a Net Spawner on your level. See Binding to Game Objects.
  4. Start a host and a client. See Sessions.
  5. Create a Crate record on the Any Server and every peer spawns the prefab.
local net = NetcodeRequestBus.Broadcast
net.LoadSchema("netcode/game.netschema")
net.StartHost(7777)
net.CreateRecord("Crate", -2)

Want to see it running first? The Samples page has two projects you can host and join on your own machine.

Netcode Foundation for O3DE #

The first Foundation is a code gem for O3DE. A developer can build a networked game on it alone: connections over pluggable Transports, synced data, messages, and control over which Client may hold which data. It is the stock, out of the box solution and not the only possible one. A project can use it, replace parts of it, or use no netcode at all. It has no dependency on other gems, does not use AzNetworking and does not change the engine.

AreaWhat you get
SessionsOne call starts a Standalone, Dedicated Server, Listen Server or Client session. Connections are admitted or rejected with a typed reason, and a Listen Server’s own player needs no wire.
Data modelA Schema declares the NetRecord types your game replicates. Fields are described by meaning (yes or no, number with a range and precision, text, bytes, references, collections, structs) and the build packs them tightly.
NetRecordsA replicated row of data. The Any Server creates and removes them, assigns an owner, and a Client may write only the fields the Schema lets it write.
Sync controlSync profiles and stages decide how often each group of fields is sent, spread across ticks. Late joiners receive current state.
MessagesA message is declared in the Schema, with typed parameters and a rule for who may call it.
Access controlAspects, roles and providers decide what each Client may hold. See Access Control.
TransportsUDP (IPv4 and IPv6) and an in process Loopback with fault injection are included. See Transports.
MechanismsOrdered inputs, state hashes with desync reports, snapshots and hydration, as the building blocks for prediction and correction.
Editor toolsTools, Netcode: a Types page for the data model, an Access page, a Play toolbar and a Session page that shows live connections and values.
ComponentsNet Record Access, Net Transform and Net Spawner connect NetRecords to game objects.
ScriptEverything is reachable from Lua and Script Canvas through the Netcode buses.

What it is not #

  • It is not an attribute based system. There is no replicated variable attribute, remote call attribute or replicated component base class. State is declared in a Schema and bound with components.
  • It is not a packaged prediction or rollback system. It provides the mechanisms and a sample that uses them. See Samples.
  • It does not include matchmaking, lobbies, anti-cheat or encryption in the UDP Transport.
  • It is not a replacement for the O3DE Multiplayer gem, and we are not recommending one over the other.

Source #

The gem is on Codeberg and the Core is on Codeberg, both under Apache-2.0.

Where to start #

  1. Install to add the O3DE gem to your project.
  2. Concepts for the handful of terms the rest of the documentation relies on.
  3. The Data Model and Binding to Game Objects to describe your data and attach it to game objects.
  4. Sessions to host, join and test.
  5. Samples for two working projects to read and run.

Read Status and Limits before you plan around anything, so you know what has been tested and what has not.

Rate This Article!