mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 06:18:44 +00:00
Action packets now sent at regular 20ms intervals
#issue[38] #implement
This commit is contained in:
@@ -48,7 +48,7 @@ public class Yacht {
|
|||||||
private Integer legNumber = 0;
|
private Integer legNumber = 0;
|
||||||
|
|
||||||
//SERVER SIDE
|
//SERVER SIDE
|
||||||
static public final Double TURN_STEP = 1.0; //This should be in some utils class somewhere 2bh. Public for tests sake.
|
public static final Double TURN_STEP = 1.0; //This should be in some utils class somewhere 2bh. Public for tests sake.
|
||||||
private Double lastHeading;
|
private Double lastHeading;
|
||||||
private Boolean sailIn;
|
private Boolean sailIn;
|
||||||
private GeoPoint location;
|
private GeoPoint location;
|
||||||
|
|||||||
@@ -32,8 +32,8 @@ import seng302.visualiser.fxObjects.BoatObject;
|
|||||||
import seng302.visualiser.fxObjects.CourseBoundary;
|
import seng302.visualiser.fxObjects.CourseBoundary;
|
||||||
import seng302.visualiser.fxObjects.Gate;
|
import seng302.visualiser.fxObjects.Gate;
|
||||||
import seng302.visualiser.fxObjects.Marker;
|
import seng302.visualiser.fxObjects.Marker;
|
||||||
import seng302.v.map.Boundary;
|
import seng302.visualiser.map.Boundary;
|
||||||
import seng302.v.map.CanvasMap;
|
import seng302.visualiser.map.CanvasMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by cir27 on 20/07/17.
|
* Created by cir27 on 20/07/17.
|
||||||
@@ -135,7 +135,7 @@ public class GameView extends Pane {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Platform.runLater(() ->
|
// Platform.runLater(() ->
|
||||||
// boatObjects.forEach((boat, boatObject) -> boatObject.updateLocation())
|
boatObjects.forEach((boat, boatObject) -> boatObject.updateLocation());
|
||||||
// );
|
// );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -242,15 +242,15 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
// Adds the new data series to the sparkline (and set the colour of the series)
|
// Adds the new data series to the sparkline (and set the colour of the series)
|
||||||
Platform.runLater(() -> {
|
Platform.runLater(() ->
|
||||||
sparkLineData
|
sparkLineData
|
||||||
.stream()
|
.stream()
|
||||||
.filter(spark -> !raceSparkLine.getData().contains(spark))
|
.filter(spark -> !raceSparkLine.getData().contains(spark))
|
||||||
.forEach(spark -> {
|
.forEach(spark -> {
|
||||||
raceSparkLine.getData().add(spark);
|
raceSparkLine.getData().add(spark);
|
||||||
spark.getNode().lookup(".chart-series-line").setStyle("-fx-stroke:" + getBoatColorAsRGB(spark.getName()));
|
spark.getNode().lookup(".chart-series-line").setStyle("-fx-stroke:" + getBoatColorAsRGB(spark.getName()));
|
||||||
});
|
})
|
||||||
});
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initialiseSparkLine() {
|
private void initialiseSparkLine() {
|
||||||
|
|||||||
@@ -268,7 +268,7 @@ public class BoatObject extends Group {
|
|||||||
*/
|
*/
|
||||||
public void setAsPlayer() {
|
public void setAsPlayer() {
|
||||||
boatPoly.getPoints().setAll(
|
boatPoly.getPoints().setAll(
|
||||||
-BOAT_WIDTH / 1.75, BOAT_HEIGHT / 1.75,
|
-BOAT_WIDTH / 1.75, BOAT_HEIGHT / 1.75,
|
||||||
0.0, -BOAT_HEIGHT / 1.75,
|
0.0, -BOAT_HEIGHT / 1.75,
|
||||||
BOAT_WIDTH / 1.75, BOAT_HEIGHT / 1.75
|
BOAT_WIDTH / 1.75, BOAT_HEIGHT / 1.75
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ public class Wake extends Group {
|
|||||||
arc.setFill(new Color(0.0, 0.0, 0.0, 0.0));
|
arc.setFill(new Color(0.0, 0.0, 0.0, 0.0));
|
||||||
arcs[i] = arc;
|
arcs[i] = arc;
|
||||||
arc.getTransforms().setAll(
|
arc.getTransforms().setAll(
|
||||||
new Rotate(1)
|
new Rotate(1)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
super.getChildren().addAll(arcs);
|
super.getChildren().addAll(arcs);
|
||||||
@@ -60,15 +60,15 @@ public class Wake extends Group {
|
|||||||
|
|
||||||
void setRotation (double rotation, double velocity) {
|
void setRotation (double rotation, double velocity) {
|
||||||
// if (Math.abs(rotations[0] - rotation) > 20) {
|
// if (Math.abs(rotations[0] - rotation) > 20) {
|
||||||
Platform.runLater(() -> {
|
Platform.runLater(() -> {
|
||||||
rotate(rotation);
|
rotate(rotation);
|
||||||
double rad = (14 / numWakes) + velocity;
|
double rad = (14 / numWakes) + velocity;
|
||||||
for (Arc arc : arcs) {
|
for (Arc arc : arcs) {
|
||||||
arc.setRadiusX(rad);
|
arc.setRadiusX(rad);
|
||||||
arc.setRadiusY(rad);
|
arc.setRadiusY(rad);
|
||||||
rad += (14 / numWakes) + (velocity / 2.5);
|
rad += (14 / numWakes) + (velocity / 2.5);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// } else {
|
// } else {
|
||||||
// rotations[0] = rotation;
|
// rotations[0] = rotation;
|
||||||
// ((Rotate) arcs[0].getTransforms().get(0)).setAngle(rotation);
|
// ((Rotate) arcs[0].getTransforms().get(0)).setAngle(rotation);
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package seng302.v.map;
|
package seng302.visualiser.map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Boundary class represents a rectangle territorial boundary on a map. It
|
* The Boundary class represents a rectangle territorial boundary on a map. It
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package seng302.v.map;
|
package seng302.visualiser.map;
|
||||||
|
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import javafx.geometry.Point2D;
|
import javafx.geometry.Point2D;
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package seng302.v.map;
|
package seng302.visualiser.map;
|
||||||
|
|
||||||
import javafx.geometry.Point2D;
|
import javafx.geometry.Point2D;
|
||||||
import seng302.model.GeoPoint;
|
import seng302.model.GeoPoint;
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package seng302.v.map;
|
package seng302.visualiser.map;
|
||||||
|
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.ResourceBundle;
|
import java.util.ResourceBundle;
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
<?import javafx.scene.canvas.Canvas?>
|
<?import javafx.scene.canvas.Canvas?>
|
||||||
<?import javafx.scene.layout.Pane?>
|
<?import javafx.scene.layout.Pane?>
|
||||||
<Pane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="960.0" prefWidth="1280.0" style="-fx-background-color: #ddd;" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="seng302.v.map.TestMapController">
|
<Pane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="960.0" prefWidth="1280.0" style="-fx-background-color: #ddd;" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="seng302.visualiser.map.TestMapController">
|
||||||
<children>
|
<children>
|
||||||
<Canvas fx:id="mapCanvas" height="960.0" width="1280.0" />
|
<Canvas fx:id="mapCanvas" height="960.0" width="1280.0" />
|
||||||
</children>
|
</children>
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import static org.junit.Assert.assertEquals;
|
|||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import seng302.model.GeoPoint;
|
import seng302.model.GeoPoint;
|
||||||
import seng302.v.map.MercatorProjection;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unit test for Mercator Project class.
|
* Unit test for Mercator Project class.
|
||||||
|
|||||||
Reference in New Issue
Block a user