ARCANUM
Netcode SDK · C++

Write the game. Aether moves the bytes.

Plain structs go in. Replication, interest management, client prediction, lag compensation and saving come out, over WebSocket or reliable UDP. A complete multiplayer world fits in about a hundred lines.

world you 7 in view · 10 skipped Server20 ticks a second changedrows ↓ inputs↑ Clientpredicts every frame your position over time predictedserver
Only what a player can see is sent. Their own moves never wait for the server.
5,000
players in one place, about 5 ms of send per tick
123 B
per player per tick, 5,000 players spread out
0.55 ns
per entity to iterate a component
114 lines
for a world with walking, prediction, chat and saved coins

Measured on a desktop i5-11400F, Release build.

The whole game

A contract, a rule, a world

The same step runs on the server and on the client. That is how prediction stays honest.

World.h · server
#pragma once
#include <aether/server.h>

#include "meadow/Shared.h"

using namespace aether;
using meadow::Chat;
using meadow::Purse;
using meadow::Said;

class World : public server::Game {
public:
    explicit World(ecs::Store& store) : Game({.store = &store, .contract = meadow::contract}) {}

    void onStart() override {
        persist<Purse>().key(&Purse::owner);                 // saved, filed under its owner
        view<Walker>().spatial("x", "y");                    // seen by players nearby
        view<Purse>().ownerOnly();                           // seen by its owner only
        inputs().apply<Move>(step);                          // what a held Move does
        on<Chat>([this](Player& p, const Chat& c) {          // a message from a client
            broadcast(Said{String<16>(p.query("name", "anon")), c.text});
        });
    }

    void onJoin(Player& p) override {
        const std::string name = p.query("name", "anon");
        p.entity = spawn(Walker{0, 0, 60},
                         load<Purse>(name).value_or(Purse{String<16>(name), 0}));
    }

    void update(float) override {
        for (Player& p : players()) get<Purse>(p.entity).gold += 1;      // a coin a tick
    }
};
client.cpp
#include <chrono>
#include <cstdio>

#include <aether/client.h>

#include "meadow/Shared.h"

using namespace aether;

static double lerp(double a, double b, double t) { return a + (b - a) * t; }

int main(int argc, char** argv) {
    client::Session session(argc > 1 ? argv[1] : "ws://localhost:9000/?name=Ayla",
                            {.contract = meadow::contract});
    session.onClose([](std::uint16_t code, std::string_view why) {
        std::printf("closed %u: %.*s\n", code, int(why.size()), why.data());
    });
    session.onError([](std::string_view what) { std::printf("error: %.*s\n", int(what.size()), what.data()); });

    auto players = session.view<Walker>();
    auto purses  = session.view<meadow::Purse>();
    auto me      = session.predict<Walker>();
    me.apply<Move>(step);
    session.on<meadow::Said>([](const meadow::Said& s) {
        std::printf("%s: %s\n", s.who.str().c_str(), s.text.str().c_str());
    });
    session.connect();

    using Clock = std::chrono::steady_clock;
    const auto start = Clock::now();
    auto lastPrint = start;
    bool said = false;
    while (Clock::now() - start < std::chrono::seconds(4)) {
        session.poll(5);
        me.input(Move{1, 0});
        if (session.ready() && !said) { session.send(meadow::Chat{String<80>("hello")}); said = true; }
        if (Clock::now() - lastPrint > std::chrono::milliseconds(500)) {
            lastPrint = Clock::now();
            const double a = me.alpha();
            const auto purse = purses.find(session.me());
            std::printf("x=%.1f gold=%u\n", lerp(me.before().x, me.now().x, a), purse ? purse->gold : 0);
        }
    }
}

Five files in all, 114 lines, and every one compiles and runs: the Start page has the contract file, the shared header and server.cpp, and builds them step by step.

Transport

WebSocket or reliable UDP. One line decides.

Ship to browsers over WebSocket and to native clients over GameNetworkingSockets, Valve's reliable UDP. The game code is the same for both.

Browser clientws:// · JavaScript or C++ Native clientgns:// · PC, console, mobile WebSocketTCP · runs in every browser GameNetworkingSocketsreliable UDP · always encrypted Your game same structs · views · prediction same contract check
WebSocket
// server
app.listen(9000);

// client
client::Session session("ws://play.example.com:9000/");
Reliable UDP
// server
app.listen(server::GameSocket{27015});

// client
client::Session session("gns://play.example.com:27015/");
Everything in the box

Every piece of netcode, already built

Data model

Plain structs

No macros, no ids, no base class. Aether reads the members itself.

One contract file

A .aether file generates C++ and JavaScript. A mismatched client is refused at connect.

Entity component system

Queries with none, any and optional, groups, tags and singletons.

Lists and nesting

Bounded lists, fixed arrays, strings and structs inside structs.

Hooks and events

React when a component is added or removed. Pass events between systems.

Schedule

Phases, systems at their own rate, and timing for each one.

Server-only components

Any C++ type, from a std::map to a nav mesh. Never sent, never saved.

Deferred changes

Add and remove safely while a query is running.

Text dump

Print the whole world, or one entity, when something looks wrong.

Replication

Views

Say which struct clients see. Aether sends only the fields that changed.

Interest management

A 2D or 3D grid. A player receives what is near them and nothing else.

Owner-only and global

A purse only its owner sees. A scoreboard everybody sees.

Encoded once

A change is packed once per tick and shared by every player who sees it.

Byte budget

A cap per player per tick. The most urgent rows go first, the rest catch up.

Field tiers and rates

Position every tick, cosmetics every fifth. One call: every(5).

Crowd blocks

A packed city square is sent as shared blocks, not player by player.

Function views

Show clients a computed slice of server-only state.

Messages

send, broadcast and on<T> for everything that is not a row.

Client

Prediction and replay

Your own character moves at once and is replayed when the server corrects it.

Held inputs and moves

input() for the stick, act() for a jump. Both arrive in order.

Smooth remote players

Two rows and an alpha for each one. Blend them however you draw.

Lag compensation

The server keeps history and judges a shot where the shooter saw the target.

Server time

One clock every client agrees on, for cooldowns and timers.

Reconnect

A dropped connection resumes with one call.

Saving and running

Declare it, it is saved

persist<Purse>().key(&Purse::owner). There is no save call.

Two transports

WebSocket for browsers, GameNetworkingSockets for native clients. ws:// or gns://.

Three stores

Memory for tests, a file for one server, Rune for a cluster. One line to switch.

Schema check

A changed struct is refused at start, before it can misread old rows.

Many games, one process

A lobby and an arena behind one port, each at its own tick rate.

Tests in one include

A real server and real clients inside a unit test, on a free port.

One CMake line

aether_game(mygame) builds the server, the client and the test.

Speed

An ECS as fast as the fastest

Nanoseconds per entity, against EnTT 3.15. Shorter is better.

Query two components

Aether
2.1 ns
EnTT
2.9 ns

Read one entity at random

Aether
1.7 ns
EnTT
4.3 ns

Destroy an entity

Aether
18 ns
EnTT
39 ns

Iterate one component

Aether
0.55 ns
EnTT
0.55 ns

Aether's slowest run against EnTT's fastest. Same machine, same build flags.

Start from a working game

14 example games in the box

walker

Movement with prediction. The four-line world above.

arena · raid · arpg

Combat, bosses, loot and lag-compensated hits.

kart · driving

Fast vehicles, laps and tight corrections.

duel

A turn-based card game with no prediction at all, in 20 lines.

farm · chests

Worlds that survive a restart: crops, gold, inventories.

portals · tag · assemble

Zones, server-only state and crowds in one place.

Your first multiplayer world, today

The API fits on one page, with code you can paste.