public MDGameSynchPeerInfo(MDGameSynchronizer GameSynchronizer, int PeerId)
 {
     MDLog.AddLogCategoryProperties(LOG_CAT, new MDLogProperties(MDLogLevel.Info));
     MDLog.Info(LOG_CAT, $"Creating MDGameSynchPeerInfo for Peer [ID: {PeerId}]");
     this.GameSynchronizer         = GameSynchronizer;
     this.PeerId                   = PeerId;
     this.SettingAveragePingToKeep = GameSynchronizer.GetPingsToKeepForAverage();
     this.CompletedNodeSynch       = false;
     this.CompletedSynch           = false;
     StartMSecCycle();
 }
        public MDReplicatedMember(MemberInfo Member, bool Reliable, MDReplicatedType ReplicatedType, WeakRef NodeRef,
                                  MDReplicatedSetting[] Settings)
        {
            MDLog.AddLogCategoryProperties(LOG_CAT, new MDLogProperties(MDLogLevel.Info));
            GameSession      = MDStatics.GetGameSession();
            Replicator       = GameSession.Replicator;
            GameClock        = GameSession.GetGameClock();
            GameSynchronizer = GameSession.GetGameSynchronizer();

            this.Member         = Member;
            this.Reliable       = Reliable;
            this.ReplicatedType = ReplicatedType;
            this.NodeRef        = NodeRef;
            ParseSettings(MDReplicator.ParseParameters(typeof(Settings), Settings));
            CheckIfShouldReplicate();
        }
Exemple #3
0
        // Called when the node enters the scene tree for the first time.
        public override void _Ready()
        {
            MDLog.AddLogCategoryProperties(LOG_CAT, new MDLogProperties(MDLogLevel.Info));
            LoadConfig();
            GameSynchronizer                           = this.GetGameSynchronizer();
            CurrentRemoteTickOffset                    = MinimumOffset;
            CurrentRemoteTickOffsetTarget              = MinimumOffset;
            LastRemoteTickOffset                       = MinimumOffset;
            GameSynchronizer.OnPlayerPingUpdatedEvent += OnPlayerPingUpdatedEvent;

            // TODO: Remove this, only here for debug
            MDOnScreenDebug.AddOnScreenDebugInfo("GameClock Current Tick", () => CurrentTick.ToString());
            MDOnScreenDebug.AddOnScreenDebugInfo("OS GetTickMsec", () => OS.GetTicksMsec().ToString());
            MDOnScreenDebug.AddOnScreenDebugInfo("GameClock Remote Offset",
                                                 () =>
                                                 $"{CurrentRemoteTickOffset} ({(int) (CurrentRemoteTickOffset * TICK_INTERVAL_MILLISECONDS)} Msec)");
            MDOnScreenDebug.AddOnScreenDebugInfo("GameClock Remote Target Offset",
                                                 () =>
                                                 $"{CurrentRemoteTickOffsetTarget} ({(int) (CurrentRemoteTickOffsetTarget * TICK_INTERVAL_MILLISECONDS)} Msec)");
        }