The start time of the race is no longer scaled by the race speed scalar.

Changed the prestart time to 30 seconds (was 3 minutes).
Changed the preparatory time to 10 seconds (was 1 minute).
Phases: player list +prestart > warning > race view + preparatory + no more joining > started > finished.
main
fjc40 8 years ago
parent ab96884dc6
commit 2ad947b57d

@ -78,8 +78,6 @@ public class Event {
*/ */
public Event(boolean singlePlayer, int mapIndex) throws EventConstructionException { public Event(boolean singlePlayer, int mapIndex) throws EventConstructionException {
// System.out.println(XMLUtilities.validateXML(this.getClass().getClassLoader().getResource("mock/mockXML/iMapLayout.xml").toString()
// , this.getClass().getClassLoader().getResource("mock/mockXML/schema/raceSchema.xsd")));
this.mapIndex = mapIndex; this.mapIndex = mapIndex;
String raceXMLFile; String raceXMLFile;
String boatsXMLFile = "mock/mockXML/boatTest.xml"; String boatsXMLFile = "mock/mockXML/boatTest.xml";
@ -117,6 +115,7 @@ public class Event {
if(mapIndex==4){ if(mapIndex==4){
this.raceXML = Event.setRaceXMLAtCurrentTimeToNow(XMLReader.readXMLFileToString(raceXMLFile, StandardCharsets.UTF_8), 1000, 5000); this.raceXML = Event.setRaceXMLAtCurrentTimeToNow(XMLReader.readXMLFileToString(raceXMLFile, StandardCharsets.UTF_8), 1000, 5000);
} }
this.boatXML = XMLReader.readXMLFileToString(boatsXMLFile, StandardCharsets.UTF_8); this.boatXML = XMLReader.readXMLFileToString(boatsXMLFile, StandardCharsets.UTF_8);
this.regattaXML = XMLReader.readXMLFileToString(regattaXMLFile, StandardCharsets.UTF_8); this.regattaXML = XMLReader.readXMLFileToString(regattaXMLFile, StandardCharsets.UTF_8);
@ -192,7 +191,6 @@ public class Event {
//TODO remove this after demo on 18th august!
/** /**
* Sets the xml description of the race to show the race was created now, and starts in 4 minutes * Sets the xml description of the race to show the race was created now, and starts in 4 minutes
* @param raceXML The race.xml contents. * @param raceXML The race.xml contents.
@ -209,8 +207,6 @@ public class Event {
long secondsToAdd = millisecondsToAdd / 1000; long secondsToAdd = millisecondsToAdd / 1000;
//Scale the time using our time scalar.
secondsToAdd = secondsToAdd / Constants.RaceTimeScale;
DateTimeFormatter dateFormat = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssZ"); DateTimeFormatter dateFormat = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssZ");
ZonedDateTime creationTime = ZonedDateTime.now(); ZonedDateTime creationTime = ZonedDateTime.now();

@ -38,7 +38,7 @@ public class SourceIdAllocator {
if (!((mockRace.getRaceStatusEnum() == RaceStatusEnum.PRESTART) if (!((mockRace.getRaceStatusEnum() == RaceStatusEnum.PRESTART)
|| (mockRace.getRaceStatusEnum() == RaceStatusEnum.WARNING))) { || (mockRace.getRaceStatusEnum() == RaceStatusEnum.WARNING))) {
throw new SourceIDAllocationException("Could not allocate a source ID. Can only allocate during pre-start period. It is currently: " + mockRace.getRaceStatusEnum()); throw new SourceIDAllocationException("Could not allocate a source ID. Can only allocate during pre-start or warning period. It is currently: " + mockRace.getRaceStatusEnum());
} }
List<Integer> allocatedIDs = mockRace.getRaceDataSource().getParticipants(); List<Integer> allocatedIDs = mockRace.getRaceDataSource().getParticipants();

@ -195,8 +195,6 @@ public class RaceXMLCreator {
//The start time is current time + 4 minutes. prestart is 3 minutes, and we add another minute. //The start time is current time + 4 minutes. prestart is 3 minutes, and we add another minute.
long millisecondsToAdd = racePrestartTime + racePreparatoryTime; long millisecondsToAdd = racePrestartTime + racePreparatoryTime;
long secondsToAdd = millisecondsToAdd / 1000; long secondsToAdd = millisecondsToAdd / 1000;
//Scale the time using our time scalar.
secondsToAdd = secondsToAdd / Constants.RaceTimeScale;
DateTimeFormatter dateFormat = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssZ"); DateTimeFormatter dateFormat = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssZ");
ZonedDateTime creationTime = ZonedDateTime.now(); ZonedDateTime creationTime = ZonedDateTime.now();

@ -33,18 +33,20 @@ public class Constants {
* Frame periods are multiplied by this to get the amount of time a single frame represents. * 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. * 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;//10; public static final int RaceTimeScale = 10;
/** /**
* The race pre-start time, in milliseconds. 3 minutes. * The race pre-start time, in milliseconds.
* Official time is 3 minutes.
*/ */
public static final long RacePreStartTime = 3 * 60 * 1000; public static final long RacePreStartTime = 30 * 1000;
/** /**
* The race preparatory time, in milliseconds. 1 minute. * The race preparatory time, in milliseconds. 10 seconds.
* Official time is 1 minute.
*/ */
public static final long RacePreparatoryTime = 1 * 60 * 1000; public static final long RacePreparatoryTime = 10 * 1000;

Loading…
Cancel
Save