Also got client-server handshake working. Multiple clients can connect and control their own boat.
The client's boat has a larger black triangle drawn around it. Probably needs tidying up.
Added isClientBoat boolean to VisualiserBoat.
WindGenerator is now an interface, implemented by ConstantWindGenerator (useful for testing) and RandomWindGenerator. Added ConstantWindGeneratorTest.
RandomWindGenerator was formerly WindGenerator.
The WindGenerator is passed in to MockRace.
CommandFactory throws a CommandConstructionException if it cannot create a command.
MessageSerialiser and MessageDeserialiser correctly terminate on error.
Readded VisualiserInput's switch statement in the main loop, pending a refactor.
Removed the sleep statement from LobbyController - it was blocking javaFX thread.
Lobby.fxml: moved buttons and text input into grid panes, so they don't break when you resize screen.
Added some test object creation functions in several test classes (MockRaceTest.createMockRace(), BoatXMLReaderTest.createBoatDataSource(), etc...).
#story[1095]
Pom profile fix
The racevisionGame pom still had "profiles", which aren't needed with a single jar build, and the built jar didn't have a mainifest/main class.
See merge request !19
Issue 28 & 36 - encoders and decoders refactor
This resolves#28#36.
This was on the story_61 branch, but I figured it may be helpful to push this into master/other branches before then.
The main changes:
- Moved encoding functions from RaceVisionByteEncoder into their own encoder classes.
- Added a EncoderFactory and DecoderFactory, which return correct en/decoder based on MessageType.
- All encoders implement MessageEncoder interface, and all decoder implement MessageDecoder interface.
Extra changes:
- Added names to most threads that are created.
- Removed the nested while loop from MockOutput, and moved the XML stuff before the main loop (functionally it's the same).
See merge request !23
63. [C, M] I'd like to be able to make small adjustments to the heading of my boat, as Gemma, either upwind or downwind.
Note: each keypress should change the boat's heading by a small amount (3 degrees?) Pressing the 'upwind' key will turn the boat's head towards the wind by that small amount, while the 'downwind' key will do the opposite. Continuing to press the downwind key when the boat is already heading straight downwind, or upwind when heading directly upwind, achieves nothing.
Acceptance criteria:
- The player boat turns towards wind a small amount for each press of the 'upwind' key.
- The player boat turns away from the wind by a small amount for each press of the 'downwind' key.
- If the boat heading is directly into wind after a series of 'upwind' keypresses, the heading will continue to change in the same direction for one more keypress.
- Substitute 'downwind' for 'upwind' for the downwind case.
See merge request !21
Wind/Tack commands disable autoVMG. VMG command enables it.
Upwind command was turning until boat was at 0 degrees, instead of being aligned with wind direction, but that's fixed.
#story[1096]
- Figured out the different situations that can occur using accurate points of sail
- Mathed out the rotation angle for each situation
- Manual testing carried out by running simulations
- Manual testing carried out using pen and paper
#story[1098]
Story48 & issue 26
This is the merge request for story 48 (http://agilefant.cosc.canterbury.ac.nz:8080/agilefant302/editProject.action?projectId=61#fi.hut.soberit.agilefant.model.Story_1093) ( #29 ) and issue #26.
A.C:
- Wind speed and direction must follow that provided by the Race Status message or messages.
- Arrow aligned with the current wind direction shown on the live race view.
- Arrow orientation adjusts within 1s when changes in the wind direction are received.
- Arrow length is proportional to wind speed.
- Wind speed in m/s (or as defined in story 17) should be easily estimated from the wind arrow.
The wind speed (TWS) should be shown as both a number and in the length of the wind arrow. The arrow length should be always long enough for TWA (wind direction) to be clear; the length should never drop below some minimum value.
This includes issue #26 as story 48 was slightly dependent on that.
Both #29 and issue #26 should be closed once this has been merged.
See merge request !20
- Implemented drawSails method
- Sail position is displayed and updated using a boat's heading
- Sails conform to 'Points of sail'
- Javadoc'd new method and tidied up existing
- Sped up track point frequency (visualiserBoat class)
- Optimised imports (any other classes changed)
- A lot of canvas drawing and sail rotating issues were discovered and eventually overcome along the way. Using a sail image to draw and rotate on the existing canvas rather than a JavaFX shape on a new canvas was the final decision.
#story[1098]