This commit is contained in:
2024-10-25 17:12:13 +02:00
parent c0473e5a65
commit cd03175b98
12 changed files with 143 additions and 16 deletions

View File

@@ -9,12 +9,10 @@ namespace game {
class GameHistory {
private:
using HistorySizeType = std::uint16_t;
using HistorySizeType = StepsType;
std::vector<std::optional<protocol::LockStep>> m_History;
HistorySizeType m_Cursor;
public:
GameHistory();
@@ -24,10 +22,6 @@ class GameHistory {
bool HasLockStep(HistorySizeType a_Index) const;
const protocol::LockStep& GetNextStep();
bool HasNextStep() const;
void FromPacket(td::protocol::pdata::LockSteps&& a_Steps);
td::protocol::packets::LockSteps ToPacket(HistorySizeType a_StartIndex);

27
include/td/game/World.h Normal file
View File

@@ -0,0 +1,27 @@
#pragma once
#include <td/game/GameHistory.h>
#include <td/game/WorldState.h>
#include <vector>
namespace td {
namespace game {
class World {
private:
std::vector<WorldState> m_WorldStates;
GameHistory m_GameHistory;
float m_OffsetTime;
public:
World();
void Tick(float a_Delta);
private:
std::uint16_t GetCursorPos();
};
} // namespace game
} // namespace td

View File

@@ -0,0 +1,21 @@
#pragma once
#include <td/protocol/command/Commands.h>
namespace td {
namespace game {
class WorldState {
private:
// list of players, mobs, towers, castles
public:
WorldState() {}
WorldState GetNextState(const protocol::LockStep& a_Step);
private:
void Tick(float a_Delta);
};
} // namespace game
} // namespace td