Skip to content

Java project made for university course; JUnit, JavaFX, proper UMLs

Notifications You must be signed in to change notification settings

Bartor/chinesecheckers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Chinese Checkers

Great fun

~someone, probably

Introduction

Java project made for university course using frontend in JavaFX, custom written backend using plain sockets and Junit tests.

Authors:

  • @Bartor
  • @pi-kolo

Structure

The project is divided into three main parts:

Each part has a distinct role and specification.

Model

Model divides the game into crucial parts. It defines behaviour of the pieces, structure of the board, holds players etc. The entry point for model is AbstractGame in the Game package, implemented by BasicGame (which is actually used by this particular front- and backend). It holds all the players (Player) and BoardMovementInterface, lets you add more players and more.

Next two important classes are Player and BoardMovementInterface highlighted before. Each Player holds and Army, which consists of pieces (Piece). Army is important, because it let's you search for a piece using only position and also allows one player to have multiple armies in the future. A singlie Piece has its position represented by a PiecePosition to allow easier comparisons and method calls.

BoardMovementInterface implemented by BasicBoardMovement takes care of moving the pieces. It holds a BoardInterface implemented by BasicBoard which represents starting (and winning at the same time) positions for all the players as well as current piece positions. BoardMovementInterface allows to make moves and changes position both in the involved pieces and its BoardInterface.

Simple model diagram:

UML of the Model classes

Backend

Entry point for the backend is a console application Main which is started with params port number_of_players board_file. File is then loaded and send to all connecting players, so they don't really have to have it locally at all. Server is multi-threaded and each client has its separate thread.

Socketing holds all classes important for sending and receiving data. Server allows players to connect and ServerClient launches a separate thread, receives new data from its client, passes it to MessageInterpreter (described below) and then read from the MessageQueueSingleton which hold everything each clients has to receive. The data is compared to that already sent to a particular client and then updated accordingly.

MessageInterpreter interprets incoming messages and then modifies game stored int GameSingleton accordingly, also updated the queue at MessageQueueSingleton.

Frontend

Frontend manages interactions with user and defines connection with a server. Stating point of the frontend is ChineseCheckersApplication which launches the JavaFX interface. Packages inside the frontend include util, networking and controllers which I'll explain now shortly.

controllers package contains the most important class of user-side game, AbstractController. All the other scene controllers extend it. It holds and instance of the game, a reference to SceneController (described below) and defines basic interaction between controllers and it. There are three scenes, Game, Pregame and Start with controllers named alike.

networking holds connectivity and interaction with the server. It defines a Client which launches a ClientThread which fetches data from server in given intervals. MessageInterpreter is then used to analyze this messages and then proceeds to use NetworkControllerFacade (described below) to change the ui.

util package holds everything which couldn't be put anywhere else. It has BoardField and LobbyUser classes which are used to create particular repeating patterns in the ui. NetworkControllerFacade and ControllerNetworkFacade are an addition abstraction layer between the ui and the networking, which should allow to easily extend the application.

Networking

Network in this project heavily relies on the message queues idea which makes it kind of possible to achieve some level of asynchronous processing of incoming data. Network activity diagram below illustrates it very good:

UML of the network

Further documentation

All classes are documented using javadoc compliant comments, you can generate yourself docs using your favourite javadoc tool.

About

Java project made for university course; JUnit, JavaFX, proper UMLs

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages