FLevelSeedReplication
FLevelSeedReplication — the host's seeds, sent once per level instead of the level. A module level becomes Level Instances whose actor ids derive from the seed and the room, so the clients that build from the same seed hold the same actors under the same ids, which is all replication needs to address them. A client that joins late asks, and the host answers with every seed it has handed out this session.
- Module
- LevelGen
- Header
#include "LevelGen/LevelSeedReplication.h"- Namespace
Mowo
Properties
| Type | Name | Description |
|---|---|---|
static constexpr uint16_t | kSeedEventId | Default 0xFE30. |
static constexpr uint16_t | kSeedRequestEventId | Default 0xFE31. |
Public functions
| Returns | Name | Description |
|---|---|---|
FLevelSeedReplication& | Get | |
ELevelSeedRole | GetRole | |
void | SetRoleOverride | A dedicated driver that runs the session itself can say which side it is; Offline clears the override and the session decides again. |
void | Publish | Host: remember the seed and send it to every client. |
bool | TryGet | Client: the seed the host decided for this generator, once it arrived. |
void | RequestFromHost | Client: ask the host for its seeds (once per session). |
bool | Receive | What the client handler does with an arrived seed; public so a driver that moves bytes itself can hand them in. |
void | Store | |
void | EnsureHandlers | Re-installs the session handlers after a session started (the session drops game handlers on leave). |
void | Clear | |
void | Write | |
bool | Read | |
uint32_t | GetPublishCount | |
uint32_t | GetReceiveCount |
Function details
Get
static FLevelSeedReplication& Get()GetRole
ELevelSeedRole GetRole() constSetRoleOverride
void SetRoleOverride(ELevelSeedRole role, bool enabled)A dedicated driver that runs the session itself can say which side it is; Offline clears the override and the session decides again.
Publish
void Publish(const FLevelSeedRecord& record)Host: remember the seed and send it to every client.
TryGet
bool TryGet(const std::string& generator, FLevelSeedRecord& outRecord) constClient: the seed the host decided for this generator, once it arrived.
RequestFromHost
void RequestFromHost()Client: ask the host for its seeds (once per session).
Receive
bool Receive(FNetEventReader& reader)What the client handler does with an arrived seed; public so a driver that moves bytes itself can hand them in.
Store
void Store(const FLevelSeedRecord& record)EnsureHandlers
void EnsureHandlers()Re-installs the session handlers after a session started (the session drops game handlers on leave). Cheap when they are in place.
Clear
void Clear()Write
static void Write(FNetEventWriter& writer, const FLevelSeedRecord& record)Read
static bool Read(FNetEventReader& reader, FLevelSeedRecord& outRecord)GetPublishCount
uint32_t GetPublishCount() constGetReceiveCount
uint32_t GetReceiveCount() const