Tweaking to server loop making it send packets at 5Hz

Commented out some smoothing code in BoatGroup that was dependend on FPS screwing with movement
This commit is contained in:
William Muir
2017-07-24 21:14:17 +12:00
parent 07cebb6c5b
commit a30a1aa7c7
4 changed files with 35 additions and 26 deletions
@@ -184,7 +184,7 @@ public class ServerToClientThread implements Runnable {
// } catch (IOException e) {
// System.out.println("IO error in server thread upon writing to output stream");
// }
sendBoatLocationPackets();
// sendBoatLocationPackets();
updateClient = false;
}
@@ -251,6 +251,7 @@ public class ServerToClientThread implements Runnable {
}
public void updateClient() {
sendBoatLocationPackets();
updateClient = true;
}
@@ -347,7 +348,15 @@ public class ServerToClientThread implements Runnable {
ArrayList<Yacht> yachts = new ArrayList<>(GameState.getYachts().values());
for (Yacht yacht: yachts){
// System.out.println("[SERVER] Lat: " + yacht.getLocation().getLat() + " Lon: " + yacht.getLocation().getLng());
BoatLocationMessage boatLocationMessage = new BoatLocationMessage(sourceId, getSeqNo(), yacht.getLocation().getLat(), yacht.getLocation().getLng(), yacht.getHeading(), (long) yacht.getVelocity());
BoatLocationMessage boatLocationMessage =
new BoatLocationMessage(
sourceId,
getSeqNo(),
yacht.getLocation().getLat(),
yacht.getLocation().getLng(),
yacht.getHeading(),
(long) yacht.getVelocity());
sendMessage(boatLocationMessage);
}
}