player connect-disconnect

This commit is contained in:
Vladislav Khorev committed 2026-11-06 22:07:47 +06:00
1 parent 3f68a8ba07
commit 2e6b93f3ac
16 files changed
+305 -62

No files matched your search

+17 -2
View File
@@ -5,6 +5,7 @@
#include <cstdint>
#include <map>
#include <string>
#include <variant>
#include <vector>
namespace FRG {
@@ -33,9 +34,20 @@ struct ScheduledDestinationCommand {
Eigen::Vector3f target = Eigen::Vector3f::Zero();
};
struct ScheduledCharacterEnabledCommand {
std::uint64_t commandSequence = 0;
std::string locationId;
std::string characterId;
bool enabled = false;
};
using ScheduledCommand = std::variant<
ScheduledDestinationCommand,
ScheduledCharacterEnabledCommand>;
struct TickMessage {
std::uint64_t tickId = 0;
std::vector<ScheduledDestinationCommand> commands;
std::vector<ScheduledCommand> commands;
std::string stateHash;
};
@@ -48,13 +60,16 @@ public:
std::uint64_t currentTick() const { return currentTick_; }
std::uint64_t schedule(
const std::string& playerId, const Eigen::Vector3f& target);
std::uint64_t scheduleCharacterEnabled(
const std::string& locationId, const std::string& characterId,
bool enabled);
TickMessage advance();
private:
std::uint32_t inputDelayTicks_;
std::uint64_t currentTick_ = 0;
std::uint64_t nextCommandSequence_ = 1;
std::map<std::uint64_t, std::vector<ScheduledDestinationCommand>> pending_;
std::map<std::uint64_t, std::vector<ScheduledCommand>> pending_;
};
std::string makeInitialStateMessage(const InitialStateMessage& message);