Set up basic deterministic lockstep

This commit is contained in:
Vladislav Khorev committed 2026-11-05 23:02:53 +06:00
1 parent 28c6e83eda
commit 23fef6f349
26 files changed
+1172 -239

No files matched your search

+22
View File
@@ -2,6 +2,8 @@
#include "IGameServer.h"
#include "InternalGameServer.h"
#include "NetworkProtocol.h"
#include <map>
#include <memory>
#include <string>
@@ -30,12 +32,32 @@ public:
bool connected() const;
bool connectionFailed() const;
bool initialized() const { return initialized_; }
bool rejected() const { return rejected_; }
private:
friend class RemoteGameServerHost;
struct CompletedSimulationTick {
std::string locationId;
LocationSimulationEvents events;
};
std::vector<CompletedSimulationTick> takeCompletedSimulationTicks();
void expectCompatibility(std::string fingerprint) {
expectedCompatibilityFingerprint_ = std::move(fingerprint);
}
class Impl;
InternalGameServer replica_;
std::unique_ptr<Impl> impl_;
std::map<std::uint64_t, TickMessage> pendingTicks_;
std::vector<CompletedSimulationTick> completedSimulationTicks_;
std::vector<GameServerEvent> pendingEvents_;
std::uint64_t nextExpectedTick_ = 0;
std::uint64_t nextClientSequence_ = 1;
std::string compatibilityFingerprint_;
std::string expectedCompatibilityFingerprint_;
bool initialized_ = false;
bool rejected_ = false;
bool loggedFirstTick_ = false;
};
} // namespace FRG