My Shelfie - Board game by Cranio
The project consists of implementing a distributed system, in Java, composed of a single server capable of handling only one game and multiple connected clients (from 2 to 4). Each client can participate in only one game at a time, but the same computer can host multiple clients simultaneously. The MVC (Model-View-Controller) design pattern has been used, and the network connection is managed through both Socket and RMI (Remote Method Invocation). Clients can independently choose to use either of them as games between different technologies are supported. Interactions and gameplay can take place through a command-line interface (CLI) and a graphical user interface (GUI).
-
Elia pontiggia - 10716792
-
Tommaso Pasini - 10717211
-
Tommaso Reffo - 10787027
Email: tommaso.reffo@mail.polimi.it
-
Maurizio Perriello - 10739075
Here you can find the complete specifications: Project Requirements
Functionality | State |
---|---|
Basic Rules | |
Complete rules | |
Socket | |
RMI | |
CLI | |
GUI | |
Chat | |
Server persistence | |
Resilience to client disconnections | |
Multiple parallel matches |
Legend:
UML - (Unified Modeling Language)
JavaDOC
The documentation includes descriptions for the majority of the utilized classes and methods, following Java's documentation techniques. It can be accessed either by generating it from the code or by visiting JavaDOC
Test Coverage - (Server side)
Libraries and Plugins
Library/Plugin | Description |
---|---|
Maven | Build automation tool primarily used for Java projects |
JavaFX | Graphic library to create user interfaces (more innovative than Swing) |
JUnit | Unit testing framework |
1. Java
To run the game you need a runtime environment for applications written in the Java language:
- Install Java Runtime Environment (JRE) - Choose the right version for your Operating System
- Install Java Development Kit (JDK) - Choose the right version for your Operating System
Upon successfully installing Java Runtime Environment (JRE) and Java Development Kit (JDK) on your personal computer, you can verify its proper installation by entering the following command in the terminal:
java -version
2. JavaFX
To visualize the graphical user interface (GUI) properly, you could need command-line tools and technologies that allow you to develop expressive content for applications deployed to browsers, desktops, and mobile devices:
- Download JavaFX Software Development Kit (SDK) - Choose the right version for your Operating System
3. Run locally - (Work on Windows for sure)
Create a folder called 'MyShelfie' and put inside:
i. The JAR file from the artifacts' folder
My Shelfie Server:
Open a terminal and change directory till you are in MyShelfie folder.
Now you can start the server by typing:
java -jar Server.jar
My Shelfie Client:
Open a second terminal and change the directory till you are in MyShelfie folder.
Now you can start the client by typing:
java -jar Client.jar
Issues you could encounter
In all the operating systems - If you can not visualize correctly the images when playing on GUI
Inside the folder 'MyShelfie' created before, insert:
i. The SDK folder that can be downloaded following the instruction in the previous section (unzip it if necessary)
My Shelfie Server:
Run it as before
My Shelfie Client:
Open a second terminal and change the directory till you are in MyShelfie folder.
Now you can start the client by typing:
java --module-path <Name of SDK folder>/lib --add-modules javafx.controls,javafx.fxml -jar Client.jar
#Remember to change <Name of SDK folder> (it should be something like 'javafx-sdk-20.0.1')
A - Windows
-
If you are utilizing Windows 10 or a later version, you may encounter difficulties in properly rendering ANSI colors when using the command-line interface (CLI). To resolve this issue, please execute the following command in the terminal:
reg add HKCU\Console /v VirtualTerminalLevel /t REG_DWORD /d 1
-
If you want to open multiple client on the same machine, and more then one playing through CLI, before starting each 'Client.jar', you must open and additional terminal for each of them that will use CLI and follow this:
My Shelfie Client Chat on CLI:
In the second terminal change the directory till you are in MyShelfie folder.
Now you can start the client chat by typing:
java -jar TerminalServer.jar
In the file 'port.txt' in 'MyShelfie' folder you must press enter key after the port number, before starting a new 'TerminalServer.jar'
B - Linux
- No issues found yet
C - MacOS
- We were unable to test it as such a machine was not available
- Written rules
- Video rules - [ITA]
- When using GUI version:
- To open the chat terminal press on the keyboard:`
T
- To close the chat terminal press on the keyboard:`
esc
- To open the chat terminal press on the keyboard:`
- To use the 'Server persistence Functionality' on a server crash:
- If you want to reload the game:
- Start the server again
- Start the client and enter the same nicknames as the previous match
- Otherwise:
- Delete file 'status.json' from MyShelfie folder
- If you want to reload the game:
- Supervisor: Prof. G. Cugola
- Grade: 29 / 30 cum laude
NOTA: My Shelfie è un gioco da tavolo sviluppato ed edito da Cranio Creations Srl. I contenuti grafici di questo progetto riconducibili al prodotto editoriale da tavolo sono utilizzati previa approvazione di Cranio Creations Srl a solo scopo didattico. È vietata la distribuzione, la copia o la riproduzione dei contenuti e immagini in qualsiasi forma al di fuori del progetto, così come la redistribuzione e la pubblicazione dei contenuti e immagini a fini diversi da quello sopracitato. È inoltre vietato l'utilizzo commerciale di suddetti contenuti.