public MyReplicationServer(IReplicationServerCallback callback, Func<MyTimeSpan> updateTimeGetter)
     : base(true)
 {
     m_callback = callback;
     m_timeFunc = updateTimeGetter;
     m_replicables = new Dictionary<NetworkId, IMyReplicable>();
     m_clientStates = new Dictionary<EndpointId, ClientData>();
     m_eventQueueSender = (s, e) => m_callback.SendEvent(s, false, e);
 }
 public MyReplicationServer(IReplicationServerCallback callback, Func <MyTimeSpan> updateTimeGetter)
     : base(true)
 {
     m_callback         = callback;
     m_timeFunc         = updateTimeGetter;
     m_replicables      = new Dictionary <NetworkId, IMyReplicable>();
     m_clientStates     = new Dictionary <EndpointId, ClientData>();
     m_eventQueueSender = (s, e) => m_callback.SendEvent(s, false, e);
 }
        /// <summary>
        /// Replaces some truly awful Keencode that involves a handful of branches and callvirt
        /// for *each byte* in the byte array. This is at least a 5x improvement in tests.
        /// </summary>
        /// <param name="worldData"></param>
        /// <param name="sendTo"></param>
        private static void SendWorld(byte[] worldData, EndpointId sendTo)
        {
            IReplicationServerCallback callback = _getCallback((MyReplicationServer)MyMultiplayer.Static.ReplicationLayer);
            MyPacketDataBitStreamBase  data     = callback.GetBitStreamPacketData();

            data.Stream.WriteVariant((uint)worldData.Length);
            for (var i = 0; i < worldData.Length; i++)
            {
                data.Stream.WriteByte(worldData[i]);
            }
            callback.SendWorld(data, sendTo);
        }
 public ConcurrentReplicationCallback(IReplicationServerCallback original)
 {
     _original = original;
     _sizeMtu  = 1200;
     _sizeMtr  = 1048576;
 }
        public MyReplicationServer(IReplicationServerCallback callback, Func<MyTimeSpan> updateTimeGetter, EndpointId? localClientEndpoint)
            : base(true)
        {
            Debug.Assert(localClientEndpoint == null || localClientEndpoint.Value.IsValid, "localClientEndpoint can be null (for DS), but not be zero!");
            m_localClientEndpoint = localClientEndpoint;
            m_callback = callback;
            m_timeFunc = updateTimeGetter;
            m_clientStates = new Dictionary<EndpointId, ClientData>();
            m_eventQueueSender = (s, e) => m_callback.SendEvent(s, false, e);

            SetGroupLimit(StateGroupEnum.FloatingObjectPhysics, 136);
        }
Exemple #6
0
 public ThreadedReplicationServer(IReplicationServerCallback callback, EndpointId?localClientEndpoint,
                                  bool usePlayoutDelayBuffer) : base(new ConcurrentReplicationCallback(callback), localClientEndpoint,
                                                                     usePlayoutDelayBuffer)
 {
 }