Compare commits

...

2 Commits

Author SHA1 Message Date
Martin Slachta ee1cdeaeca #8 - mock client accepts configuration args 2026-08-05 19:00:57 +02:00
Martin Slachta 2508f12e86 chore: removed unnecessary print 2026-08-05 18:38:25 +02:00
2 changed files with 20 additions and 8 deletions
@@ -43,10 +43,6 @@ void EntityPositionInterpolator::interpolate_smoothed_entities(Clock::time_point
m_registry->view<EntityPositionInterpolation, Transform>()
.each([&](const auto entity, const EntityPositionInterpolation& interpolation, Transform& ts) {
auto [from, to, value] = interpolation.get_values_around(time_point);
spdlog::info("From: {} {} {} - To: {} {} {} - By: {}",
from.x, from.y, from.z,
to.x, to.y, to.z,
value);
ts.set_position(glm::mix(from, to, value));
});
}
+20 -4
View File
@@ -112,9 +112,25 @@ public:
}
};
int main() {
const int NUM_CLIENTS = 300;
tw::net::Address address = {"127.0.0.1", 8101};
int main(int argc, char** argv) {
if(argc > 4) {
spdlog::error("Usage: {} [client_count] [host] [port]", argv[0]);
return 1;
}
const uint32_t NUM_CLIENTS = argc > 1 ? std::strtoul(argv[1], nullptr, 10) : 300;
const std::string host = argc > 2 ? argv[2] : "127.0.0.1";
const int port = argc > 3 ? std::atoi(argv[3]) : 8101;
auto address_r = tw::net::Address::resolve(host, port);
if(!address_r) {
spdlog::error("Failed to resolve {}:{}: {}", host, port, address_r.error().message());
return 1;
}
const tw::net::Address address = address_r.value();
spdlog::info("Starting {} clients against {}", NUM_CLIENTS, address.to_string());
std::vector<std::thread> threads;
for(uint32_t i = 0; i < NUM_CLIENTS; i++) {
@@ -129,7 +145,7 @@ int main() {
std::this_thread::sleep_for(std::chrono::milliseconds(10));
}
for(uint32_t i = 0; i < NUM_CLIENTS; i++) {
for(uint32_t i = 0; i < threads.size(); i++) {
threads[i].join();
}