Commit Graph

733 Commits

Author SHA1 Message Date
Michael Rausch d2fd9ebaea Started work on start screen
- Server now sends out race start status messages during lobby & pre-start stages
- Added timer in lobby

Tags: #story[1109]
2017-08-11 19:03:57 +12:00
Michael Rausch 3ad37faedc Merge branch 'develop' into MessageExtensions 2017-08-10 19:01:46 +12:00
Michael Rausch 09c4f98056 Implemented new client - server handshake protocol
- Implemented new packet types
- Changed server & client logic to use new protocol

Tags: #story[1124] (Issue 39)
2017-08-10 19:01:30 +12:00
William Muir 0b8ad137b3 Minor fixes for merge
#story[1124] #pair[wmu16, hyi25]
2017-08-10 17:47:24 +12:00
Michael Rausch 1772d1c05e Merge branch '1124_Mark_Rounding_Implementation' into 'develop'
1124 mark rounding implementation

# ChangeLog 

* Implemented Mark Rounding Algorithm so the server acknowledges when boats pass around and through marks / gates 
* Compound Mark class changed so that it has one constructor which takes a list of Mark objects
* GeoUtility has had many methods added to it for purposes of deducing mark rounding

# Testing 

* JUnit tests done for GeoUtility Class
* JUnit tests done for CompoundMark Class
* Test class removed for Yacht Class as no longer testable
* Manual test-log entry made for mark rounding in game

See merge request !53
2017-08-10 17:20:33 +12:00
William Muir 1d7b527130 Tidied code. Added tests
#story[1124] #pair[wmu16, hyi25]
2017-08-10 16:45:30 +12:00
William Muir 9c79897e01 Tidied code, added MidPoint to CompoundMark class
Compound Mark class is now constructed with a list of marks.
A mid point is created on its construction for use in Geo Calculations

#story[1124] #pair[wmu16, hyi25]
2017-08-10 13:58:32 +12:00
William Muir abb15f6edf Fixed Mark rounding Algorithm
Algorithm now knows when a player has to round a gate or just pass right through

#story[1124] #pair[wmu16, hyi25]
2017-08-10 12:08:03 +12:00
William Muir 87f2f1fe63 Fixed Mark rounding Algorithm
Algorithm now knows when a player has to round a gate or just pass right through

#story[1124] #pair[wmu16, hyi25]
2017-08-10 12:07:47 +12:00
William Muir 249ad9e5c0 Fixed Mark rounding Algorithm
Algorithm now knows when a player has to round a gate or just pass right through

#story[1124] #pair[wmu16, hyi25]
2017-08-10 12:02:19 +12:00
William Muir a545e9dbc3 Removing '>' characters from docstrings to fix build
Note: This is probably a XML style guid thing and is stupid. Can probably fix this
2017-08-08 16:14:13 +12:00
William Muir b0e7dddaf3 Fixed gate passing algorithm
boats now must pass through the correct way. This works for start in-race and finish gates
Refactored yacht algorithm code for better readability
Logging function added or seeing mark roundings occur

tags: #story[1124] #pair[hyi25, wmu16]
2017-08-08 15:58:13 +12:00
Haoming Yin ed0a783374 Fixed the bug that boats could round over a gate but still "across" it. Added unit test to ensure the algorithm works.
tags: #story[1124]
2017-08-08 10:42:36 +12:00
William Muir 4375b73257 Implemented algorithm for checking if boat passes through a mark.
Mark rounding works for whole course (WITH BUGS)
Still some gate logic to work out.
Moved gate function to GeoUtil class

tags: #story[1124] #pair[hyi25, wmu16]
2017-08-07 17:28:12 +12:00
William Muir 7f0329dda6 WIP: Implemented basic mark rounding algorithm.
Removed RacePosition class. Instead marks are just grabbed from the mark order class when necessary.
No marks are stored as an attribute in the yacht class but the 'currentMarkSeqID' which is used to get current, and surrounding marks.
Works for all marks in between but not including starting and finishing gate as no angle can be made with them. Still to work out how to implement this

 #story[1124]
2017-08-07 00:23:54 +12:00
Haoming Yin 43788bd153 Added a method to test if a geo point is located in a triangle which is formed by other three geo points.
The method helps to check the mark rounding.

Also unit tests have been done for this method.

tags: #story[1124]
2017-08-06 12:36:57 +12:00
William Muir e90a0ce435 Merge branch '1124_Mark_Sequence_From_RaceXML' into 'develop'
Loading mark sequence from RaceXML

# Loading mark sequence from RaceXML

## Change Log
1. Added MarkOrder class
* Mark order is read from the generated RaceXML and stored
* Added .getNextMark() to get the next mark in the race
* Added .equals() and .hashCode() for Marks
* NEW: Added RacePosition class to hold players position in the race
* NEW: Fixed issue where the duplicates weren't stored in the mark order

## Testing
* Unit tests in models/MarkOrderTest.java

## Acceptance Criteria
* Use the mark sequence in the raceXML
    * Met by change log item (1)

* Store relevant mark details with each participating boat (Last mark, next mark)
    * Method in MarkOrder to get next mark, however the last mark and next mark will need to be stored by whoever implements the second task.

See merge request !52
2017-08-05 15:18:26 +12:00
Michael Rausch 281ce2d842 Loading course mark order from RaceXML
- Re-engineered code to work with the new marks
- Fixed bug where race order wasn't correct (added RacePosition class to fix)
- Rewrote tests to work with new RacePosition class

Tags: #story[1124] (Task 1)
2017-08-04 13:20:50 +12:00
William Muir 874cdec654 Added booleans: has entered rounding zone, has crossed first line, has crossed second line
All for purposes of checking mark rounding.

Currently not yet finished

tags: #story[1124] #pair[hyi25, wmu16]
2017-08-03 17:39:07 +12:00
William Muir 423f1acdb6 Merge remote-tracking branch 'origin/develop' into develop 2017-08-03 16:29:22 +12:00
William Muir 454e9ac9f1 Added an attribute to each yacht: 'DistanceToNextMark'
This attribute is calculated at each update of the boat as prompted by the game state regularly
Removed the lat and lng attribute from the Yacht class and replaced its usage with the GeoPoint object instead

Removed redundant test files and merged GeoUtility and testGeoUtil test classes into one

tags: #story[1124] #pair[hyi25, wmu16]
2017-08-03 16:29:12 +12:00
Zhi You Tan 1ab849fd0d Added cucumber dependency. 2017-08-03 14:02:52 +12:00
William Muir db078538ff Minor cleaning in yacht class
tags: #story[1124]
2017-08-03 13:53:30 +12:00
Calum 1c0d869894 Corrected a value in the race.xml 2017-08-03 13:49:53 +12:00
Calum f9e6df46c1 Fixed issues caused by merge.
#bug
2017-08-03 13:23:43 +12:00
Calum 5228c078bc Merge branch 'develop' into 1124_Mark_Sequence_From_RaceXML
# Conflicts:
#	src/main/java/seng302/gameServer/GameState.java
#	src/main/java/seng302/gameServer/server/simulator/Simulator.java
#	src/main/java/seng302/models/mark/Mark.java
#	src/main/java/seng302/visualiser/map/CanvasMap.java
2017-08-03 12:27:11 +12:00
William Muir f5f73ede6b Merge branch 'story61_player_perspective' into 'develop'
Big boy merge request. Issue 34. Issue 35.

# This merge request is to fix **Issue 34** and **Issue 35**
*This is will require some further work but is being added to develop as is*

# Changelog

## Mark classes from server now used in client also.
The mark setup client side was poor because all marks were of type AbstractMark but they all had different methods so you had to identify what kind of mark they were anyway. The server side implementation
used the same calls for all Mark types and had the bonus of a GeoPoint class with utilities for distance and calculations.

## Yacht Class now contains observable values
The yacht attributes used by the model are now observable.

## StreamParser now static utils class.
Data no longer needs to be stored in the staticly available thread. Can now be processed in a more direct fashion by classes calling the parsing utils when needed.

## XMLParser now static utils class.
XMLParser now converts XML formatted doc objects and returns the containing data, this removes the need for the class to store multiples kinds of XML data and can instead just return it for use elsewhere.

## Data storage classes added to java/seng302/model/stream/parser
Rather than the StreamParser updating the Model directly it just processes the data into basic data types and shoves it all into objects for processing elsewhere. This avoids the static StreamParser class needing to know about Model objects.

## All static ultilities moved to their own package to make them easier to locate. Any child classes moved to their own files and added to packages in the model package.

## All visualiser code moved to the a new visualiser package

## Grouped all high level logic for the app and data management.
Previously all the high level logic (e.g. when to start a race, what fxml to show, how to process data from the stream) was in a number of classes. Mainly StreamParser, Controller, StartScreenController, RaceViewController, BoatGroup and LobbyController. All of this has been grouped into GameClient.
* This reduces the need to share data between these classes. Previously all the controllers needed references to one another to work so they were essentially the same class anyways.
* This makes it easier to find specific logic.
* Everything is now accessabile from GameClient, or from something GameClient knows about, making it easier to pass information if needed.

## Logic removed from LobbyController. Now only displays information

## Annotation box now a generic case for a rectange containg any number or type of annotation.
This means that if any new annotation needs to be added you don't have to hard code a specific case for it. Just initialize the annotation in the box at anytime.

## GameClient now observes the state of Yacht and Marker classes for position changes and updates them accordingly.
This avoids having to pass data to the GameView and having to poll for changes.

## CanvasController renamed GameView, now only concerned with displaying the race.
Moved all unnecessary logic to GameClient. Also fixed some issues where it polled RaceViewController for data instead of being updated by RaceViewController.

## MarkerObjects now a simple circle bound to the location of a given Mark. To display a gate lines are bound between the circles bound to Marks if a CompoundMark has more than one Mark.
Made all the logic here much more straight forward.

## Replaced most public static data classes with listeners.
Removed a bunch of polling. Made sharing data simplier and more readable.

# Known Issues & Limitaitons

* Pretty much everything that wasn't working at the end of sprint 5.
* Because listeners are triggering stuff on the JavaFX thread you have to use `Platform.runLater(() -> {//Do stuff});` whenever you want to access FX stuff from other threads. You can't just be lazy and put everything in it because then the JavaFX thread goes really slow. This is actually good practice anyways since you want to process data off of them FX thread (so not anything that's not triggered by a controller or an event) to keep JavaFX responsive.
* There is a 100% chance stuff has broken with this refactor that I'm not aware of. Some of it I am aware of.

# Testing

Good joke. I did manual testing though.

# Acceptance criteria

It works more or less.

See merge request !50
2017-08-03 12:11:20 +12:00
William Muir 1160f274ee Reformatted code in appropriate style
Build fails server side only due to some dependency issue. Internet problem server side?? (M I C H A E L?)

tags: #issue[34]
2017-08-03 12:06:07 +12:00
William Muir 53f5d63f15 Fixed build. (Actually this time) ((NOW WERE READY TO MERGE)))
All doc string annotations were required to be fixed for all methods

tags: #issue[34]
2017-08-03 11:50:07 +12:00
William Muir 1150ec3e43 Merge branch 'develop' into story61_player_perspective
# Conflicts:
#	src/main/java/seng302/App.java
2017-08-03 11:48:54 +12:00
William Muir c655cb3fab Fixed build. (Actually this time)
All doc string annotations were required to be fixed for all methods

tags: #issue[34]
2017-08-03 11:45:14 +12:00
William Muir 8e24c204fd Fixed build.
Google map does not work

tags: #issue[34]
2017-08-03 11:26:44 +12:00
Michael Rausch 7885b3fae2 Loading course mark order from RaceXML
- Mark order is read from the generated RaceXML and stored
- Added .getNextMark() to get the next mark in the race
- Added .equals() and .hashCode() for Marks

Tags: #story[1124] (Task 1)
2017-08-02 22:03:10 +12:00
Michael Rausch b01d39f19f Merge remote-tracking branch 'origin/develop' into develop 2017-08-02 20:42:22 +12:00
Michael Rausch bbf494e9a1 Merge branch 'master' into 'develop'
Merge Master into develop



See merge request !51
2017-08-02 20:42:07 +12:00
Michael Rausch eae201cb4b Merge remote-tracking branch 'origin/develop' into develop 2017-08-02 20:32:43 +12:00
Calum 87ef37a689 Fixed connecting to hosts. Fixed issue34 and 35 to the point where they can be developed off of.
#refactor #bug #issue[34, 35]
2017-08-02 00:26:57 +12:00
Alistair McIntyre b2c7b65191 Merge branch 'Logging' into 'master'
Added dependencies for slf4j



See merge request !49
2017-08-01 15:20:41 +12:00
Calum 908c0749cf Boats now move on screen as intended.
TODO - Make the client connect to the server.
2017-08-01 02:37:55 +12:00
Calum 47c5e6f155 Reverting some new graphics classes back to how they were on master. 2017-07-31 23:35:28 +12:00
Michael Rausch 9deba732b0 Added dependencies for slf4j 2017-07-31 18:34:55 +12:00
Calum b82d0d0137 Boats and map are now updated using the observer pattern.
#implement
2017-07-31 05:23:41 +12:00
Calum f1ad03e913 Refactored the setup for MarkObjects (now renamed Markers) and made the CompoundMark + Mark + GeoPoint classes the standard across all classes instead of GateMark + SingleMark + Mark.
#refactor
2017-07-31 02:19:19 +12:00
Calum 6cae338c1e Began fixing bugs with caused by asynchronous listener calls.
#bug
2017-07-30 20:12:19 +12:00
Calum 7894e31926 Merge branch 'develop' into story61_player_perspective
# Conflicts:
#	src/main/java/seng302/App.java
#	src/main/java/seng302/client/ClientPacketParser.java
#	src/main/java/seng302/client/ClientState.java
#	src/main/java/seng302/client/ClientStateQueryingRunnable.java
#	src/main/java/seng302/controllers/Controller.java
#	src/main/java/seng302/controllers/LobbyController.java
#	src/main/java/seng302/controllers/RaceViewController.java
#	src/main/java/seng302/controllers/StartScreenController.java
#	src/main/java/seng302/fxObjects/BoatAnnotations.java
#	src/main/java/seng302/gameServer/GameState.java
#	src/main/java/seng302/gameServer/MainServerThread.java
#	src/main/java/seng302/model/Yacht.java
#	src/main/java/seng302/model/stream/StreamReceiver.java
#	src/main/java/seng302/visualiser/ClientToServerThread.java
#	src/main/java/seng302/visualiser/GameView.java
#	src/main/java/seng302/visualiser/fxObjects/BoatObject.java
#	src/test/java/seng302/model/stream/StreamReceiverTest.java
2017-07-30 18:07:28 +12:00
Michael Rausch 25d8c8f9c4 Minor bug fixes.
Server will now only save incoming connections if in lobbying mode as it should
Commented out boat status printing

tags: #story[1047]
sprint_5.0
2017-07-27 14:15:55 +12:00
Zhi You Tan 1d9dd76356 For client's lobby view, it now can shows the connected host IP
#story[1055]
2017-07-27 13:12:53 +12:00
Zhi You Tan c2c34705d5 removed an unnecessary print statement and caught an exception 2017-07-27 13:01:04 +12:00
Zhi You Tan 96ed5e445e Replaced print stack trace with print statements 2017-07-27 12:47:18 +12:00
Kusal Ekanayake 870dc07fd2 Slight improvements to hosting.
Allow a host/client to disconnect and reconnect/make lobby, leave lobby and play the game.

#pair[kre39,hyi25] #story[1047]
2017-07-27 12:45:22 +12:00