fill client holes (lockstep)

This commit is contained in:
2025-08-07 10:53:00 +02:00
parent c813c49707
commit ba84864b6a
9 changed files with 95 additions and 22 deletions

View File

@@ -49,8 +49,8 @@ class ClientHandler : public td::protocol::PacketHandler {
m_Simulation.Handle(a_LockStep);
}
void Handle(const td::protocol::packets::PredictCommandPacket& a_Predict) {
m_Simulation.Handle(a_Predict);
void Handle(const td::protocol::packets::LockStepResponsePacket& a_LockStep) {
m_Simulation.Handle(a_LockStep);
}
};
@@ -125,6 +125,10 @@ int main(int argc, char** argv) {
td::sim::ClientSimulation simulation(*clientWorld, td::STEP_TIME);
ClientHandler clientHandler(simulation);
simulation.OnMissingLockSteps.Connect([&fakeSocket](const std::vector<td::StepTime>& a_MissingSteps){
fakeSocket->OnReceive(0, td::protocol::packets::LockStepRequestPacket(a_MissingSteps));
});
// temporary tests
display.OnKeyDown.Connect([&fakeSocket](SDL_Keycode key) {
if (key == SDLK_A) {
@@ -134,6 +138,7 @@ int main(int argc, char** argv) {
}
});
// make a fake player join
fakeSocket->ConnectFakePeer(0);
// packets from the server to the client