Tried to merge game loop with the broadcast. Minor error in canvas. need to fix.

#story[1047]
This commit is contained in:
Kusal Ekanayake
2017-07-23 17:37:45 +12:00
parent 41851ee925
commit ed2a22b573
4 changed files with 7 additions and 14 deletions
@@ -64,18 +64,16 @@ public class ServerToClientThread implements Runnable {
sourceId = GameState.getUniquePlayerID();
if (threeWayHandshake(sourceId)) {
serverLog("Successful handshake. Client allocated id: " + sourceId, 1);
GameState.addYacht(sourceId,
new Yacht("Kappa", "Kap", new GeoPoint(0.0, 0.0), 0.0));
GameState.addPlayer(new Player(socket)); //Is this neccesary???
Yacht yacht = new Yacht("Yacht", sourceId, sourceId.toString(), "Kap", "Kappa", "NZ");
// Yacht yacht = new Yacht("Kappa", "Kap", new GeoPoint(57.6708220, 11.8321340), 90.0);
GameState.addYacht(sourceId, yacht);
GameState.addPlayer(new Player(socket, yacht));
} else {
serverLog("Unsuccessful handshake. Connection rejected", 1);
closeSocket();
return;
}
Yacht yacht = new Yacht("Yacht", sourceId, sourceId.toString(), "Kap", "Kappa", "NZ");
// Yacht yacht = new Yacht("Kappa", "Kap", new GeoPoint(57.6708220, 11.8321340), 90.0);
GameState.addYacht(sourceId, yacht);
GameState.addPlayer(new Player(socket, yacht));
seqNo = 0;
thread = new Thread(this);
thread.start();