-updated port and starboard boat checks
-added gps method to check if on correct side of a line
-updated pos check method to make boats round marks with the new tech
# Conflicts:
# racevisionGame/src/main/java/mock/app/ConnectionAcceptor.java
# racevisionGame/src/main/java/mock/app/Event.java
# racevisionGame/src/main/java/mock/model/commandFactory/TackGybeCommand.java
# racevisionGame/src/main/java/mock/model/commandFactory/VMGCommand.java
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]
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]
- 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]
Refactored MarkRoundingDecoder - it now implements MessageDecoder.
Tidied up MarkRounding - it is now documented and has getters. Also Created MarkRoundingBoatStatusEnum, MarkRoundingIDEnum, MarkRoundingSideEnum, MarkRoundingTypeEnum.
Added MarkRoundingDecoderTest.
issue #35#36
#story[1095]
Refactored AverageWindDecoder - it now implements MessageDecoder.
Refactored AverageWind - it now uses milliseconds and knots, instead of packed MMperSec and tenths of a second. It also exposes its attributes now.
Added (un)packAverageWindPeriod to AC35UnitConverter.
Added AverageWindDecoderTest.
issue #35#36
#story[1095]
Added RaceStartTypeEnum.
Refactored RaceStartStatusDecoder to implement the MessageDecoder interface.
Documented RaceStartStatus, and it actually exposes its properties now.
Updated RaceStartStatusDecoderTest.
issue #35#36
#story[1095]
Added DecoderFactory. This creates an appropriate decoder based on a MessageType.
BoatActionDecoder implements MessageDecoder.
BoatLocationDecoder implements MessageDecoder.
HeartBeatDecoder implements MessageDecoder.
JoinAcceptance implements MessageDecoder.
RaceStatusDecoder implements MessageDecoder.
RequestToJoinDecoder implements MessageDecoder.
XMLMessageDecoder implements MessageDecoder.
Refactored CourseWind decoder/encoder. CourseWind decoder/encoder is for an individual CourseWind.
CourseWinds decoder/encoder is for the combined message from the API.
Documented BoatAction, and it now contains a BoatActionEnum instead of a byte.
Refactored CourseWind and CourseWinds classes. They now expose correct units, instead of packed units.
Added CourseWindDecoderTest, and updated CourseWindsDecoderTest.
issue #35#36
#story[1095]
Removed redundant/unused conversions.
Documented all of the conversions, and renamed them to pack/unpackX, to match the API spec.
Updated/added some tests in AC35UnitConverterTest.
RaceStatus now contains a Bearing instead of a packed int bearing.
RaceStatus now contains wind speed in knots, instead of MMperSec packed.
This means that only RaceStatus decoder/encoder need to care about the bits-over-wire packed values.
issue #35#36
#story[1095]
Refactored RaceStatusDecoder to be more consistent with other decoders - it now has a getMessage() function.
Added BoatStatus encoder and decoder - the RaceStatus encoder and decoder uses this for BoatStatuses. The BoatStatus encoder doesn't implement the MessageEncoder interface as BoatStatus is not a proper message type (doesn't inherit from AC35Data).
Added remaining cases to EncoderFactory, but commented them out.
BoatStatus now uses BoatStatusEnum instead of a byte.
Added some comments to RaceStatus, and it uses enums instead of bytes.
MockOutput logs a warning if a RaceStatus cannot be encoded.
Added a BoatStatusDecoderTest.
Updated RaceStatusDecoder to use new encoders/decoders.
issue #35#36
#story[1095]
Refactored XMLMessageDecoder to be consistent with other decoders - only needs to expose the XMLMessage.
Refactored BoatLocationDecoder to be consistent with other decoders - only needs to expose the BoatLocation.
Updated XMLMessageDecoderTest to use new encoder/decoder. Also tests all three message types.
Removed XMLMessageEncoderTest as it was redundant.
Updated BinaryMessageDecoderTest.xmlMessageTest() to use updated XMLMessage encoder/decoder.
issue #35#36
#story[1095]
Added HeartBeatDecoder.
Added HeartBeatEncoder.
BinaryMessageDecoder now uses HeartBeatDecoder.
MockOutput now logs a warning if a heartBeat cannot be encoded.
Added HeartBeatDecoderTest.
issue #35#36
#story[1095]
Updated ControllerClient to use RaceVisionByteEncoder.encode(message). It also logs a warning if the encoding fails. Also removed pointless and out of place encode/decode of the action enum.
Added a BoatActionDecoderTest which tests encoding/decoding a BoatAction Message.
issue #35#36
#story[1095]
Added EncoderFactory. This creates specific MessageEncoders. Supports JoinAcceptance and RequestToJoin.
Added MessageEncoder interface.
Added JoinAcceptanceEncoder.
Added encode(AC35Data) function to RaceVisionByteEncoder.
Added RequestToJonEncoder.
Updated RequestToJoin and JoinAcceptance decode/encode tests to use the above.
issue #35#36
#story[1095]
- Dispatch commands with CompositeCommand
- Single WindCommand handles upwind and downwind logic
- Changed key bindings as Mac lacks PgUp PgDn
- ControllerServer is observable, RaceLogic updates CompositeCommand as observer
- Created RaceXMLCreator class
- made a function to convert limit to GPS Coordinate (limitToGPSCoordinate)
- can rotate a GPS Coordinate around a point (rotate)
- can get center of a race with (getCenter)
#story[1092]
nightMode.css loads this instead of the regular dark arrow.
ResizableRaceCanvas doesn't cache the race boundary background, as it was unneccessary and stopped the canvas from being transparent.
#story[1093]
Removed arrow control stuff from ResizableRaceCanvas.
Added a wind speed label to arrow.fxml. Also created an outer GridPane to lay things out.
#story[1093]
- ControlKey now includes protocolCode property
- RaceController now fires action with each key press
- Shift toggles sail state appropriately
#story[1089]
- StartController sets up client-wide ControllerClient on socket to game server.
- RaceController now calls ControllerClient.sendKey with each keypress
- ConnectionAcceptor runs ControllerServer for each successfully connected client
#story[1089]
- Converted Event to Singleton for configuring and hosting no more than one game instance.
- Retrieve address and port from ConnectionAcceptor
- Automatically add local host to host list
#story[1010]
- Created a GUI title screen
- Drew images to be display on the title
- Created controller for the title
- Changed visualiser main to initially display title
- Added functionality for host button
#story[1087]
- Removed xml's printing at the start as well as the amount of visualisers connected from spamming the log.
- Issue of visualisers connecting when not actually connecting was actually an visual issue as the log spits out the number of visualisers right now before the loop has gotten rid of the useless sockets.
#story[1010]
- more than one visualiser can now connect to the mock.
- Created class ConnectionAcceptor that will accept and allocate to each socket
- Issue of sockets connecting after the race starts then disconnecting will use a socket slot.
#story[1010]
Made network.MessageEncoders.RaceVisionByteEncoder methods static (they were effectively static already).
shared.dataInput.XMLReader#readXMLFileToString(..) now throws an XMLReaderException if the file cannot be found.
visualiser.Controllers.StartController assumed XML messages were resource paths instead of file contents - fixed.
Testing:
networking tests now work again.
Added shared.enums.XMLFileType, which is used to specify if a string contains a file path or file contents.
Updated the XML readers to use it.
Testing:
Moved the networking tests and resources into racevisionGame module.
Moved the remaining tests from visualiser into racevisionGame, and added a few empty tests to implement later.
Did the bare minimum to get the mock.model, mock.dataInput, shared.model tests working - many of them need to be tidied/refactored/moved as they don't take into account most of the refactorings.
Refactored Sparkline a bit. Now listens to our data model instead of being manually updated. Boat position labels don't work currently, though.
VisualiserRace now also tracks the order in which boats pass each leg.
Fixed a few issues where boat didn't have nextMark/previousMark times under certain circumstances.
LatestMessages wasn't actually notifying properly - fixed.
The various XML readers now treat a string constructor as containing file contents, not file name - this was how it was mostly already used.
Fixed some issues in RaceXMLReader, including where element.getChildNodes() was used instead of element.getElementsByName(...).
Boat: changes speed to a doubleProperty. Changed leg to a Property<Leg>.
Race.lastFps is now an IntegerProperty.
Added breaks to the case statements in VisualiserInput. Whoops.
ResizableRaceCanvas now handles drawing the race boundary. Tidied up code a bit.
Removed ResizableRaceMap.
Started refactoring Sparkline. Currently doesn't work.
Moved FPS tracking to Race class, so both VisualiserRace and MockRace can monitor their FPS.
LatestMessages is now observable. It notifies observers when an XMLMessage is received.
Boat now has StringProperty for name and country/abbreviation.
Moved the MockRace timescale value to Constants.RaceTimeScale. This is passed in to MockRace on construction.
Tidied up StartController.
Copied the visualiser's resources into the resources folder.
Refactored RaceClock. Added comments. Tidied code a bit. Moved to shared.model.
Started work on RaceController.
MockOutput now uses LatestMessages for xml messages.
Moved xml message encoding into RaceVisionByteEncoder. Removed XMLMessageEncoder.
Moved XML message sub types into an enumeration (XMLMessageType).
XMLMessage can now be queried for its attributes (like timestamp, length, etc...).
VisualiserInput now uses LatestMessages.
VisualiserInput now (as it did previously) uses switch statements for checking packet type, instead of if statements.
VisualiserRace now uses LatestMessages instead of VisualiserInput.
Race stores a reference to it. MockRace writes to it, and eventually, VisualiserRace will read from it.
Updated MockRace, MockOutput, Event to use it.
Angle now implements hashCode().
Fixed the networking imports.
Race now keeps a reference to its Race, Boat, and Regatta data sources.
VisualiserRace can be provided with new Race/Boat/Regatta data sources during runtime. Currently it updates boundary and legs with a new RaceDataSource, and marker boats with a new BoatDataSource.
RaceStatus can provide windspeed in knots in addition to mm/sec.
RaceDataSource now provides a list of participating boat sourceIDs instead of boats.
Added a RegattaDataSource interface.
Angle, Azimuth, Bearing and mutable - careful.
Boat has positionInRace.
CompoundMarks have an ID and name.
Marks can be moved (setPosition(...)).
Refactored Mock.Race, Visualiser.StreamedCourse, Visualiser.StreamedRace, into (shared) Race, MockRace, VisualiserRace.
VisualiserBoat has color.
Added xml and polar files into resources folder.
Moved Boat/MockBoat/VisualiserBoat into it.
Moved Polars, polarParser, VMG, and polar exception.
Moved the networking stuff into it.
Moved angle, azimuth, bearing into it.
Moved gpscoordinate into it.
Moved mark/compoundMark into it.
Moved leg into it.
Moved trackpoint into it.