Compare commits
206 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a20ef0504a | |||
| 4e68f9063b | |||
| dbef995627 | |||
| f8f4b4d939 | |||
| 62653cf65d | |||
| 78835f95d8 | |||
| 8a66b1e5c8 | |||
| 3c8df35be9 | |||
| f761416e20 | |||
| 9161c11764 | |||
| a2b938d8f6 | |||
| ab7fd89546 | |||
| 6968e71e07 | |||
| 2fb3bb2a39 | |||
| 6540848392 | |||
| de9657700b | |||
| 4652cd7861 | |||
| 03a35d0f5e | |||
| e4e9af5d9c | |||
| 96768e66de | |||
| ef66f3ebe5 | |||
| 799990f44d | |||
| 39369aa3e5 | |||
| 6eb0b83d6b | |||
| ab40fa715b | |||
| a38c18fd3a | |||
| 9747a201b7 | |||
| 6281e20000 | |||
| f147929aa9 | |||
| aadfdfdd90 | |||
| bba002dea9 | |||
| 15195964da | |||
| b0a66f9e83 | |||
| 7ba5e01560 | |||
| 6d68486c05 | |||
| c60e1ba7e4 | |||
| 63d205f56a | |||
| 36f6ade87a | |||
| 724d7b1586 | |||
| 8cda614de4 | |||
| 77eaa45702 | |||
| dfa224b4dd | |||
| 86df8f14f4 | |||
| eaea645068 | |||
| 21bf7f4df3 | |||
| e2b7e5400d | |||
| 658eace093 | |||
| c106768939 | |||
| c7dad79e72 | |||
| d37f8cc350 | |||
| 3c35c0a956 | |||
| d47a806c64 | |||
| 8e21c5a5e4 | |||
| df7ace6626 | |||
| bef79d116b | |||
| db5170c699 | |||
| bb76c9d248 | |||
| 9cbc6f7755 | |||
| d3a245606a | |||
| b320d8d1e4 | |||
| afddd276a4 | |||
| a48e1b567a | |||
| 62e22d3821 | |||
| 0805375483 | |||
| 0c60b637c3 | |||
| d411de894f | |||
| f56705d921 | |||
| 18450ff4f3 | |||
| 22b473a0b6 | |||
| f161fce719 | |||
| 0343683678 | |||
| 9e6c67596d | |||
| 89d0d5753f | |||
| 748a178801 | |||
| eac9a9daf6 | |||
| 059fe5c6c0 | |||
| fb465ede81 | |||
| f66fa7a183 | |||
| 508d8a6f00 | |||
| cd315bbaa0 | |||
| 8ce6308649 | |||
| f10958c268 | |||
| da1c7b3093 | |||
| ef87102d1f | |||
| 9a41bda4cf | |||
| fc18932068 | |||
| b874ea8641 | |||
| 2609a0253d | |||
| de309d3b9d | |||
| f7ef6707a7 | |||
| feeff5b164 | |||
| 7394436e7a | |||
| f41e0b29be | |||
| 607e83134d | |||
| 5af4f9d8e7 | |||
| af68236e71 | |||
| 6f9ce8a0c1 | |||
| 6465fe6ed6 | |||
| fa13c1d065 | |||
| e2831c5593 | |||
| 8d23c531af | |||
| 91b0ac5fbd | |||
| d77119bb2d | |||
| 27669b7383 | |||
| fc7d62a5ad | |||
| c42e1e0967 | |||
| fe9dbf0b0f | |||
| 4ffb03fdd5 | |||
| fe3e0bac5b | |||
| fa4f007604 | |||
| e5ff88d3c9 | |||
| 845a30ed0f | |||
| 34a71b0767 | |||
| 833006744a | |||
| b2d8cddfb7 | |||
| 6fab971734 | |||
| 2c18068059 | |||
| 09aec08d0e | |||
| ed9149fe63 | |||
| 4cf8c3d8d7 | |||
| 37414ce124 | |||
| adceccf402 | |||
| 4c1a284636 | |||
| 23dc8e07b2 | |||
| c7d31cac2d | |||
| a1e932d261 | |||
| 070f1bd394 | |||
| 993d804cef | |||
| 201480b17f | |||
| bac23f6e8c | |||
| 68f2d5327d | |||
| 2263fd2ad6 | |||
| 2f259c3773 | |||
| 8cc928b5f4 | |||
| 881ce7b02f | |||
| c130fdda5e | |||
| 97fcdb342d | |||
| 4c87ca10b9 | |||
| 22664848dc | |||
| d135ea2da6 | |||
| 949ee76f55 | |||
| 844825813b | |||
| 722b795d37 | |||
| cf2bf4e14d | |||
| 2ac584bafb | |||
| 6e5335a266 | |||
| fc5d054cb2 | |||
| 8c9f4bb84b | |||
| e15a7b9485 | |||
| a141da3d8c | |||
| b81bb9eeea | |||
| ca907b912e | |||
| b2304a95f8 | |||
| 8c92b7ceb6 | |||
| 97499f1c28 | |||
| 64610e3c03 | |||
| 7f489b3569 | |||
| 5dd85d2748 | |||
| 261c2e021e | |||
| 581a7b470c | |||
| c3ed429377 | |||
| c4d3c515e4 | |||
| 7cc58dc94c | |||
| 5e3af7ac5d | |||
| 3e7936ef00 | |||
| 46987beefb | |||
| 8845054965 | |||
| 7dfd68467e | |||
| 4fd0108443 | |||
| 56bc1fee3d | |||
| 52355a63e2 | |||
| 72db672dbf | |||
| 1c9a1a9904 | |||
| 950ecba1c0 | |||
| fdc8f753cb | |||
| e8aff02c4e | |||
| 0d665c10fe | |||
| 23bb1a6405 | |||
| b8222c7b2e | |||
| 43bbc063cf | |||
| f7303ad787 | |||
| 3e4b87da7c | |||
| ac9ce8ea83 | |||
| 99643fd748 | |||
| a6c30100af | |||
| 833015f45e | |||
| 657125b469 | |||
| 456cd35a12 | |||
| 8f28c760dd | |||
| b13362360a | |||
| 0af9edc6e5 | |||
| ec10ef3ffc | |||
| b2a437731e | |||
| 42b49f9dba | |||
| 4b8f1d95a3 | |||
| 8f84a5ddd6 | |||
| 17da9a8036 | |||
| 6bc7131290 | |||
| 4214bf10a1 | |||
| 02cd822cf1 | |||
| f7756ff60f | |||
| 2d5f71e442 | |||
| 2f53ed140f | |||
| 503613907e | |||
| 4bf91ba56a | |||
| 047e71a4e1 |
@@ -16,8 +16,6 @@ struct InputCommand : Event
|
|||||||
std::string Command;
|
std::string Command;
|
||||||
/** The value of the command. */
|
/** The value of the command. */
|
||||||
float Value = 0;
|
float Value = 0;
|
||||||
/** Timestamp of the command. */
|
|
||||||
double TimeStamp = 0;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ public:
|
|||||||
virtual void Reset();
|
virtual void Reset();
|
||||||
|
|
||||||
void AssaultDashCheck(double dt, bool isJumping, double assaultDashCoolDownMaxTimer);
|
void AssaultDashCheck(double dt, bool isJumping, double assaultDashCoolDownMaxTimer);
|
||||||
|
bool SniperSprintingCheck();
|
||||||
virtual bool AssaultDashDoubleTapped() const { return m_AssaultDashDoubleTapped; }
|
virtual bool AssaultDashDoubleTapped() const { return m_AssaultDashDoubleTapped; }
|
||||||
virtual bool PlayerIsDashing() const { return m_PlayerIsDashing; }
|
virtual bool PlayerIsDashing() const { return m_PlayerIsDashing; }
|
||||||
|
|
||||||
@@ -202,7 +203,7 @@ void FirstPersonInputController<EventContext>::AssaultDashCheck(double dt, bool
|
|||||||
}
|
}
|
||||||
|
|
||||||
//dashing with shift
|
//dashing with shift
|
||||||
if (m_ShiftDashing && m_AssaultDashCoolDownTimer <= 0.0f && !isJumping) {
|
if (m_ShiftDashing && m_AssaultDashCoolDownTimer <= 0.0f) {
|
||||||
//player is dashing with shift
|
//player is dashing with shift
|
||||||
//the wanted-direction is set in playermovement already so we dont need to check what direction we want to dash in!
|
//the wanted-direction is set in playermovement already so we dont need to check what direction we want to dash in!
|
||||||
m_AssaultDashCoolDownTimer = assaultDashCoolDownMaxTimer;
|
m_AssaultDashCoolDownTimer = assaultDashCoolDownMaxTimer;
|
||||||
@@ -227,7 +228,7 @@ void FirstPersonInputController<EventContext>::AssaultDashCheck(double dt, bool
|
|||||||
}
|
}
|
||||||
m_ValidDoubleTap = false;
|
m_ValidDoubleTap = false;
|
||||||
|
|
||||||
if (!(m_AssaultDashCoolDownTimer <= 0.0f && !isJumping)) {
|
if (!(m_AssaultDashCoolDownTimer <= 0.0f)) {
|
||||||
//if we cant dash at the moment, then just reset the tap-sensitivity-timer
|
//if we cant dash at the moment, then just reset the tap-sensitivity-timer
|
||||||
m_AssaultDashDoubleTapDeltaTime = 0.f;
|
m_AssaultDashDoubleTapDeltaTime = 0.f;
|
||||||
return;
|
return;
|
||||||
@@ -241,4 +242,12 @@ void FirstPersonInputController<EventContext>::AssaultDashCheck(double dt, bool
|
|||||||
m_EventBroker->Publish(e);
|
m_EventBroker->Publish(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename EventContext>
|
||||||
|
bool FirstPersonInputController<EventContext>::SniperSprintingCheck() {
|
||||||
|
if (m_SpecialAbilityKeyDown) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -33,8 +33,8 @@ public:
|
|||||||
~Client();
|
~Client();
|
||||||
|
|
||||||
void Connect(std::string address, int port);
|
void Connect(std::string address, int port);
|
||||||
void Update(double dt) override;
|
void Update() override;
|
||||||
private:
|
|
||||||
std::vector<Events::PlayerSpawned> m_PlayerSpawnEvents;
|
std::vector<Events::PlayerSpawned> m_PlayerSpawnEvents;
|
||||||
void parseSpawnEvents();
|
void parseSpawnEvents();
|
||||||
// Save for children
|
// Save for children
|
||||||
@@ -56,13 +56,13 @@ private:
|
|||||||
bool m_IsConnected = false;
|
bool m_IsConnected = false;
|
||||||
EntityWrapper m_LocalPlayer = EntityWrapper::Invalid;
|
EntityWrapper m_LocalPlayer = EntityWrapper::Invalid;
|
||||||
// Server Client Lookup map
|
// Server Client Lookup map
|
||||||
|
// Assumes that root node for client and server is EntityID 0.
|
||||||
|
|
||||||
// Don't Add items to these two maps with insert, use insertIntoServerClientMaps(EntityID, EntityID)!!!!
|
// Don't Add items to these two maps with insert, use insertIntoServerClientMaps(EntityID, EntityID)!!!!
|
||||||
std::unordered_map<EntityID, EntityID> m_ServerIDToClientID;
|
std::unordered_map<EntityID, EntityID> m_ServerIDToClientID;
|
||||||
std::unordered_map<EntityID, EntityID> m_ClientIDToServerID;
|
std::unordered_map<EntityID, EntityID> m_ClientIDToServerID;
|
||||||
|
|
||||||
// Network logic
|
// Network logic
|
||||||
UDPClient m_Unreliable;
|
|
||||||
TCPClient m_Reliable;
|
|
||||||
PlayerDefinition m_PlayerDefinitions[8];
|
PlayerDefinition m_PlayerDefinitions[8];
|
||||||
SnapshotDefinitions m_NextSnapshot;
|
SnapshotDefinitions m_NextSnapshot;
|
||||||
double m_DurationOfPingTime;
|
double m_DurationOfPingTime;
|
||||||
@@ -70,9 +70,9 @@ private:
|
|||||||
std::clock_t m_TimeSinceSentInputs;
|
std::clock_t m_TimeSinceSentInputs;
|
||||||
unsigned int m_SendInputIntervalMs;
|
unsigned int m_SendInputIntervalMs;
|
||||||
std::vector<Events::InputCommand> m_InputCommandBuffer;
|
std::vector<Events::InputCommand> m_InputCommandBuffer;
|
||||||
std::vector<Events::InputCommand> m_ReceivedInputCommands;
|
|
||||||
|
|
||||||
// Private member functions
|
// Private member functions
|
||||||
|
size_t receive(char* data);
|
||||||
void disconnect();
|
void disconnect();
|
||||||
void parseMessageType(Packet& packet);
|
void parseMessageType(Packet& packet);
|
||||||
void updateFields(Packet& packet, const ComponentInfo& componentInfo, const EntityID& entityID);
|
void updateFields(Packet& packet, const ComponentInfo& componentInfo, const EntityID& entityID);
|
||||||
@@ -88,8 +88,6 @@ private:
|
|||||||
void parseComponentDeletion(Packet& packet);
|
void parseComponentDeletion(Packet& packet);
|
||||||
void InterpolateFields(Packet & packet, const ComponentInfo & componentInfo, const EntityID & entityID, const std::string & componentType);
|
void InterpolateFields(Packet & packet, const ComponentInfo & componentInfo, const EntityID & entityID, const std::string & componentType);
|
||||||
void parseSnapshot(Packet& packet);
|
void parseSnapshot(Packet& packet);
|
||||||
void parseOnInputCommand(Packet& packet);
|
|
||||||
void publishInputCommands();
|
|
||||||
void identifyPacketLoss();
|
void identifyPacketLoss();
|
||||||
void hasServerTimedOut();
|
void hasServerTimedOut();
|
||||||
EntityID createPlayer();
|
EntityID createPlayer();
|
||||||
@@ -112,6 +110,9 @@ private:
|
|||||||
EventRelay<Client, Events::PlayerSpawned> m_EPlayerSpawned;
|
EventRelay<Client, Events::PlayerSpawned> m_EPlayerSpawned;
|
||||||
bool OnPlayerSpawned(const Events::PlayerSpawned& e);
|
bool OnPlayerSpawned(const Events::PlayerSpawned& e);
|
||||||
void parsePlayerDamage(Packet& packet);
|
void parsePlayerDamage(Packet& packet);
|
||||||
|
private:
|
||||||
|
UDPClient m_Unreliable;
|
||||||
|
TCPClient m_Reliable;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -22,13 +22,11 @@ public:
|
|||||||
Network(World* world, EventBroker* eventBroker);
|
Network(World* world, EventBroker* eventBroker);
|
||||||
virtual ~Network() { };
|
virtual ~Network() { };
|
||||||
|
|
||||||
virtual void Update(double dt) = 0;
|
virtual void Update() = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
World* m_World;
|
World* m_World;
|
||||||
EventBroker* m_EventBroker;
|
EventBroker* m_EventBroker;
|
||||||
// for network
|
|
||||||
double m_TimeStamp = 0;
|
|
||||||
|
|
||||||
// For Debug
|
// For Debug
|
||||||
bool isReadingData = false;
|
bool isReadingData = false;
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ public:
|
|||||||
Server(World* world, EventBroker* eventBroker, int port);
|
Server(World* world, EventBroker* eventBroker, int port);
|
||||||
~Server();
|
~Server();
|
||||||
|
|
||||||
void Update(double dt) override;
|
void Update() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Network channels
|
// Network channels
|
||||||
@@ -52,7 +52,6 @@ private:
|
|||||||
int checkTimeOutInterval = 100;
|
int checkTimeOutInterval = 100;
|
||||||
int m_NextPlayerID = 0;
|
int m_NextPlayerID = 0;
|
||||||
std::vector<Events::InputCommand> m_InputCommandsToBroadcast;
|
std::vector<Events::InputCommand> m_InputCommandsToBroadcast;
|
||||||
std::vector<Events::InputCommand> m_InputCommandsToPublish;
|
|
||||||
//Timers
|
//Timers
|
||||||
std::clock_t m_StartPingTime;
|
std::clock_t m_StartPingTime;
|
||||||
|
|
||||||
@@ -83,7 +82,6 @@ private:
|
|||||||
void parseTCPConnect(Packet & packet);
|
void parseTCPConnect(Packet & packet);
|
||||||
void parseDisconnect();
|
void parseDisconnect();
|
||||||
bool shouldSendToClient(EntityWrapper childEntity);
|
bool shouldSendToClient(EntityWrapper childEntity);
|
||||||
void publishInputCommands();
|
|
||||||
|
|
||||||
// Debug event
|
// Debug event
|
||||||
EventRelay<Server, Events::InputCommand> m_EInputCommand;
|
EventRelay<Server, Events::InputCommand> m_EInputCommand;
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
#ifndef BoostSystem_h__
|
||||||
|
#define BoostSystem_h__
|
||||||
|
|
||||||
|
#include "Core/System.h"
|
||||||
|
#include "Core/ResourceManager.h"
|
||||||
|
#include "Core/EntityFileParser.h"
|
||||||
|
#include "Core/EPlayerDamage.h"
|
||||||
|
#include "Common.h"
|
||||||
|
|
||||||
|
class BoostSystem : public System
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
BoostSystem(SystemParams params);
|
||||||
|
|
||||||
|
private:
|
||||||
|
EventRelay<BoostSystem, Events::PlayerDamage> m_EPlayerDamage;
|
||||||
|
bool OnPlayerDamage(Events::PlayerDamage& e);
|
||||||
|
|
||||||
|
std::string DetermineClass(EntityWrapper player);
|
||||||
|
};
|
||||||
|
#endif
|
||||||
@@ -39,5 +39,5 @@ private:
|
|||||||
bool OnPlayerSpawned(Events::PlayerSpawned& e);
|
bool OnPlayerSpawned(Events::PlayerSpawned& e);
|
||||||
|
|
||||||
void updateMovementControllers(double dt);
|
void updateMovementControllers(double dt);
|
||||||
void updateVelocity(EntityWrapper player, double dt);
|
void updateVelocity(double dt);
|
||||||
};
|
};
|
||||||
@@ -35,7 +35,12 @@
|
|||||||
<xs:include schemaLocation="Components/AmmoPickup.xsd"/>
|
<xs:include schemaLocation="Components/AmmoPickup.xsd"/>
|
||||||
<xs:include schemaLocation="Components/AnimationOffset.xsd"/>
|
<xs:include schemaLocation="Components/AnimationOffset.xsd"/>
|
||||||
<xs:include schemaLocation="Components/DashAbility.xsd"/>
|
<xs:include schemaLocation="Components/DashAbility.xsd"/>
|
||||||
|
<xs:include schemaLocation="Components/ShieldAbility.xsd"/>
|
||||||
|
<xs:include schemaLocation="Components/SprintAbility.xsd"/>
|
||||||
<xs:include schemaLocation="Components/AssaultWeapon.xsd"/>
|
<xs:include schemaLocation="Components/AssaultWeapon.xsd"/>
|
||||||
|
<xs:include schemaLocation="Components/BoostAssault.xsd"/>
|
||||||
|
<xs:include schemaLocation="Components/BoostDefender.xsd"/>
|
||||||
|
<xs:include schemaLocation="Components/BoostSniper.xsd"/>
|
||||||
<xs:include schemaLocation="Components/Shield.xsd"/>
|
<xs:include schemaLocation="Components/Shield.xsd"/>
|
||||||
<xs:include schemaLocation="Components/Sprite.xsd"/>
|
<xs:include schemaLocation="Components/Sprite.xsd"/>
|
||||||
<xs:include schemaLocation="Components/Shielded.xsd"/>
|
<xs:include schemaLocation="Components/Shielded.xsd"/>
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||||
|
<BoostAssault xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="BoostAssault.xsd">
|
||||||
|
<StrengthOfEffect>2</StrengthOfEffect>
|
||||||
|
</BoostAssault>
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
|
||||||
|
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:t="types">
|
||||||
|
<xs:import schemaLocation="../Types.xsd" namespace="types"/>
|
||||||
|
|
||||||
|
<xs:element name="BoostAssault">
|
||||||
|
<xs:annotation>
|
||||||
|
<xs:documentation>This is the assault's class boost component</xs:documentation>
|
||||||
|
</xs:annotation>
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:all>
|
||||||
|
<xs:element name="StrengthOfEffect" type="t:double" minOccurs="0">
|
||||||
|
<xs:annotation><xs:documentation>This is the strength of the boost effect</xs:documentation></xs:annotation>
|
||||||
|
</xs:element>
|
||||||
|
</xs:all>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
</xs:schema>
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||||
|
<BoostDefender xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="BoostDefender.xsd">
|
||||||
|
<StrengthOfEffect>10</StrengthOfEffect>
|
||||||
|
</BoostDefender>
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
|
||||||
|
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:t="types">
|
||||||
|
<xs:import schemaLocation="../Types.xsd" namespace="types"/>
|
||||||
|
|
||||||
|
<xs:element name="BoostDefender">
|
||||||
|
<xs:annotation>
|
||||||
|
<xs:documentation>This is the defender's class boost component</xs:documentation>
|
||||||
|
</xs:annotation>
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:all>
|
||||||
|
<xs:element name="StrengthOfEffect" type="t:double" minOccurs="0">
|
||||||
|
<xs:annotation><xs:documentation>This is the strength of the boost effect</xs:documentation></xs:annotation>
|
||||||
|
</xs:element>
|
||||||
|
</xs:all>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
</xs:schema>
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||||
|
<BoostSniper xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="BoostSniper.xsd">
|
||||||
|
<StrengthOfEffect>10</StrengthOfEffect>
|
||||||
|
</BoostSniper>
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
|
||||||
|
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:t="types">
|
||||||
|
<xs:import schemaLocation="../Types.xsd" namespace="types"/>
|
||||||
|
|
||||||
|
<xs:element name="BoostSniper">
|
||||||
|
<xs:annotation>
|
||||||
|
<xs:documentation>This is the sniper's class boost component</xs:documentation>
|
||||||
|
</xs:annotation>
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:all>
|
||||||
|
<xs:element name="StrengthOfEffect" type="t:double" minOccurs="0">
|
||||||
|
<xs:annotation><xs:documentation>This is the strength of the boost effect</xs:documentation></xs:annotation>
|
||||||
|
</xs:element>
|
||||||
|
</xs:all>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
</xs:schema>
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||||
|
<ShieldAbility xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="ShieldAbility.xsd">
|
||||||
|
<CoolDownMaxTimer>2.0</CoolDownMaxTimer>
|
||||||
|
</ShieldAbility>
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
|
||||||
|
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:t="types">
|
||||||
|
<xs:import schemaLocation="../Types.xsd" namespace="types"/>
|
||||||
|
|
||||||
|
<xs:element name="ShieldAbility">
|
||||||
|
<xs:annotation>
|
||||||
|
<xs:documentation>A shield component for one of the classes</xs:documentation>
|
||||||
|
</xs:annotation>
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:all>
|
||||||
|
<xs:element name="CoolDownMaxTimer" type="t:double" minOccurs="0">
|
||||||
|
<xs:annotation><xs:documentation>This is the cooldown on shield</xs:documentation></xs:annotation>
|
||||||
|
</xs:element>
|
||||||
|
</xs:all>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
</xs:schema>
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||||
|
<SprintAbility xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="SprintAbility.xsd">
|
||||||
|
<StrengthOfEffect>2.0</StrengthOfEffect>
|
||||||
|
</SprintAbility>
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
|
||||||
|
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:t="types">
|
||||||
|
<xs:import schemaLocation="../Types.xsd" namespace="types"/>
|
||||||
|
|
||||||
|
<xs:element name="SprintAbility">
|
||||||
|
<xs:annotation>
|
||||||
|
<xs:documentation>A sprint component for one of the classes</xs:documentation>
|
||||||
|
</xs:annotation>
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:all>
|
||||||
|
<xs:element name="StrengthOfEffect" type="t:double" minOccurs="0">
|
||||||
|
<xs:annotation><xs:documentation>This is the strength of the sprint effect</xs:documentation></xs:annotation>
|
||||||
|
</xs:element>
|
||||||
|
</xs:all>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
</xs:schema>
|
||||||
@@ -5,10 +5,15 @@
|
|||||||
<c:AABB/>
|
<c:AABB/>
|
||||||
<c:AmmoPickup/>
|
<c:AmmoPickup/>
|
||||||
<c:Model>
|
<c:Model>
|
||||||
<Resource>Models/Core/UnitSphere.mesh</Resource>
|
<Resource>Models/Props/PickUps/AmmoPickUp.mesh</Resource>
|
||||||
</c:Model>
|
</c:Model>
|
||||||
|
<c:RaptorCopter>
|
||||||
|
<Speed>0.1</Speed>
|
||||||
|
<Axis X="0" Y="1" Z="0"/>
|
||||||
|
</c:RaptorCopter>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0" Y="1" Z="0"/>
|
<Position X="0" Y="1" Z="0"/>
|
||||||
|
<Scale X="0.3" Y="0.3" Z="0.3"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
<c:Trigger/>
|
<c:Trigger/>
|
||||||
</Components>
|
</Components>
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||||
|
<Entity xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
|
||||||
|
|
||||||
|
<Components>
|
||||||
|
<c:BoostAssault/>
|
||||||
|
<c:Lifetime>
|
||||||
|
<Lifetime>10</Lifetime>
|
||||||
|
</c:Lifetime>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
|
||||||
|
<Children/>
|
||||||
|
|
||||||
|
</Entity>
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||||
|
<Entity xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
|
||||||
|
|
||||||
|
<Components>
|
||||||
|
<c:BoostDefender/>
|
||||||
|
<c:Lifetime>
|
||||||
|
<Lifetime>10</Lifetime>
|
||||||
|
</c:Lifetime>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
|
||||||
|
<Children/>
|
||||||
|
|
||||||
|
</Entity>
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||||
|
<Entity xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
|
||||||
|
|
||||||
|
<Components>
|
||||||
|
<c:BoostSniper/>
|
||||||
|
<c:Lifetime>
|
||||||
|
<Lifetime>10</Lifetime>
|
||||||
|
</c:Lifetime>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
|
||||||
|
<Children/>
|
||||||
|
|
||||||
|
</Entity>
|
||||||
@@ -5,10 +5,15 @@
|
|||||||
<c:AABB/>
|
<c:AABB/>
|
||||||
<c:HealthPickup/>
|
<c:HealthPickup/>
|
||||||
<c:Model>
|
<c:Model>
|
||||||
<Resource>Models/Core/UnitSphere.mesh</Resource>
|
<Resource>Models/Props/PickUps/HealthPickUp.mesh</Resource>
|
||||||
</c:Model>
|
</c:Model>
|
||||||
|
<c:RaptorCopter>
|
||||||
|
<Speed>0.1</Speed>
|
||||||
|
<Axis X="0" Y="1" Z="0"/>
|
||||||
|
</c:RaptorCopter>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0" Y="1" Z="0"/>
|
<Position X="0" Y="1" Z="0"/>
|
||||||
|
<Scale X="0.3" Y="0.3" Z="0.3"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
<c:Trigger/>
|
<c:Trigger/>
|
||||||
</Components>
|
</Components>
|
||||||
|
|||||||
@@ -5019,7 +5019,7 @@
|
|||||||
</Team>
|
</Team>
|
||||||
</c:Team>
|
</c:Team>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="-60.3695679" Y="2.14482641" Z="-79.3789597"/>
|
<Position X="-60.3695679" Y="5.14500046" Z="-79.3789597"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children>
|
<Children>
|
||||||
@@ -5089,7 +5089,7 @@
|
|||||||
</Team>
|
</Team>
|
||||||
</c:Team>
|
</c:Team>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="60.0169258" Y="2.37972379" Z="76.2893906"/>
|
<Position X="60.0169258" Y="6.0800004" Z="76.2893906"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children>
|
<Children>
|
||||||
@@ -5165,7 +5165,7 @@
|
|||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="48.9189453" Y="7.06223536" Z="-78.9347992"/>
|
<Position X="48.9189453" Y="7.06223536" Z="-78.9347992"/>
|
||||||
<Scale X="0.300000012" Y="0.300000012" Z="0.300000012"/>
|
<Scale X="0.300000012" Y="0.300000012" Z="0.300000012"/>
|
||||||
<Orientation X="0" Y="71.4059677" Z="0"/>
|
<Orientation X="0" Y="74.6042328" Z="0"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
<c:Trigger/>
|
<c:Trigger/>
|
||||||
</Components>
|
</Components>
|
||||||
@@ -5184,7 +5184,7 @@
|
|||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="-59.3499641" Y="7.46932745" Z="-20.6276321"/>
|
<Position X="-59.3499641" Y="7.46932745" Z="-20.6276321"/>
|
||||||
<Scale X="0.300000012" Y="0.300000012" Z="0.300000012"/>
|
<Scale X="0.300000012" Y="0.300000012" Z="0.300000012"/>
|
||||||
<Orientation X="0" Y="68.0603104" Z="0"/>
|
<Orientation X="0" Y="71.2585754" Z="0"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
<c:Trigger/>
|
<c:Trigger/>
|
||||||
</Components>
|
</Components>
|
||||||
@@ -5203,7 +5203,7 @@
|
|||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="-1.13644195" Y="1.38919806" Z="38.9768829"/>
|
<Position X="-1.13644195" Y="1.38919806" Z="38.9768829"/>
|
||||||
<Scale X="0.300000012" Y="0.300000012" Z="0.300000012"/>
|
<Scale X="0.300000012" Y="0.300000012" Z="0.300000012"/>
|
||||||
<Orientation X="0" Y="65.6683426" Z="0"/>
|
<Orientation X="0" Y="68.8666077" Z="0"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
<c:Trigger/>
|
<c:Trigger/>
|
||||||
</Components>
|
</Components>
|
||||||
@@ -5222,7 +5222,7 @@
|
|||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="54.7225227" Y="6.51863909" Z="29.0052128"/>
|
<Position X="54.7225227" Y="6.51863909" Z="29.0052128"/>
|
||||||
<Scale X="0.300000012" Y="0.300000012" Z="0.300000012"/>
|
<Scale X="0.300000012" Y="0.300000012" Z="0.300000012"/>
|
||||||
<Orientation X="0" Y="65.9822693" Z="0"/>
|
<Orientation X="0" Y="69.180542" Z="0"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
<c:Trigger/>
|
<c:Trigger/>
|
||||||
</Components>
|
</Components>
|
||||||
@@ -5241,7 +5241,7 @@
|
|||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="-51.6792374" Y="8.44526482" Z="32.5153465"/>
|
<Position X="-51.6792374" Y="8.44526482" Z="32.5153465"/>
|
||||||
<Scale X="0.300000012" Y="0.300000012" Z="0.300000012"/>
|
<Scale X="0.300000012" Y="0.300000012" Z="0.300000012"/>
|
||||||
<Orientation X="0" Y="65.4309921" Z="0"/>
|
<Orientation X="0" Y="68.6292572" Z="0"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
<c:Trigger/>
|
<c:Trigger/>
|
||||||
</Components>
|
</Components>
|
||||||
@@ -5260,7 +5260,7 @@
|
|||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="-42.3974304" Y="7.28327894" Z="81.9305344"/>
|
<Position X="-42.3974304" Y="7.28327894" Z="81.9305344"/>
|
||||||
<Scale X="0.300000012" Y="0.300000012" Z="0.300000012"/>
|
<Scale X="0.300000012" Y="0.300000012" Z="0.300000012"/>
|
||||||
<Orientation X="0" Y="63.560215" Z="0"/>
|
<Orientation X="0" Y="66.7584839" Z="0"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
<c:Trigger/>
|
<c:Trigger/>
|
||||||
</Components>
|
</Components>
|
||||||
@@ -5279,7 +5279,7 @@
|
|||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="-9.85184956" Y="8.25567532" Z="39.6119232"/>
|
<Position X="-9.85184956" Y="8.25567532" Z="39.6119232"/>
|
||||||
<Scale X="0.300000012" Y="0.300000012" Z="0.300000012"/>
|
<Scale X="0.300000012" Y="0.300000012" Z="0.300000012"/>
|
||||||
<Orientation X="0" Y="62.6090584" Z="0"/>
|
<Orientation X="0" Y="65.8073425" Z="0"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
<c:Trigger/>
|
<c:Trigger/>
|
||||||
</Components>
|
</Components>
|
||||||
@@ -5298,7 +5298,7 @@
|
|||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="49.2257118" Y="7.39368248" Z="-31.1810112"/>
|
<Position X="49.2257118" Y="7.39368248" Z="-31.1810112"/>
|
||||||
<Scale X="0.300000012" Y="0.300000012" Z="0.300000012"/>
|
<Scale X="0.300000012" Y="0.300000012" Z="0.300000012"/>
|
||||||
<Orientation X="0" Y="59.8201942" Z="0"/>
|
<Orientation X="0" Y="63.0184822" Z="0"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
<c:Trigger/>
|
<c:Trigger/>
|
||||||
</Components>
|
</Components>
|
||||||
|
|||||||
@@ -43,6 +43,8 @@ EditorSystem::EditorSystem(SystemParams params, IRenderer* renderer, RenderFrame
|
|||||||
m_Enabled = ResourceManager::Load<ConfigFile>("Config.ini")->Get<bool>("Debug.EditorEnabled", false);
|
m_Enabled = ResourceManager::Load<ConfigFile>("Config.ini")->Get<bool>("Debug.EditorEnabled", false);
|
||||||
if (m_Enabled) {
|
if (m_Enabled) {
|
||||||
Enable();
|
Enable();
|
||||||
|
} else {
|
||||||
|
Disable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -41,11 +41,9 @@ void Client::Connect(std::string address, int port)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Client::Update(double dt)
|
void Client::Update()
|
||||||
{
|
{
|
||||||
m_EventBroker->Process<Client>();
|
m_EventBroker->Process<Client>();
|
||||||
//m_TimeStamp += dt;
|
|
||||||
publishInputCommands();
|
|
||||||
while (m_Unreliable.IsSocketAvailable()) {
|
while (m_Unreliable.IsSocketAvailable()) {
|
||||||
// Packet will get real data in receive
|
// Packet will get real data in receive
|
||||||
Packet packet(MessageType::Invalid);
|
Packet packet(MessageType::Invalid);
|
||||||
@@ -74,8 +72,7 @@ void Client::Update(double dt)
|
|||||||
sendInputCommands();
|
sendInputCommands();
|
||||||
m_TimeSinceSentInputs = std::clock();
|
m_TimeSinceSentInputs = std::clock();
|
||||||
}
|
}
|
||||||
// HACK: Send absolute player positions for now to avoid desync until we have reliable messages.
|
// HACK: Send absolute player positions for now to avoid desync until we have reliable messages
|
||||||
// Reliable messages and timestamps did not fix it.
|
|
||||||
sendLocalPlayerTransform();
|
sendLocalPlayerTransform();
|
||||||
|
|
||||||
hasServerTimedOut();
|
hasServerTimedOut();
|
||||||
@@ -125,9 +122,6 @@ void Client::parseMessageType(Packet& packet)
|
|||||||
case MessageType::OnPlayerDamage:
|
case MessageType::OnPlayerDamage:
|
||||||
parsePlayerDamage(packet);
|
parsePlayerDamage(packet);
|
||||||
break;
|
break;
|
||||||
case MessageType::OnInputCommand:
|
|
||||||
//parsePlayerDamage(packet);
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -290,30 +284,21 @@ void Client::ignoreFields(Packet& packet, const ComponentInfo& componentInfo)
|
|||||||
|
|
||||||
void Client::parseSnapshot(Packet& packet)
|
void Client::parseSnapshot(Packet& packet)
|
||||||
{
|
{
|
||||||
//// Read input commands
|
// Read input commands
|
||||||
//std::size_t numInputCommands = packet.ReadPrimitive<std::size_t>();
|
std::size_t numInputCommands = packet.ReadPrimitive<std::size_t>();
|
||||||
//for (std::size_t i = 0; i < numInputCommands; ++i) {
|
for (std::size_t i = 0; i < numInputCommands; ++i) {
|
||||||
// Events::InputCommand e;
|
Events::InputCommand e;
|
||||||
// e.PlayerID = packet.ReadPrimitive<EntityID>();
|
e.PlayerID = packet.ReadPrimitive<EntityID>();
|
||||||
// EntityID player = packet.ReadPrimitive<EntityID>();
|
EntityID player = packet.ReadPrimitive<EntityID>();
|
||||||
// std::string command = packet.ReadString();
|
std::string command = packet.ReadString();
|
||||||
// float value = packet.ReadPrimitive<float>();
|
float value = packet.ReadPrimitive<float>();
|
||||||
// double timestamp = packet.ReadPrimitive<double>();
|
if (m_ServerIDToClientID.find(player) != m_ServerIDToClientID.end()) {
|
||||||
// if (m_ServerIDToClientID.find(player) != m_ServerIDToClientID.end()) {
|
e.Player = EntityWrapper(m_World, m_ServerIDToClientID.at(player));
|
||||||
// e.Player = EntityWrapper(m_World, m_ServerIDToClientID.at(player));
|
e.Command = command;
|
||||||
// e.Command = command;
|
e.Value = value;
|
||||||
// e.Value = value;
|
m_EventBroker->Publish(e);
|
||||||
// e.TimeStamp = timestamp;
|
}
|
||||||
// m_EventBroker->Publish(e);
|
}
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
// Read timestamp
|
|
||||||
double remoteTimestamp = packet.ReadPrimitive<double>();
|
|
||||||
//if (abs(remoteTimestamp - m_TimeStamp) > 0.100) {
|
|
||||||
// m_TimeStamp = remoteTimestamp;
|
|
||||||
// LOG_INFO("Resynced remote and local timestamp");
|
|
||||||
//}
|
|
||||||
|
|
||||||
// Read world state
|
// Read world state
|
||||||
while (packet.DataReadSize() < packet.Size()) {
|
while (packet.DataReadSize() < packet.Size()) {
|
||||||
@@ -374,36 +359,6 @@ void Client::parseSnapshot(Packet& packet)
|
|||||||
parseSpawnEvents();
|
parseSpawnEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Client::parseOnInputCommand(Packet & packet)
|
|
||||||
{
|
|
||||||
while (packet.DataReadSize() < packet.Size()) {
|
|
||||||
Events::InputCommand e;
|
|
||||||
e.PlayerID = packet.ReadPrimitive<int>();
|
|
||||||
e.Player = EntityWrapper(m_World, packet.ReadPrimitive<int>());
|
|
||||||
e.Command = packet.ReadString();
|
|
||||||
e.Value = packet.ReadPrimitive<float>();
|
|
||||||
e.TimeStamp = packet.ReadPrimitive<double>();
|
|
||||||
m_EventBroker->Publish(e);
|
|
||||||
m_ReceivedInputCommands.push_back(e);
|
|
||||||
//LOG_INFO("Server::parseOnInputCommand: Command is %s. Value is %f. PlayerID is %i.", e.Command.c_str(), e.Value, e.PlayerID);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Client::publishInputCommands()
|
|
||||||
{
|
|
||||||
std::vector<Events::InputCommand> notPublishedEvents;
|
|
||||||
for (int i = 0; i < m_ReceivedInputCommands.size(); i++) {
|
|
||||||
if (m_ReceivedInputCommands.at(i).TimeStamp < m_TimeStamp) {
|
|
||||||
m_EventBroker->Publish(m_ReceivedInputCommands.at(i));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
notPublishedEvents.push_back(m_ReceivedInputCommands.at(i));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
m_ReceivedInputCommands = notPublishedEvents;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Client::disconnect()
|
void Client::disconnect()
|
||||||
{
|
{
|
||||||
m_IsConnected = false;
|
m_IsConnected = false;
|
||||||
@@ -447,9 +402,7 @@ bool Client::OnInputCommand(const Events::InputCommand & e)
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (m_IsConnected) {
|
if (m_IsConnected) {
|
||||||
Events::InputCommand setTimestamp = e;
|
m_InputCommandBuffer.push_back(e);
|
||||||
setTimestamp.TimeStamp = m_TimeStamp;
|
|
||||||
m_InputCommandBuffer.push_back(setTimestamp);
|
|
||||||
}
|
}
|
||||||
//LOG_DEBUG("Client::OnInputCommand: Command is %s. Value is %f. PlayerID is %i.", e.Command.c_str(), e.Value, e.PlayerID);
|
//LOG_DEBUG("Client::OnInputCommand: Command is %s. Value is %f. PlayerID is %i.", e.Command.c_str(), e.Value, e.PlayerID);
|
||||||
return true;
|
return true;
|
||||||
@@ -484,12 +437,11 @@ void Client::parsePlayerDamage(Packet& packet)
|
|||||||
{
|
{
|
||||||
Events::PlayerDamage e;
|
Events::PlayerDamage e;
|
||||||
PlayerID victimID = packet.ReadPrimitive<EntityID>();
|
PlayerID victimID = packet.ReadPrimitive<EntityID>();
|
||||||
PlayerID inflictorID = packet.ReadPrimitive<EntityID>();
|
if(serverClientMapsHasEntity(victimID)){
|
||||||
if(!serverClientMapsHasEntity(victimID) || !serverClientMapsHasEntity(inflictorID)){
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
e.Inflictor = EntityWrapper(m_World, m_ServerIDToClientID.at(victimID));
|
e.Inflictor = EntityWrapper(m_World, m_ServerIDToClientID.at(victimID));
|
||||||
e.Victim = EntityWrapper(m_World, m_ServerIDToClientID.at(inflictorID));
|
e.Victim = EntityWrapper(m_World, m_ServerIDToClientID.at(packet.ReadPrimitive<EntityID>()));
|
||||||
e.Damage = packet.ReadPrimitive<double>();
|
e.Damage = packet.ReadPrimitive<double>();
|
||||||
// Don't rebroadcast our own player damage events or we'll have an infinite loop!
|
// Don't rebroadcast our own player damage events or we'll have an infinite loop!
|
||||||
if (e.Inflictor != m_LocalPlayer) {
|
if (e.Inflictor != m_LocalPlayer) {
|
||||||
@@ -563,7 +515,6 @@ void Client::sendInputCommands()
|
|||||||
for (int i = 0; i < m_InputCommandBuffer.size(); i++) {
|
for (int i = 0; i < m_InputCommandBuffer.size(); i++) {
|
||||||
packet.WriteString(m_InputCommandBuffer[i].Command);
|
packet.WriteString(m_InputCommandBuffer[i].Command);
|
||||||
packet.WritePrimitive(m_InputCommandBuffer[i].Value);
|
packet.WritePrimitive(m_InputCommandBuffer[i].Value);
|
||||||
packet.WritePrimitive(m_InputCommandBuffer[i].TimeStamp);
|
|
||||||
}
|
}
|
||||||
m_Reliable.Send(packet);
|
m_Reliable.Send(packet);
|
||||||
m_InputCommandBuffer.clear();
|
m_InputCommandBuffer.clear();
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ Network::Network(World* world, EventBroker* eventBroker)
|
|||||||
m_TimeoutMs = config->Get<int>("Networking.TimeoutMs", 20000);
|
m_TimeoutMs = config->Get<int>("Networking.TimeoutMs", 20000);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Network::Update(double dt)
|
void Network::Update()
|
||||||
{
|
{
|
||||||
updateNetworkData();
|
updateNetworkData();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,12 +26,10 @@ Server::~Server()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Server::Update(double dt)
|
void Server::Update()
|
||||||
{
|
{
|
||||||
m_EventBroker->Process<Server>();
|
|
||||||
m_TimeStamp += dt;
|
|
||||||
publishInputCommands();
|
|
||||||
PlayerDefinition pd;
|
PlayerDefinition pd;
|
||||||
|
|
||||||
m_Reliable.AcceptNewConnections(m_NextPlayerID, m_ConnectedPlayers);
|
m_Reliable.AcceptNewConnections(m_NextPlayerID, m_ConnectedPlayers);
|
||||||
for (auto& kv : m_ConnectedPlayers) {
|
for (auto& kv : m_ConnectedPlayers) {
|
||||||
while (kv.second.TCPSocket->available()) {
|
while (kv.second.TCPSocket->available()) {
|
||||||
@@ -82,9 +80,11 @@ void Server::Update(double dt)
|
|||||||
checkForTimeOuts();
|
checkForTimeOuts();
|
||||||
timOutTimer = currentTime;
|
timOutTimer = currentTime;
|
||||||
}
|
}
|
||||||
|
m_EventBroker->Process<Server>();
|
||||||
if (isReadingData) {
|
if (isReadingData) {
|
||||||
Network::Update(dt);
|
Network::Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Server::parseMessageType(Packet& packet)
|
void Server::parseMessageType(Packet& packet)
|
||||||
@@ -146,8 +146,7 @@ void Server::unreliableBroadcast(Packet& packet)
|
|||||||
void Server::sendSnapshot()
|
void Server::sendSnapshot()
|
||||||
{
|
{
|
||||||
Packet packet(MessageType::Snapshot);
|
Packet packet(MessageType::Snapshot);
|
||||||
//addInputCommandsToPacket(packet);
|
addInputCommandsToPacket(packet);
|
||||||
packet.WritePrimitive(m_TimeStamp/*+ somePingvalue + offset*/);
|
|
||||||
addChildrenToPacket(packet, EntityID_Invalid);
|
addChildrenToPacket(packet, EntityID_Invalid);
|
||||||
unreliableBroadcast(packet);
|
unreliableBroadcast(packet);
|
||||||
}
|
}
|
||||||
@@ -161,7 +160,6 @@ void Server::addInputCommandsToPacket(Packet& packet)
|
|||||||
packet.WritePrimitive(m_ConnectedPlayers.at(command.PlayerID).EntityID);
|
packet.WritePrimitive(m_ConnectedPlayers.at(command.PlayerID).EntityID);
|
||||||
packet.WriteString(command.Command);
|
packet.WriteString(command.Command);
|
||||||
packet.WritePrimitive(command.Value);
|
packet.WritePrimitive(command.Value);
|
||||||
packet.WritePrimitive(command.TimeStamp);
|
|
||||||
}
|
}
|
||||||
m_InputCommandsToBroadcast.clear();
|
m_InputCommandsToBroadcast.clear();
|
||||||
}
|
}
|
||||||
@@ -335,7 +333,6 @@ void Server::disconnect(PlayerID playerID)
|
|||||||
e.PlayerID = playerID;
|
e.PlayerID = playerID;
|
||||||
m_EventBroker->Publish(e);
|
m_EventBroker->Publish(e);
|
||||||
//m_World->DeleteEntity(m_ConnectedPlayers[playerID].EntityID);
|
//m_World->DeleteEntity(m_ConnectedPlayers[playerID].EntityID);
|
||||||
// TODO Kolla Anders crashade efter timeout med break point
|
|
||||||
m_ConnectedPlayers[playerID].TCPSocket->shutdown(boost::asio::ip::tcp::socket::shutdown_both);
|
m_ConnectedPlayers[playerID].TCPSocket->shutdown(boost::asio::ip::tcp::socket::shutdown_both);
|
||||||
m_ConnectedPlayers[playerID].TCPSocket->close();
|
m_ConnectedPlayers[playerID].TCPSocket->close();
|
||||||
m_World->DeleteEntity(m_ConnectedPlayers[playerID].EntityID);
|
m_World->DeleteEntity(m_ConnectedPlayers[playerID].EntityID);
|
||||||
@@ -378,7 +375,8 @@ bool Server::OnInputCommand(const Events::InputCommand & e)
|
|||||||
}
|
}
|
||||||
isReadingData = !isReadingData;
|
isReadingData = !isReadingData;
|
||||||
m_SaveDataTimer = std::clock();
|
m_SaveDataTimer = std::clock();
|
||||||
} else if (e.Command == "KickPlayer" && e.Value > 0) {
|
}
|
||||||
|
if (e.Command == "KickPlayer" && e.Value > 0) {
|
||||||
kick(0);
|
kick(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -468,9 +466,7 @@ void Server::parseOnInputCommand(Packet& packet)
|
|||||||
e.PlayerID = player; // Set correct player id
|
e.PlayerID = player; // Set correct player id
|
||||||
e.Player = EntityWrapper(m_World, m_ConnectedPlayers.at(player).EntityID);
|
e.Player = EntityWrapper(m_World, m_ConnectedPlayers.at(player).EntityID);
|
||||||
e.Value = packet.ReadPrimitive<float>();
|
e.Value = packet.ReadPrimitive<float>();
|
||||||
e.TimeStamp = packet.ReadPrimitive<double>();
|
m_EventBroker->Publish(e);
|
||||||
/* m_EventBroker->Publish(e);*/
|
|
||||||
m_InputCommandsToPublish.push_back(e);
|
|
||||||
if (e.Command == "PrimaryFire" || e.Command == "Reload") {
|
if (e.Command == "PrimaryFire" || e.Command == "Reload") {
|
||||||
m_InputCommandsToBroadcast.push_back(e);
|
m_InputCommandsToBroadcast.push_back(e);
|
||||||
}
|
}
|
||||||
@@ -520,20 +516,6 @@ bool Server::shouldSendToClient(EntityWrapper childEntity)
|
|||||||
return childEntity.HasComponent("Player") || childEntity.FirstParentWithComponent("Player").Valid();
|
return childEntity.HasComponent("Player") || childEntity.FirstParentWithComponent("Player").Valid();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Server::publishInputCommands()
|
|
||||||
{
|
|
||||||
std::vector<Events::InputCommand> notPublishedEvents;
|
|
||||||
for (int i = 0; i < m_InputCommandsToPublish.size(); i++) {
|
|
||||||
if (m_InputCommandsToPublish.at(i).TimeStamp < m_TimeStamp) {
|
|
||||||
m_EventBroker->Publish(m_InputCommandsToPublish.at(i));
|
|
||||||
} else {
|
|
||||||
LOG_INFO("Did not instantly publish command");
|
|
||||||
notPublishedEvents.push_back(m_InputCommandsToPublish.at(i));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
m_InputCommandsToPublish = notPublishedEvents;
|
|
||||||
}
|
|
||||||
|
|
||||||
PlayerID Server::GetPlayerIDFromEndpoint()
|
PlayerID Server::GetPlayerIDFromEndpoint()
|
||||||
{
|
{
|
||||||
// check both tcp and udp connection
|
// check both tcp and udp connection
|
||||||
|
|||||||
+4
-2
@@ -26,6 +26,7 @@
|
|||||||
#include "Network/MultiplayerSnapshotFilter.h"
|
#include "Network/MultiplayerSnapshotFilter.h"
|
||||||
#include "Game/Systems/AmmunitionHUDSystem.h"
|
#include "Game/Systems/AmmunitionHUDSystem.h"
|
||||||
#include "Game/Systems/KillFeedSystem.h"
|
#include "Game/Systems/KillFeedSystem.h"
|
||||||
|
#include "Game/Systems/BoostSystem.h"
|
||||||
|
|
||||||
|
|
||||||
Game::Game(int argc, char* argv[])
|
Game::Game(int argc, char* argv[])
|
||||||
@@ -132,6 +133,7 @@ Game::Game(int argc, char* argv[])
|
|||||||
m_SystemPipeline->AddSystem<DamageIndicatorSystem>(updateOrderLevel);
|
m_SystemPipeline->AddSystem<DamageIndicatorSystem>(updateOrderLevel);
|
||||||
m_SystemPipeline->AddSystem<AmmunitionHUDSystem>(updateOrderLevel);
|
m_SystemPipeline->AddSystem<AmmunitionHUDSystem>(updateOrderLevel);
|
||||||
m_SystemPipeline->AddSystem<KillFeedSystem>(updateOrderLevel);
|
m_SystemPipeline->AddSystem<KillFeedSystem>(updateOrderLevel);
|
||||||
|
m_SystemPipeline->AddSystem<BoostSystem>(updateOrderLevel);
|
||||||
// Populate Octree with collidables
|
// Populate Octree with collidables
|
||||||
++updateOrderLevel;
|
++updateOrderLevel;
|
||||||
m_SystemPipeline->AddSystem<FillOctreeSystem>(updateOrderLevel, m_OctreeCollision, "Collidable");
|
m_SystemPipeline->AddSystem<FillOctreeSystem>(updateOrderLevel, m_OctreeCollision, "Collidable");
|
||||||
@@ -199,10 +201,10 @@ void Game::Tick()
|
|||||||
// Update network
|
// Update network
|
||||||
m_EventBroker->Process<MultiplayerSnapshotFilter>();
|
m_EventBroker->Process<MultiplayerSnapshotFilter>();
|
||||||
if (m_NetworkClient != nullptr) {
|
if (m_NetworkClient != nullptr) {
|
||||||
m_NetworkClient->Update(dt);
|
m_NetworkClient->Update();
|
||||||
}
|
}
|
||||||
if (m_NetworkServer != nullptr) {
|
if (m_NetworkServer != nullptr) {
|
||||||
m_NetworkServer->Update(dt);
|
m_NetworkServer->Update();
|
||||||
}
|
}
|
||||||
//m_SoundManager->Update(dt);
|
//m_SoundManager->Update(dt);
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,63 @@
|
|||||||
|
#include "Systems/BoostSystem.h"
|
||||||
|
|
||||||
|
BoostSystem::BoostSystem(SystemParams params)
|
||||||
|
: System(params)
|
||||||
|
{
|
||||||
|
EVENT_SUBSCRIBE_MEMBER(m_EPlayerDamage, &BoostSystem::OnPlayerDamage);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool BoostSystem::OnPlayerDamage(Events::PlayerDamage& e)
|
||||||
|
{
|
||||||
|
if (e.Victim.ID == e.Inflictor.ID) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!e.Victim.Valid() && e.Victim != LocalPlayer && !e.Victim.IsChildOf(LocalPlayer)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!e.Inflictor.Valid() || !e.Victim.Valid()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//if its not friendly fire, return
|
||||||
|
if ((int)m_World->GetComponent(e.Inflictor.ID, "Team")["Team"] != (int)m_World->GetComponent(e.Victim.ID, "Team")["Team"]) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//determine the inflictors class
|
||||||
|
auto className = DetermineClass(e.Inflictor);
|
||||||
|
if (className == "") {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//get the XML file, example: "Schema/Entities/BoostclassName.xml"
|
||||||
|
std::string classXML = "Schema/Entities/" + className + ".xml";
|
||||||
|
|
||||||
|
//check if player already has a child with the component, if so delete that child
|
||||||
|
auto playerBoostAssaultEntity = e.Victim.FirstChildByName(className);
|
||||||
|
if (playerBoostAssaultEntity.Valid()) {
|
||||||
|
m_World->DeleteEntity(playerBoostAssaultEntity.ID);
|
||||||
|
}
|
||||||
|
//load boost XML file, set it entity parented with the victim player
|
||||||
|
auto entityFile = ResourceManager::Load<EntityFile>(classXML);
|
||||||
|
EntityFileParser parser(entityFile);
|
||||||
|
EntityID boostAssaultEntity = parser.MergeEntities(m_World);
|
||||||
|
m_World->SetName(boostAssaultEntity, className);
|
||||||
|
m_World->SetParent(boostAssaultEntity, e.Victim.ID);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string BoostSystem::DetermineClass(EntityWrapper inflictorPlayer)
|
||||||
|
{
|
||||||
|
//determine the class based on what component the inflictor-player has
|
||||||
|
if (m_World->HasComponent(inflictorPlayer.ID, "DashAbility")) {
|
||||||
|
return "BoostAssault";
|
||||||
|
}
|
||||||
|
if (m_World->HasComponent(inflictorPlayer.ID, "ShieldAbility")) {
|
||||||
|
return "BoostDefender";
|
||||||
|
}
|
||||||
|
if (m_World->HasComponent(inflictorPlayer.ID, "SprintAbility")) {
|
||||||
|
return "BoostSniper";
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
@@ -30,6 +30,11 @@ bool HealthSystem::OnPlayerDamaged(Events::PlayerDamage& e)
|
|||||||
|
|
||||||
ComponentWrapper cHealth = e.Victim["Health"];
|
ComponentWrapper cHealth = e.Victim["Health"];
|
||||||
double& health = cHealth["Health"];
|
double& health = cHealth["Health"];
|
||||||
|
//if player has the boost from a defender, subtract the damage taken by StrengthOfEffect amount
|
||||||
|
auto playerBoostDefenderEntity = e.Victim.FirstChildByName("BoostDefender");
|
||||||
|
if (playerBoostDefenderEntity.Valid()) {
|
||||||
|
e.Damage -= (double)playerBoostDefenderEntity["BoostDefender"]["StrengthOfEffect"];
|
||||||
|
}
|
||||||
health -= e.Damage;
|
health -= e.Damage;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -16,9 +16,7 @@ PlayerMovementSystem::~PlayerMovementSystem()
|
|||||||
void PlayerMovementSystem::Update(double dt)
|
void PlayerMovementSystem::Update(double dt)
|
||||||
{
|
{
|
||||||
updateMovementControllers(dt);
|
updateMovementControllers(dt);
|
||||||
if (LocalPlayer.Valid()) {
|
updateVelocity(dt);
|
||||||
updateVelocity(LocalPlayer, dt);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlayerMovementSystem::updateMovementControllers(double dt)
|
void PlayerMovementSystem::updateMovementControllers(double dt)
|
||||||
@@ -55,6 +53,19 @@ void PlayerMovementSystem::updateMovementControllers(double dt)
|
|||||||
float playerMovementSpeed = player["Player"]["MovementSpeed"];
|
float playerMovementSpeed = player["Player"]["MovementSpeed"];
|
||||||
float playerCrouchSpeed = player["Player"]["CrouchSpeed"];
|
float playerCrouchSpeed = player["Player"]["CrouchSpeed"];
|
||||||
glm::vec3& wishDirection = player["Player"]["CurrentWishDirection"];
|
glm::vec3& wishDirection = player["Player"]["CurrentWishDirection"];
|
||||||
|
auto playerBoostAssaultEntity = player.FirstChildByName("BoostAssault");
|
||||||
|
if (playerBoostAssaultEntity.Valid()) {
|
||||||
|
playerMovementSpeed *= (double)playerBoostAssaultEntity["BoostAssault"]["StrengthOfEffect"];
|
||||||
|
playerCrouchSpeed *= (double)playerBoostAssaultEntity["BoostAssault"]["StrengthOfEffect"];
|
||||||
|
}
|
||||||
|
bool sniperSprinting = false;
|
||||||
|
if (player.HasComponent("SprintAbility")) {
|
||||||
|
if (controller->SniperSprintingCheck()) {
|
||||||
|
playerMovementSpeed *= (double)player["SprintAbility"]["StrengthOfEffect"];
|
||||||
|
playerCrouchSpeed *= (double)player["SprintAbility"]["StrengthOfEffect"];
|
||||||
|
sniperSprinting = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (player.HasComponent("Physics")) {
|
if (player.HasComponent("Physics")) {
|
||||||
ComponentWrapper cPhysics = player["Physics"];
|
ComponentWrapper cPhysics = player["Physics"];
|
||||||
@@ -106,6 +117,13 @@ void PlayerMovementSystem::updateMovementControllers(double dt)
|
|||||||
//if doubleTapped do Assault Dash - but only boost maximum 50.0f
|
//if doubleTapped do Assault Dash - but only boost maximum 50.0f
|
||||||
float doubleTapDashBoost = controller->AssaultDashDoubleTapped() ? 40.0f : 1.0f;
|
float doubleTapDashBoost = controller->AssaultDashDoubleTapped() ? 40.0f : 1.0f;
|
||||||
accelerationSpeed = glm::min(doubleTapDashBoost*glm::min(accelerationSpeed, addSpeed), 50.0f);
|
accelerationSpeed = glm::min(doubleTapDashBoost*glm::min(accelerationSpeed, addSpeed), 50.0f);
|
||||||
|
//if player has Boost from an Assault class, accelerate the player faster
|
||||||
|
if (playerBoostAssaultEntity.Valid()) {
|
||||||
|
accelerationSpeed *= (double)playerBoostAssaultEntity["BoostAssault"]["StrengthOfEffect"];
|
||||||
|
}
|
||||||
|
if (sniperSprinting) {
|
||||||
|
accelerationSpeed *= (double)player["SprintAbility"]["StrengthOfEffect"];
|
||||||
|
}
|
||||||
velocity += accelerationSpeed * wishDirection;
|
velocity += accelerationSpeed * wishDirection;
|
||||||
ImGui::Text("velocity: (%f, %f, %f) |%f|", velocity.x, velocity.y, velocity.z, glm::length(velocity));
|
ImGui::Text("velocity: (%f, %f, %f) |%f|", velocity.x, velocity.y, velocity.z, glm::length(velocity));
|
||||||
}
|
}
|
||||||
@@ -223,11 +241,15 @@ void PlayerMovementSystem::updateMovementControllers(double dt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PlayerMovementSystem::updateVelocity(EntityWrapper player, double dt)
|
void PlayerMovementSystem::updateVelocity(double dt)
|
||||||
{
|
{
|
||||||
// Only apply velocity to local player
|
// Only apply velocity to local player
|
||||||
ComponentWrapper& cTransform = player["Transform"];
|
if (!LocalPlayer.Valid()) {
|
||||||
ComponentWrapper& cPhysics = player["Physics"];
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ComponentWrapper& cTransform = LocalPlayer["Transform"];
|
||||||
|
ComponentWrapper& cPhysics = LocalPlayer["Physics"];
|
||||||
glm::vec3& velocity = cPhysics["Velocity"];
|
glm::vec3& velocity = cPhysics["Velocity"];
|
||||||
bool isOnGround = (bool)cPhysics["IsOnGround"];
|
bool isOnGround = (bool)cPhysics["IsOnGround"];
|
||||||
|
|
||||||
|
|||||||
@@ -384,9 +384,10 @@ bool AssaultWeaponBehaviour::shoot(double damage)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for friendly fire
|
|
||||||
|
// If friendly fire - reduce damage to 0 (needed to make Boosts, Ammosharing work)
|
||||||
if ((ComponentInfo::EnumType)victim["Team"]["Team"] == (ComponentInfo::EnumType)m_Player["Team"]["Team"]) {
|
if ((ComponentInfo::EnumType)victim["Team"]["Team"] == (ComponentInfo::EnumType)m_Player["Team"]["Team"]) {
|
||||||
return false;
|
damage = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deal damage!
|
// Deal damage!
|
||||||
|
|||||||
Reference in New Issue
Block a user