fill client holes (lockstep)
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user