WIP Reliable Message
This commit is contained in:
@@ -29,7 +29,7 @@ public:
|
|||||||
~Client();
|
~Client();
|
||||||
void Start(World* world, EventBroker* eventBroker) override;
|
void Start(World* world, EventBroker* eventBroker) override;
|
||||||
void Update() override;
|
void Update() override;
|
||||||
private:
|
protected:
|
||||||
// Assio UDP logic
|
// Assio UDP logic
|
||||||
boost::asio::ip::udp::endpoint m_ReceiverEndpoint;
|
boost::asio::ip::udp::endpoint m_ReceiverEndpoint;
|
||||||
boost::asio::io_service m_IOService;
|
boost::asio::io_service m_IOService;
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
#ifndef HybridClient_h__
|
||||||
|
#define HybridClient_h__
|
||||||
|
|
||||||
|
#include "Client.h"
|
||||||
|
|
||||||
|
|
||||||
|
class HybridClient : public Client
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
HybridClient(ConfigFile* config);
|
||||||
|
~HybridClient();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
#ifndef TCPClient_h__
|
||||||
|
#define TCPClient_h__
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
+1
-1
@@ -25,7 +25,7 @@
|
|||||||
#include <boost/thread.hpp>
|
#include <boost/thread.hpp>
|
||||||
#include "Network/Network.h"
|
#include "Network/Network.h"
|
||||||
#include "Network/Server.h"
|
#include "Network/Server.h"
|
||||||
#include "Network/Client.h"
|
#include "Network/HybridClient.h"
|
||||||
|
|
||||||
// Sound
|
// Sound
|
||||||
#include "Sound/SoundSystem.h"
|
#include "Sound/SoundSystem.h"
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
#include "Network/HybridClient.h"
|
||||||
|
|
||||||
|
|
||||||
|
HybridClient::HybridClient(ConfigFile * config) : Client(config)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
HybridClient::~HybridClient()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
@@ -271,7 +271,7 @@ void Server::parseOnInputCommand(Packet& packet)
|
|||||||
e.PlayerID = player; // Set correct player id
|
e.PlayerID = player; // Set correct player id
|
||||||
e.Value = packet.ReadPrimitive<float>();
|
e.Value = packet.ReadPrimitive<float>();
|
||||||
m_EventBroker->Publish(e);
|
m_EventBroker->Publish(e);
|
||||||
//LOG_INFO("Server::parseOnInputCommand: Command is %s. Value is %f. PlayerID is %i.", e.Command.c_str(), e.Value, e.PlayerID);
|
LOG_INFO("Server::parseOnInputCommand: Command is %s. Value is %f. PlayerID is %i.", e.Command.c_str(), e.Value, e.PlayerID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -169,7 +169,7 @@ void Game::networkFunction()
|
|||||||
bool isServer = m_Config->Get<bool>("Networking.IsServer", false);
|
bool isServer = m_Config->Get<bool>("Networking.IsServer", false);
|
||||||
if (!isServer) {
|
if (!isServer) {
|
||||||
m_IsClientOrServer = true;
|
m_IsClientOrServer = true;
|
||||||
m_ClientOrServer = new Client(m_Config);
|
m_ClientOrServer = new HybridClient(m_Config);
|
||||||
}
|
}
|
||||||
if (isServer) {
|
if (isServer) {
|
||||||
m_IsClientOrServer = true;
|
m_IsClientOrServer = true;
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ void RayTest(std::string fileName) {
|
|||||||
Ray ray(glm::vec3(-50, 0, 0), glm::vec3(1, 0, 0));
|
Ray ray(glm::vec3(-50, 0, 0), glm::vec3(1, 0, 0));
|
||||||
//using a
|
//using a
|
||||||
|
|
||||||
here, else we have to init the renderingsystem
|
//here, else we have to init the renderingsystem
|
||||||
ResourceManager::RegisterType<RawModel>("RawModel");
|
ResourceManager::RegisterType<RawModel>("RawModel");
|
||||||
auto unitBox = ResourceManager::Load<RawModel>(fileName);
|
auto unitBox = ResourceManager::Load<RawModel>(fileName);
|
||||||
BOOST_REQUIRE(unitBox != nullptr);
|
BOOST_REQUIRE(unitBox != nullptr);
|
||||||
|
|||||||
@@ -69,8 +69,8 @@ GameHealthSystemTest::GameHealthSystemTest()
|
|||||||
m_EventBroker->Publish(e3);
|
m_EventBroker->Publish(e3);
|
||||||
//damage player with 50
|
//damage player with 50
|
||||||
Events::PlayerDamage e;
|
Events::PlayerDamage e;
|
||||||
e.DamageAmount = 50.0f;
|
// e.DamageAmount = 50.0f;
|
||||||
e.PlayerDamagedID = healthsID;
|
// e.PlayerDamagedID = healthsID;
|
||||||
m_EventBroker->Publish(e);
|
m_EventBroker->Publish(e);
|
||||||
//heal some other player with 40
|
//heal some other player with 40
|
||||||
Events::PlayerHealthPickup e2;
|
Events::PlayerHealthPickup e2;
|
||||||
|
|||||||
Reference in New Issue
Block a user