Merge remote-tracking branch 'remotes/origin/master' into spectate_mode_basic
This commit is contained in:
@@ -67,7 +67,9 @@ public class NetworkInterface {
|
||||
HostedGamesRequestEncoder encoder = new HostedGamesRequestEncoder();
|
||||
try {
|
||||
byte[] message = encoder.encode(new HostGamesRequest(games));
|
||||
System.out.println(LocalDateTime.now() + ": Sending " + games.size() + " game/s");
|
||||
for(ClientAddress address: clientsAddresses) {
|
||||
System.out.println("Sending to " + address.getIp());
|
||||
serverSocket.send(new DatagramPacket(message, message.length, InetAddress.getByName(address.getIp()), 4941));
|
||||
}
|
||||
} catch (InvalidMessageException | IOException e) {
|
||||
@@ -85,6 +87,7 @@ public class NetworkInterface {
|
||||
scheduler.scheduleAtFixedRate(new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
System.out.println("flush");
|
||||
matchTable.getMatchTable().clear();
|
||||
}
|
||||
}, period, period);
|
||||
|
||||
@@ -91,7 +91,7 @@ public class RaceLogic implements RunnableWithFramePeriod, Observer {
|
||||
server.parseSnapshot();
|
||||
|
||||
|
||||
waitForFramePeriod(previousFrameTime, currentTime, 50);
|
||||
waitForFramePeriod(previousFrameTime, currentTime, 16);
|
||||
previousFrameTime = currentTime;
|
||||
}
|
||||
}
|
||||
@@ -128,7 +128,7 @@ public class RaceLogic implements RunnableWithFramePeriod, Observer {
|
||||
race.setBoatsStatusToRacing();
|
||||
}
|
||||
|
||||
waitForFramePeriod(previousFrameTime, currentTime, 50);
|
||||
waitForFramePeriod(previousFrameTime, currentTime, 16);
|
||||
previousFrameTime = currentTime;
|
||||
|
||||
}
|
||||
@@ -206,7 +206,7 @@ public class RaceLogic implements RunnableWithFramePeriod, Observer {
|
||||
previousFrameTime = currentTime;
|
||||
}
|
||||
|
||||
waitForFramePeriod(previousFrameTime, currentTime, 50);
|
||||
waitForFramePeriod(previousFrameTime, currentTime, 16);
|
||||
previousFrameTime = currentTime;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ public class Constants {
|
||||
* Frame periods are multiplied by this to get the amount of time a single frame represents.
|
||||
* E.g., frame period = 20ms, scale = 5, frame represents 20 * 5 = 100ms, and so boats are simulated for 100ms, even though only 20ms actually occurred.
|
||||
*/
|
||||
public static final int RaceTimeScale = 10;
|
||||
public static final int RaceTimeScale = 2;
|
||||
|
||||
/**
|
||||
* The race pre-start time, in milliseconds. 30 seconds.
|
||||
|
||||
@@ -15,6 +15,7 @@ import javafx.scene.control.Label;
|
||||
import javafx.scene.image.ImageView;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.layout.GridPane;
|
||||
import javafx.scene.paint.PhongMaterial;
|
||||
import javafx.scene.shape.MeshView;
|
||||
import mock.app.Event;
|
||||
import network.Messages.Enums.RaceStatusEnum;
|
||||
@@ -144,6 +145,8 @@ public class InGameLobbyController extends Controller {
|
||||
subjects.add(sea);
|
||||
|
||||
MeshView mesh = new MeshView(importer.getImport());
|
||||
PhongMaterial boatColorMat = new PhongMaterial(boat.getColor());
|
||||
mesh.setMaterial(boatColorMat);
|
||||
Subject3D subject = new Subject3D(mesh,0);
|
||||
subjects.add(subject);
|
||||
|
||||
@@ -161,7 +164,7 @@ public class InGameLobbyController extends Controller {
|
||||
};
|
||||
rotate.start();
|
||||
|
||||
allPlayerLabels.get(count).setText("Player: " + boat.getSourceID());
|
||||
allPlayerLabels.get(count).setText(boat.getName());
|
||||
allPlayerLabels.get(count).toFront();
|
||||
count += 1;
|
||||
if (count > 2){
|
||||
|
||||
@@ -305,6 +305,8 @@ public class RaceViewController extends Controller {
|
||||
} else {
|
||||
mesh = new MeshView(importerBurgerBoat.getImport());
|
||||
}
|
||||
PhongMaterial boatColorMat = new PhongMaterial(boat.getColor());
|
||||
mesh.setMaterial(boatColorMat);
|
||||
Subject3D boatModel = new Subject3D(mesh, boat.getSourceID());
|
||||
|
||||
viewSubjects.add(boatModel);
|
||||
|
||||
@@ -9,12 +9,12 @@ public class GraphCoordinate {
|
||||
/**
|
||||
* X (horizontal) coordinate.
|
||||
*/
|
||||
private final int x;
|
||||
private final double x;
|
||||
|
||||
/**
|
||||
* Y (vertical) coordinate.
|
||||
*/
|
||||
private final int y;
|
||||
private final double y;
|
||||
|
||||
/**
|
||||
* Constructor method.
|
||||
@@ -22,7 +22,7 @@ public class GraphCoordinate {
|
||||
* @param x X coordinate.
|
||||
* @param y Y coordinate.
|
||||
*/
|
||||
public GraphCoordinate(int x, int y) {
|
||||
public GraphCoordinate(double x, double y) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
@@ -33,7 +33,7 @@ public class GraphCoordinate {
|
||||
*
|
||||
* @return x axis Coordinate.
|
||||
*/
|
||||
public int getX() {
|
||||
public double getX() {
|
||||
return x;
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ public class GraphCoordinate {
|
||||
*
|
||||
* @return y axis Coordinate.
|
||||
*/
|
||||
public int getY() {
|
||||
public double getY() {
|
||||
return y;
|
||||
}
|
||||
|
||||
|
||||
@@ -239,8 +239,8 @@ public class ResizableRaceCanvas extends ResizableCanvas {
|
||||
|
||||
|
||||
//Offset by 20 pixels horizontally.
|
||||
long xCoord = coordinate.getX() + 20;
|
||||
long yCoord = coordinate.getY();
|
||||
double xCoord = coordinate.getX() + 20;
|
||||
double yCoord = coordinate.getY();
|
||||
|
||||
//If the text would extend out of the canvas (to the right), move it left.
|
||||
if (xCoord + (text.length() * 7) >= getWidth()) {
|
||||
|
||||
@@ -26,6 +26,7 @@ public class MatchBrowserInterface {
|
||||
|
||||
public MatchBrowserInterface() {
|
||||
try {//132.181.16.13 is the ip of the CI as of 13/9/17
|
||||
//this.IPAddress = InetAddress.getByName("umbrasheep.com"); //InetAddress.getLocalHost();
|
||||
this.IPAddress = InetAddress.getByName("132.181.16.13"); //InetAddress.getLocalHost();
|
||||
} catch (UnknownHostException e) {
|
||||
e.printStackTrace();
|
||||
|
||||
@@ -67,8 +67,8 @@ public class GPSConverter {
|
||||
|
||||
//Calculate the x and y pixel coordinates.
|
||||
//We take the complement of latProportion to flip it.
|
||||
int x = (int) (longProportion * smallerDimension);
|
||||
int y = (int) (latProportion * smallerDimension);
|
||||
double x = (longProportion * smallerDimension);
|
||||
double y = (latProportion * smallerDimension);
|
||||
|
||||
//Because we try to maintain the correct aspect ratio, we will end up with "spare" pixels along the larger dimension (e.g., width 800, height 600, 200 extra pixels along width).
|
||||
double extraDistance = Math.abs(longitudeFactor - latitudeFactor);
|
||||
|
||||
Reference in New Issue
Block a user