Fixed latency issues caused by clientside movement packets queueing up but currently the trails aren't working anymore #fix #refactor

This commit is contained in:
Peter Galloway
2017-07-26 22:02:46 +12:00
parent 6e9535d78f
commit 9cedbeb6f6
2 changed files with 8 additions and 8 deletions
@@ -210,14 +210,14 @@ public class BoatGroup extends Group {
double groundSpeed, long timeValid, double frameRate) { double groundSpeed, long timeValid, double frameRate) {
if (lastTimeValid == 0) { if (lastTimeValid == 0) {
lastTimeValid = timeValid - 200; lastTimeValid = timeValid - 200;
moveTo(newXValue, newYValue, rotation);
} }
framesToMove = Math.round((frameRate / (1000.0f / (timeValid - lastTimeValid)))); moveTo(newXValue, newYValue, rotation);
double dx = newXValue - boatPoly.getLayoutX(); // framesToMove = Math.round((frameRate / (1000.0f / (timeValid - lastTimeValid))));
double dy = newYValue - boatPoly.getLayoutY(); // double dx = newXValue - boatPoly.getLayoutX();
// double dy = newYValue - boatPoly.getLayoutY();
xIncrement = dx / framesToMove; //
yIncrement = dy / framesToMove; // xIncrement = dx / framesToMove;
// yIncrement = dy / framesToMove;
destinationSet = true; destinationSet = true;
@@ -23,7 +23,7 @@ import java.util.logging.Logger;
public class MainServerThread extends Observable implements Runnable, ClientConnectionDelegate{ public class MainServerThread extends Observable implements Runnable, ClientConnectionDelegate{
private static final int PORT = 4942; private static final int PORT = 4942;
private static final Integer CLIENT_UPDATES_PER_SECOND = 5; private static final Integer CLIENT_UPDATES_PER_SECOND = 10;
private static final int LOG_LEVEL = 1; private static final int LOG_LEVEL = 1;
private Thread thread; private Thread thread;