This commit is contained in:
Anuken
2026-07-05 09:46:44 -04:00
parent 05c3c856a9
commit e24d63c971
2 changed files with 13 additions and 18 deletions
+13 -16
View File
@@ -610,25 +610,25 @@ public class NetServer implements ApplicationListener{
(player.isAdded() ? 4 : 0) | (player.isAdded() ? 4 : 0) |
(player.con.hasBegunConnecting ? 8 : 0); (player.con.hasBegunConnecting ? 8 : 0);
Call.debugStatusClient(player.con, flags, player.con.lastReceivedClientSnapshot, player.con.snapshotsSent); Call.debugStatusClient(player.con, flags, player.con.lastReceivedClientSnapshot);
Call.debugStatusClientUnreliable(player.con, flags, player.con.lastReceivedClientSnapshot, player.con.snapshotsSent); Call.debugStatusClientUnreliable(player.con, flags, player.con.lastReceivedClientSnapshot);
} }
@Remote(variants = Variant.both, priority = PacketPriority.high) @Remote(variants = Variant.both, priority = PacketPriority.high)
public static void debugStatusClient(int value, int lastClientSnapshot, int snapshotsSent){ public static void debugStatusClient(int value, int lastClientSnapshot){
logClientStatus(true, value, lastClientSnapshot, snapshotsSent); logClientStatus(true, value, lastClientSnapshot);
} }
@Remote(variants = Variant.both, priority = PacketPriority.high, unreliable = true) @Remote(variants = Variant.both, priority = PacketPriority.high, unreliable = true)
public static void debugStatusClientUnreliable(int value, int lastClientSnapshot, int snapshotsSent){ public static void debugStatusClientUnreliable(int value, int lastClientSnapshot){
logClientStatus(false, value, lastClientSnapshot, snapshotsSent); logClientStatus(false, value, lastClientSnapshot);
} }
static void logClientStatus(boolean reliable, int value, int lastClientSnapshot, int snapshotsSent){ static void logClientStatus(boolean reliable, int value, int lastClientSnapshot){
Log.info("@ Debug status received. disconnected = @, connected = @, added = @, begunConnecting = @ lastClientSnapshot = @, snapshotsSent = @", Log.info("@ Debug status received. disconnected = @, connected = @, added = @, begunConnecting = @ lastClientSnapshot = @",
reliable ? "[RELIABLE]" : "[UNRELIABLE]", reliable ? "[RELIABLE]" : "[UNRELIABLE]",
(value & 1) != 0, (value & 2) != 0, (value & 4) != 0, (value & 8) != 0, (value & 1) != 0, (value & 2) != 0, (value & 4) != 0, (value & 8) != 0,
lastClientSnapshot, snapshotsSent lastClientSnapshot
); );
} }
@@ -1136,11 +1136,9 @@ public class NetServer implements ApplicationListener{
Call.entitySnapshot((short)sent, syncStream.toByteArray()); Call.entitySnapshot((short)sent, syncStream.toByteArray());
} }
Groups.player.each(p -> p.con.snapshotsSent++);
} }
/** Checks isSyncHidden for only one player per team. Called if FoW is enabled but there is no custom syncHidden. */ /** Checks isSyncHidden for only one player per team. Called if FoW is enabled. */
public void writeEntitySnapshotsTeam(Team team, Seq<Player> players) throws IOException{ public void writeEntitySnapshotsTeam(Team team, Seq<Player> players) throws IOException{
syncStream.reset(); syncStream.reset();
@@ -1151,7 +1149,6 @@ public class NetServer implements ApplicationListener{
for(Player player : players){ for(Player player : players){
//player.con must not be null here (the players seq must ONLY contain non-local connected clients) //player.con must not be null here (the players seq must ONLY contain non-local connected clients)
tempConnections.add(player.con); tempConnections.add(player.con);
player.con.snapshotsSent ++;
} }
for(Syncc entity : Groups.sync){ for(Syncc entity : Groups.sync){
@@ -1218,10 +1215,10 @@ public class NetServer implements ApplicationListener{
} }
protected void writeEntity(Syncc entity, DataOutputStream dataStream) throws IOException{ protected void writeEntity(Syncc entity, DataOutputStream dataStream) throws IOException{
dataStream.writeInt(entity.id()); //write id dataStream.writeInt(entity.id());
dataStream.writeByte(entity.classId() & 0xFF); //write type ID dataStream.writeByte(entity.classId() & 0xFF);
entity.beforeWrite(); entity.beforeWrite();
entity.writeSync(dataStreamWrites); //write entity itself entity.writeSync(dataStreamWrites);
} }
public String fixName(String name){ public String fixName(String name){
@@ -21,8 +21,6 @@ public abstract class NetConnection{
public long connectTime = Time.millis(); public long connectTime = Time.millis();
/** ID of last received client snapshot. */ /** ID of last received client snapshot. */
public int lastReceivedClientSnapshot = -1; public int lastReceivedClientSnapshot = -1;
/** Count of snapshots sent from server. */
public int snapshotsSent;
/** Timestamp of last received snapshot. */ /** Timestamp of last received snapshot. */
public long lastReceivedClientTime; public long lastReceivedClientTime;
/** Build requests that have been recently rejected. This is cleared every snapshot. */ /** Build requests that have been recently rejected. This is cleared every snapshot. */