Set up basic deterministic lockstep
This commit is contained in:
1 parent
28c6e83eda
commit
23fef6f349
26 files changed
+1172
-239
No files matched your search
@@ -3,6 +3,9 @@
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
#include "NetworkProtocol.h"
|
||||
|
||||
namespace FRG {
|
||||
|
||||
@@ -12,6 +15,8 @@ class WebsocketGameServer {
|
||||
public:
|
||||
WebsocketGameServer(
|
||||
InternalGameServer& gameServer,
|
||||
std::vector<std::string> playerSlots,
|
||||
std::string compatibilityFingerprint,
|
||||
const std::string& address = "0.0.0.0",
|
||||
std::uint16_t port = 8080);
|
||||
~WebsocketGameServer();
|
||||
@@ -19,15 +24,15 @@ public:
|
||||
WebsocketGameServer(const WebsocketGameServer&) = delete;
|
||||
WebsocketGameServer& operator=(const WebsocketGameServer&) = delete;
|
||||
|
||||
void update(std::int64_t deltaMs);
|
||||
void broadcastState();
|
||||
void update();
|
||||
std::uint16_t port() const;
|
||||
|
||||
private:
|
||||
class Impl;
|
||||
InternalGameServer& gameServer_;
|
||||
std::unique_ptr<Impl> impl_;
|
||||
std::int64_t broadcastElapsedMs_ = 0;
|
||||
LockstepTimeline timeline_;
|
||||
std::unordered_map<std::string, std::uint64_t> lastClientSequences_;
|
||||
};
|
||||
|
||||
} // namespace FRG
|
||||
Reference in new issue
Block a user