Hopeless attempts to fix network bugs

This commit is contained in:
Tleety
2016-02-12 05:17:09 +01:00
parent 787eecce26
commit a8a3366e8a
5 changed files with 35 additions and 21 deletions
+1 -1
View File
@@ -23,7 +23,7 @@ StartNetwork=false
IsServer=false IsServer=false
Name=Bob Name=Bob
Address=127.0.0.1 Address=127.0.0.1
Port=13 Port=27666
MaxConnections=8 MaxConnections=8
SnapshotInterval=0.05 SnapshotInterval=0.05
SendInputIntervalMs=33 SendInputIntervalMs=33
+1 -1
View File
@@ -187,7 +187,7 @@ void Server::addChildrenToPacket(Packet & packet, EntityID entityID)
{ {
// HACK: Only sync players for now, since the map turned out to be TOO LARGE to send in one snapshot and Simon's computer shits itself // HACK: Only sync players for now, since the map turned out to be TOO LARGE to send in one snapshot and Simon's computer shits itself
EntityWrapper entity(m_World, entityID); EntityWrapper entity(m_World, entityID);
if (entityID != EntityID_Invalid && !shouldSendToClient(entity)) { if (!entity.Valid() || !shouldSendToClient(entity)) {
return; return;
} }
+9 -3
View File
@@ -6,15 +6,21 @@ CapturePointSystem::CapturePointSystem(SystemParams params)
, PureSystem("CapturePoint") , PureSystem("CapturePoint")
{ {
//subscribe/listenTo playerdamage,healthpickup events (using the eventBroker) //subscribe/listenTo playerdamage,healthpickup events (using the eventBroker)
EVENT_SUBSCRIBE_MEMBER(m_ETriggerTouch, &CapturePointSystem::OnTriggerTouch); if (IsClient) {
EVENT_SUBSCRIBE_MEMBER(m_ETriggerLeave, &CapturePointSystem::OnTriggerLeave); EVENT_SUBSCRIBE_MEMBER(m_ETriggerTouch, &CapturePointSystem::OnTriggerTouch);
EVENT_SUBSCRIBE_MEMBER(m_ECaptured, &CapturePointSystem::OnCaptured); EVENT_SUBSCRIBE_MEMBER(m_ETriggerLeave, &CapturePointSystem::OnTriggerLeave);
EVENT_SUBSCRIBE_MEMBER(m_ECaptured, &CapturePointSystem::OnCaptured);
}
} }
//here all capturepoints will update their component //here all capturepoints will update their component
//NOTE: needs to run each frame, since we're possibly modifying the captureTimer for the capturePoints by dt //NOTE: needs to run each frame, since we're possibly modifying the captureTimer for the capturePoints by dt
void CapturePointSystem::UpdateComponent(EntityWrapper& capturePointEntity, ComponentWrapper& cCapturePoint, double dt) void CapturePointSystem::UpdateComponent(EntityWrapper& capturePointEntity, ComponentWrapper& cCapturePoint, double dt)
{ {
if (!IsClient) {
return;
}
if (m_WinnerWasFound) { if (m_WinnerWasFound) {
return; return;
} }
+11 -9
View File
@@ -114,15 +114,17 @@ void PlayerMovementSystem::updateMovementControllers(double dt)
if (isOnGround) { if (isOnGround) {
controller->SetDoubleJumping(false); controller->SetDoubleJumping(false);
} else { } else {
//put a hexagon at the players feet if (IsClient) {
auto hexagonEffect = ResourceManager::Load<EntityFile>("Schema/Entities/DoubleJumpHexagon.xml"); //put a hexagon at the players feet
EntityFileParser parser(hexagonEffect); auto hexagonEffect = ResourceManager::Load<EntityFile>("Schema/Entities/DoubleJumpHexagon.xml");
EntityID hexagonEffectID = parser.MergeEntities(m_World); EntityFileParser parser(hexagonEffect);
EntityWrapper hexagonEW = EntityWrapper(m_World, hexagonEffectID); EntityID hexagonEffectID = parser.MergeEntities(m_World);
hexagonEW["Transform"]["Position"] = (glm::vec3)player["Transform"]["Position"]; EntityWrapper hexagonEW = EntityWrapper(m_World, hexagonEffectID);
controller->SetDoubleJumping(true); hexagonEW["Transform"]["Position"] = (glm::vec3)player["Transform"]["Position"];
Events::DoubleJump e; controller->SetDoubleJumping(true);
m_EventBroker->Publish(e); Events::DoubleJump e;
m_EventBroker->Publish(e);
}
} }
velocity.y = 4.f; velocity.y = 4.f;
} }
+13 -7
View File
@@ -6,13 +6,15 @@ SoundSystem::SoundSystem(SystemParams params)
{ {
ConfigFile* config = ResourceManager::Load<ConfigFile>("Config.ini"); ConfigFile* config = ResourceManager::Load<ConfigFile>("Config.ini");
m_Announcer = ResourceManager::Load<ConfigFile>("Config.ini")->Get<std::string>("Sound.Announcer", "female"); m_Announcer = ResourceManager::Load<ConfigFile>("Config.ini")->Get<std::string>("Sound.Announcer", "female");
EVENT_SUBSCRIBE_MEMBER(m_EPlayerSpawned, &SoundSystem::OnPlayerSpawned); if (IsClient) {
EVENT_SUBSCRIBE_MEMBER(m_InputCommand, &SoundSystem::OnInputCommand); EVENT_SUBSCRIBE_MEMBER(m_EPlayerSpawned, &SoundSystem::OnPlayerSpawned);
EVENT_SUBSCRIBE_MEMBER(m_EDoubleJump, &SoundSystem::OnDoubleJump); EVENT_SUBSCRIBE_MEMBER(m_InputCommand, &SoundSystem::OnInputCommand);
EVENT_SUBSCRIBE_MEMBER(m_EDashAbility, &SoundSystem::OnDashAbility); EVENT_SUBSCRIBE_MEMBER(m_EDoubleJump, &SoundSystem::OnDoubleJump);
EVENT_SUBSCRIBE_MEMBER(m_EPlayerDamage, &SoundSystem::OnPlayerDamage); EVENT_SUBSCRIBE_MEMBER(m_EDashAbility, &SoundSystem::OnDashAbility);
EVENT_SUBSCRIBE_MEMBER(m_ECaptured, &SoundSystem::OnCaptured); EVENT_SUBSCRIBE_MEMBER(m_EPlayerDamage, &SoundSystem::OnPlayerDamage);
EVENT_SUBSCRIBE_MEMBER(m_ETriggerTouch, &SoundSystem::OnTriggerTouch); EVENT_SUBSCRIBE_MEMBER(m_ECaptured, &SoundSystem::OnCaptured);
EVENT_SUBSCRIBE_MEMBER(m_ETriggerTouch, &SoundSystem::OnTriggerTouch);
}
} }
void SoundSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& cComponent, double dt) void SoundSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& cComponent, double dt)
@@ -20,6 +22,10 @@ void SoundSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& cComp
void SoundSystem::Update(double dt) void SoundSystem::Update(double dt)
{ {
if (!IsClient) {
return;
}
// Temp for play test. // Temp for play test.
if (m_DrumsIsPlaying) { if (m_DrumsIsPlaying) {
m_DrumsIsPlaying = !drumTimer(dt); m_DrumsIsPlaying = !drumTimer(dt);