As a group of 7 people, we developed an online version of Splendor, a famous broad game. The backend server was implemented using Spring Boot framework, and we used JavaFX as our frontend framework. The game is deployed on a lobby service, developed by the course instructor: Maximilian Schiedermeier.
- Make sure you have maven installed on your machine. It is required to run the client.
- Download and install docker desktop so that you can run the server and database in some isolated containers.
- Due to copy right issue, we can not upload the game assets of the original game in this repository, thus you must download it
from here. Download the folder
pictures
and store it somewhere on your machine. We will put it in the right place afterwards.
Let's start with the setting up the servers and database using docker
:
Follow the steps by typing the command into your terminal
(cmd
if you are using windows)
- git clone this repository by typing:
git clone https://github.com/RuoyuDeng/Splendor.git
- Then you cd into the directory:
cd Splendor
- Run the update submodules script
- For mac/linux, type:
./updatesubmodules.sh
- For windows, you can first open the folder in explorer, and then right-click on the file
updatesubmodules.ps1
, in the prompt, clickrun with powershell
.
- For mac/linux, type:
- After that, type:
docker compose up
make sure you have docker desktop up and running before typing this
- Wait for around 2-3 minutes (max), then you should have the
Lobby Server
andGame Server
both running on your machine.
After you have build the docker images
, you can choose to run the database
inside the container and the Lobby Service
and Game Server
outside of the container. This approach is usually taken when you feel like customizing and modifying the game server or lobby server by yourself frequently
during game play (not recommended for gamers).
- Make sure you have the container
BGP-Database
created from previousdocker compose up
running. You can do so through the dashboard of the docker desktop application. cd Splendor/LobbyService
, and then type:mvn clean spring-boot:run
- Go back to the root folder:
Splendor
, then type:cd f2022-hexanome-08/server
. Start the server by typing:mvn clean spring-boot:run
- Despite several more steps, you have achieved the same goal as above approach.
Now, you should have the backend servers ready, let's see how to run the client.
We have not yet configured a way to package our frontend code to a jar
file so that
it can be played cross-platform by simply double-clicking on one file. So the only way to
run the client (frontend) is use mvn: mvn clean javafx:run
. Note that according to how the server is deployed, you might need to change the client
configuration a bit.
- Remember the
pictures
folder that you downloaded as part of the prerequisite? Now let's put it in the right place, which is under:Splendor/f2022-hexanome-08/client/src/main/resources/project/pictures
- Now depending on how you started your server and how exactly you want to play this game, there is some configuration details you need to do. If you want to:
- Play with your friends under a same WI-FI:
- Find the json configuration file:
Splendor/f2022-hexanome-08/client/connectionConfig.json
, the default content is:
{ "defaultUserName": "ruoyu", "defaultPassword": "abc123_ABC123", "useDefaultUserInfo": "true", "hostIp": "76.66.139.161", "useLocalHost": "false" }
- Find the json configuration file:
- Change the value of
hostIp
to the IP of which your machine that runs the servers.For mac user, you can do so by
ipconfig getifaddr en0
in your terminal. For example, you got 10.111.111.111 as your IP, then you need to change this configuration file in all the client applications:"hostIp": "10.111.111.111"
, - Play with your friends under different WI-FI:
- Port-forwarding your local host so that you can play the game with your friends under different WI-FI.
- Say the IP you got after port-forwarding is:
http://33.23.123.456/
, then similarly, you will need to replacehostIp
to"33.23.123.456"
, which is your own server IP after port-forwarding.
- Play with your friends under a same WI-FI:
- Now you have configured the client IP correctly, we are just one command line away from playing! Now type:
cd Splendor/f2022-hexanome-08/client
- Lastly, type:
mvn clean javafx:run
, and you should be able to see the game running!
You could've skipped all the steps mentioned above if you just want to play some game ASAP. Follow the steps below:
- Remember the
pictures
folder that you downloaded as part of the prerequisite? Now let's put it in the right place, which is under:Splendor/f2022-hexanome-08/client/src/main/resources/project/pictures
- Open your terminal or cmd, type:
cd Splendor/f2022-hexanome-08/client
- Then, type:
mvn clean javafx:run
to start the game!
As you have noticed, we have provided you a default admin account to start the game with. For the very first time that you log in, you can use this account to add more accounts as you go.
Afterwards, you can change "defaultUserName"
and "defaultPassword"
to your own account information. The flag value: "useDefaultUserInfo": "true"
enables that your password and username
being pre-filled for you (save some time) when you log in. If you do not like this feature, then you can simply change it to "false": "useDefaultUserInfo": "false"
Congrats! You have finished all the steps you needed to play the game (a bit long, I admit). Now it's time to gather some friends around, and start playing!