Skip to content

Java client-server multiplayer version of the board game Santorini

Notifications You must be signed in to change notification settings

andrea-gi/Santorini

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Software Engineering - Bachelor of Science thesis project 2019-2020

Group PSP034

This final examination project consists in a Java implementation of the board game Santorini. The main pattern used is a distributed MVC (model-view-controller), in order to create an online multiplayer version of the game.

Final score: 30/30 (A).

Table of Contents

Implemented Features

Standard Features

  • Complete Rules
    • 2 or 3 players game
    • Simple gods (1-10, except Hermes)
  • Socket Connection
  • CLI
  • GUI (JavaFX)

Advanced Features

  • Advanced gods (5):
    • Hera
    • Hestia
    • Limus
    • Triton
    • Zeus

How to start JARs

⚠️ Java JRE version 9 or higher is required.

⚠️ A terminal with full ANSI escape sequences, CSI sequences and UTF-8 support is required to run the terminal (CLI client and server log) properly. UNIX terminal, Windows Terminal or ConEmu are suggested.

Both client.jar and server.jar contain all the necessary dependencies (JavaFX) for Windows, Linux and MacOS.

Run Server

Download server.jar here.

In order to start server listening to socket connections on the default port (2020) run:

java -jar server.jar

Otherwise, to start a server listening to socket connections on a specified valid PORT (otherwise 2020 will be used) run:

java -jar server.jar PORT

Run Client

Download client.jar here.

CLI

⚠️ Make sure that the terminal font is monospaced and that the terminal size is at least 230x50.

In order to start a Command Line Interface (CLI) client run:

java -jar client.jar cli

If you are experiencing troubles, change the font size until it looks like this:

Screen Test

Title

GUI

In order to start a GUI client, you can just double-click client.jar, or run:

java -jar client.jar

How to create JARs

If you would rather create your own JARs, you can use the included Maven profiles:

  • Server profile generates server.jar (active by default).
  • Client profile generates client.jar.

Instructions (from JetBrains IntelliJ IDEA)

⚠️ Only a single profile should be active when creating a package.

  1. Open Maven sidebar
  2. Open Profiles and Santorini → Lifecycle
  3. Select a profile
  4. Run Santorini → Lifecycle → Clean
  5. Run Santorini → Lifecycle → Package
  6. Repeat for each desired profile

Documentation

The project documentation includes UML diagrams, JavaDoc and JUnit4 test coverage.

UML

Both high level design and detailed design diagrams were created.

The first one is an updated version of the initial UML, featuring a concise and schematic representation of the model-controller implementation.

Meanwhile, the latter consists in multiple diagrams, each one with a specific scope, collapsing redundant information:

JavaDoc

JavaDoc is available for every project package. Almost every class and method features a brief JavaDoc description, except for a few obvious getters and setters.

Test Coverage

Model and controller packages have been tested using JUnit4. Code coverage for both packages is over 95%.

Miscellaneous

Error codes

Error Code Description
CXXX Client Errors
C001 IOException while client is sending a message. Usually caused by server unreachable.
C002 IOException while client is waiting for a message. Usually caused by server unreachable.
C003 Fatal error in client. Game cannot continue.
C004 Client could not establish a connection to the server.
SXXX Server Errors
S001 Another client has disconnected. Game has ended.
S002 Server is not responding. Heartbeat timeout expired.
S003 Severe server error. A message received by the game server was irreparably corrupted.

Server log

The best way to run the server is via terminal interface (with ANSI colors support), since it features a detailed log, useful for debug reasons (e.g. it contains messages exchanged, along with their content). The implemented colors are:

Send when a message is sent by the server

Receive when a message is received by the server

Red or underline when an important state change occurs (e.g. current player changes or server restarts)

Clients are assigned a temporary random numeric ID as soon as they connect to the server. They are identified by their ID until name and color are chosen. Message sender or recipient can be easily recognised by the player color chosen during the registration to the server, possible colors are:

Red Red

Blue Blue

Magenta Magenta

Headless server works continuously in background (not suggested, as it cannot be shut down without killing JVM process and there is no visible log).

Made by:

About

Java client-server multiplayer version of the board game Santorini

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •