#1 - ClientWorldController refactoring

This commit is contained in:
Martin Slachta
2026-08-03 23:30:18 +02:00
parent f4174eb0c7
commit a097f4d4b0
35 changed files with 899 additions and 1010 deletions
+6 -1
View File
@@ -1,4 +1,5 @@
#include "Address.hpp"
#include "Entity.pb.h"
#include "Login.pb.h"
#include "PlayerMove.pb.h"
#include "ProtobufMessages.hpp"
@@ -63,6 +64,9 @@ public:
m_messages.set_handler<mmo::WorldStateMessage>(
[this](tw::msg::PeerId, const mmo::WorldStateMessage& mesg) { });
m_messages.set_handler<mmo::EntitySpawnMessage>(
[this](tw::msg::PeerId, const mmo::EntitySpawnMessage& mesg) { });
m_messages.set_handler<mmo::LoginResponse>(
[this](tw::msg::PeerId, const mmo::LoginResponse& mesg) {
if(!m_is_connected) {
@@ -103,12 +107,13 @@ public:
player_input->set_z(m_velocity.z);
player_move_mesg.set_allocated_input(player_input);
auto r = m_messages.send(m_server, player_move_mesg, false);
m_frame_idx++;
}
}
};
int main() {
const int NUM_CLIENTS = 600;
const int NUM_CLIENTS = 10;
tw::net::Address address = {"127.0.0.1", 8101};
std::vector<std::thread> threads;