Server implementing the Nimble Protocol.
Nimble Server weaves together authoritative steps from the predicted steps sent by the clients, as well as provide a recently stored game state to joining clients. The game state is provided by one of the clients, since the Nimble Server does not do any simulation.
typedef struct NimbleServerSetup {
NimbleSerializeVersion applicationVersion;
struct ImprintAllocator* memory;
size_t maxParticipantConnectionCount;
size_t maxParticipantCount;
size_t maxSingleParticipantStepOctetCount;
size_t maxParticipantCountForEachConnection;
size_t maxGameStateOctetCount;
DatagramTransportMulti multiTransport;
MonotonicTimeMs now;
Clog log;
} NimbleServerSetup;
int nimbleServerInit(NimbleServer* self, NimbleServerSetup setup);
int nimbleServerUpdate(NimbleServer* self, MonotonicTimeMs now);
if Server Library is used embedded in a client, call nimbleServerMustProvideGameState
every tick:
bool nimbleServerMustProvideGameState(const NimbleServer* self);
and if it returns true, set the latest authoritative state:
void nimbleServerSetGameState(NimbleServer* self, const uint8_t* gameState, size_t gameStateOctetCount, StepId stepId);