@@ -32,7 +32,7 @@ public void TimerNotifyClientsCallback(System.Object source, ElapsedEventArgs ar
3232 {
3333 SendToAllPlayers ( ServerPacketOpcode . PlayerPositions , new SPacketPlayerPositions {
3434 PlayerPositions = Players . ToDictionary ( x => x . Key , x => x . Value . Position )
35- } ) ;
35+ } , PacketFlags . Reliable ) ;
3636 }
3737
3838 public void TimerGameLoopCallback ( System . Object source , ElapsedEventArgs args )
@@ -52,7 +52,9 @@ public void TimerGameLoopCallback(System.Object source, ElapsedEventArgs args)
5252 if ( player . PressedDown )
5353 dir . y = 1 ;
5454
55- player . Position += dir * 250 * Delta ;
55+ var delta = 0.016667f ;
56+
57+ player . Position += dir * 250 * delta ;
5658 }
5759 }
5860
@@ -93,38 +95,38 @@ public static Dictionary<uint, DataPlayer> GetOtherPlayers(uint id)
9395 public static Peer [ ] GetOtherPlayerPeers ( uint id ) => Players . Keys . Where ( x => x != id ) . Select ( x => Peers [ x ] ) . ToArray ( ) ;
9496 public static Peer [ ] GetAllPlayerPeers ( ) => Players . Keys . Select ( x => Peers [ x ] ) . ToArray ( ) ;
9597
96- public static void SendToAllPlayers ( ServerPacketOpcode opcode , APacket data = null )
98+ public static void SendToAllPlayers ( ServerPacketOpcode opcode , APacket data = null , PacketFlags flags = PacketFlags . Reliable )
9799 {
98100 var allPlayers = GetAllPlayerPeers ( ) ;
99101
100102 if ( data == null )
101- Send ( opcode , allPlayers ) ;
103+ Send ( opcode , flags , allPlayers ) ;
102104 else
103- Send ( opcode , data , allPlayers ) ;
105+ Send ( opcode , data , flags , allPlayers ) ;
104106 }
105107
106- public static void SendToOtherPeers ( uint id , ServerPacketOpcode opcode , APacket data = null )
108+ public static void SendToOtherPeers ( uint id , ServerPacketOpcode opcode , APacket data = null , PacketFlags flags = PacketFlags . Reliable )
107109 {
108110 var otherPeers = GetOtherPeers ( id ) ;
109111 if ( otherPeers . Length == 0 )
110112 return ;
111113
112114 if ( data == null )
113- Send ( opcode , otherPeers ) ;
115+ Send ( opcode , flags , otherPeers ) ;
114116 else
115- Send ( opcode , data , otherPeers ) ;
117+ Send ( opcode , data , flags , otherPeers ) ;
116118 }
117119
118- public static void SendToOtherPlayers ( uint id , ServerPacketOpcode opcode , APacket data = null )
120+ public static void SendToOtherPlayers ( uint id , ServerPacketOpcode opcode , APacket data = null , PacketFlags flags = PacketFlags . Reliable )
119121 {
120122 var otherPlayers = GetOtherPlayerPeers ( id ) ;
121123 if ( otherPlayers . Length == 0 )
122124 return ;
123125
124126 if ( data == null )
125- Send ( opcode , otherPlayers ) ;
127+ Send ( opcode , flags , otherPlayers ) ;
126128 else
127- Send ( opcode , data , otherPlayers ) ;
129+ Send ( opcode , data , flags , otherPlayers ) ;
128130 }
129131
130132 public static void UpdatePressed ( uint id , Direction dir , bool pressed )
0 commit comments