Skip to content

Commit

Permalink
Network frame-rate optimisation (Commented out) (Issue #8)
Browse files Browse the repository at this point in the history
  • Loading branch information
KSP-TaxiService committed Sep 22, 2018
1 parent 27a3c4b commit ed2104c
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/CommNetConstellation/CommNetLayer/CNCCommNetNetwork.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using CommNet;
using UnityEngine;

namespace CommNetConstellation.CommNetLayer
{
Expand All @@ -7,6 +8,10 @@ namespace CommNetConstellation.CommNetLayer
/// </summary>
public class CNCCommNetNetwork : CommNetNetwork
{
//Part of inactive network optimisation in CNCCommNetNetwork.Update()
//private float nextUpdateTime = 0.0f;
//private const float networkInterval = 0.1f; // in seconds

public static new CNCCommNetNetwork Instance
{
get;
Expand Down Expand Up @@ -36,5 +41,17 @@ protected override void Awake()
this.CommNet = new CNCCommNetwork();
GameEvents.CommNet.OnNetworkInitialized.Fire();
}

protected override void Update()
{
//Comment: Not recommended to run along with other active optimisation of evaluating
//subset of connections in CNCCommNetwork.UpdateNetwork()
//Effect of running both optimisations is unacceptable low rate of connection check per second
//if (Time.time >= nextUpdateTime)
//{
base.Update();
//nextUpdateTime += networkInterval;
//}
}
}
}

0 comments on commit ed2104c

Please sign in to comment.