Added battles in networking
This commit is contained in:
1 parent
be8ee31f03
commit
40527f10ac
8 files changed
+302
-36
No files matched your search
@@ -104,6 +104,55 @@ int main()
|
||||
}),
|
||||
"client did not consume finalized lockstep ticks");
|
||||
|
||||
client->submit(FRG::SetCharacterTargetCommand{
|
||||
"stale_location", "spoofed_character", "hostile_npc"});
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(20));
|
||||
server.update();
|
||||
server.update();
|
||||
require(
|
||||
waitFor([&]() {
|
||||
client->update(0);
|
||||
secondClient->update(0);
|
||||
return client->snapshot()->players.at("player").state.attackTargetId ==
|
||||
"hostile_npc" &&
|
||||
secondClient->snapshot()->players.at("player").state.attackTargetId ==
|
||||
"hostile_npc" &&
|
||||
authoritative.snapshot()->players.at("player").state.attackTargetId ==
|
||||
"hostile_npc";
|
||||
}),
|
||||
"target command was not delayed and rebroadcast");
|
||||
|
||||
client->submit(FRG::ClearCharacterAttackTargetCommand{
|
||||
"stale_location", "spoofed_character"});
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(20));
|
||||
server.update();
|
||||
server.update();
|
||||
require(
|
||||
waitFor([&]() {
|
||||
client->update(0);
|
||||
secondClient->update(0);
|
||||
return client->snapshot()->players.at("player").state.attackTargetId.empty() &&
|
||||
secondClient->snapshot()->players.at("player").state.attackTargetId.empty() &&
|
||||
authoritative.snapshot()->players.at("player").state.attackTargetId.empty();
|
||||
}),
|
||||
"clear attack target command was not delayed and rebroadcast");
|
||||
|
||||
client->submit(FRG::TryCharacterAttackComboCommand{
|
||||
"stale_location", "spoofed_character"});
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(20));
|
||||
server.update();
|
||||
server.update();
|
||||
require(
|
||||
waitFor([&]() {
|
||||
client->update(0);
|
||||
secondClient->update(0);
|
||||
return client->snapshot()->revision ==
|
||||
secondClient->snapshot()->revision &&
|
||||
client->snapshot()->revision ==
|
||||
authoritative.snapshot()->revision;
|
||||
}),
|
||||
"attack combo command was not rebroadcast in lockstep");
|
||||
|
||||
secondClient.reset();
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(50));
|
||||
server.update();
|
||||
|
||||
Reference in new issue
Block a user