Debug test

This commit is contained in:
Sofia 2017-11-25 13:27:55 +02:00
parent a97b2568e5
commit 88f1a9a8a1
3 changed files with 8 additions and 3 deletions

View File

@ -42,7 +42,6 @@ namespace Network {
LastConnectionSended = to.ID; LastConnectionSended = to.ID;
} }
PacketPeer.PutPacket(packetBuffer.ByteBuffer); PacketPeer.PutPacket(packetBuffer.ByteBuffer);
GD.print("Putting stuff to " + to.Address + ":" + to.Port);
} }
public bool StartListening(int port, string address = "*") { public bool StartListening(int port, string address = "*") {

View File

@ -27,14 +27,18 @@ namespace Network.Syncing {
Connection = connection; Connection = connection;
} }
public void SerializeAndSendQueues() { public void SerializeAndSendQueues(int UnreliableSyncID) {
PacketBuffer Buffer = PacketBuffer.WithSignature(); PacketBuffer Buffer = PacketBuffer.WithSignature();
SyncPkt Sync = new SyncPkt(); SyncPkt Sync = new SyncPkt();
Sync.Reliable = false;
Sync.ID = UnreliableSyncID;
Sync.Serialize(Buffer); Sync.Serialize(Buffer);
// Add Queues // Add Queues
GD.print("Sending sync-" + Sync.ID);
Peer.SendBuffer(Buffer, Connection); Peer.SendBuffer(Buffer, Connection);
} }

View File

@ -23,12 +23,14 @@ namespace Network.Syncing {
} }
public void Update(float delta) { public void Update(float delta) {
//GD.print("Update! + " + delta);
TimeSinceLastSync += delta; TimeSinceLastSync += delta;
if (TimeSinceLastSync > Interval) { if (TimeSinceLastSync > Interval) {
TimeSinceLastSync = 0; TimeSinceLastSync = 0;
foreach (ConnectionHandler Handler in HandlerList) { foreach (ConnectionHandler Handler in HandlerList) {
Handler.SerializeAndSendQueues(); GD.print("Sending to " + Handler.Connection.Name);
Handler.SerializeAndSendQueues(UnreliableIDCounter++);
} }
} }
} }