#1 - ClientWorldController refactoring
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user