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;
} }
+6
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)
if (IsClient) {
EVENT_SUBSCRIBE_MEMBER(m_ETriggerTouch, &CapturePointSystem::OnTriggerTouch); EVENT_SUBSCRIBE_MEMBER(m_ETriggerTouch, &CapturePointSystem::OnTriggerTouch);
EVENT_SUBSCRIBE_MEMBER(m_ETriggerLeave, &CapturePointSystem::OnTriggerLeave); EVENT_SUBSCRIBE_MEMBER(m_ETriggerLeave, &CapturePointSystem::OnTriggerLeave);
EVENT_SUBSCRIBE_MEMBER(m_ECaptured, &CapturePointSystem::OnCaptured); 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;
} }
@@ -114,6 +114,7 @@ void PlayerMovementSystem::updateMovementControllers(double dt)
if (isOnGround) { if (isOnGround) {
controller->SetDoubleJumping(false); controller->SetDoubleJumping(false);
} else { } else {
if (IsClient) {
//put a hexagon at the players feet //put a hexagon at the players feet
auto hexagonEffect = ResourceManager::Load<EntityFile>("Schema/Entities/DoubleJumpHexagon.xml"); auto hexagonEffect = ResourceManager::Load<EntityFile>("Schema/Entities/DoubleJumpHexagon.xml");
EntityFileParser parser(hexagonEffect); EntityFileParser parser(hexagonEffect);
@@ -124,6 +125,7 @@ void PlayerMovementSystem::updateMovementControllers(double dt)
Events::DoubleJump e; Events::DoubleJump e;
m_EventBroker->Publish(e); m_EventBroker->Publish(e);
} }
}
velocity.y = 4.f; velocity.y = 4.f;
} }
+6
View File
@@ -6,6 +6,7 @@ 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");
if (IsClient) {
EVENT_SUBSCRIBE_MEMBER(m_EPlayerSpawned, &SoundSystem::OnPlayerSpawned); EVENT_SUBSCRIBE_MEMBER(m_EPlayerSpawned, &SoundSystem::OnPlayerSpawned);
EVENT_SUBSCRIBE_MEMBER(m_InputCommand, &SoundSystem::OnInputCommand); EVENT_SUBSCRIBE_MEMBER(m_InputCommand, &SoundSystem::OnInputCommand);
EVENT_SUBSCRIBE_MEMBER(m_EDoubleJump, &SoundSystem::OnDoubleJump); EVENT_SUBSCRIBE_MEMBER(m_EDoubleJump, &SoundSystem::OnDoubleJump);
@@ -14,12 +15,17 @@ SoundSystem::SoundSystem(SystemParams params)
EVENT_SUBSCRIBE_MEMBER(m_ECaptured, &SoundSystem::OnCaptured); EVENT_SUBSCRIBE_MEMBER(m_ECaptured, &SoundSystem::OnCaptured);
EVENT_SUBSCRIBE_MEMBER(m_ETriggerTouch, &SoundSystem::OnTriggerTouch); 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)
{ } { }
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);