sopra-fs23-group-12 / 4Bubbles_Server

MIT License
0 stars 0 forks source link

UZH SoPra Course FS23

Soap Bubble

4Bubble Trivia

Make Trivia fun again! \ This is a trivia game with a focus on multiplayer aspects. You can test your trivia knowledge by battling your friends in your preferred topic. Choose your difficulty, the number of questions and your game mode. You have 10 seconds to answer the questions in the bubble and collect points. The faster you answer, the more points you will get. This will prove more difficult than you might expect, especially in hard mode. But not to worry - since the bubble sizes change to indicate the number of people that have already cast their vote on one of the answers, you can go the safe road and follow your friend's choice ... or can you? \ The game supports two game modes; standard locks your choice in, once you've cast your vote you cannot change it anymore. 3,2,1 ... lets you change your vote. Players in this game mode have to be extra careful when deciding whether to trust their friend's choices. Whether you chose the correct answer will be revealed when the time is up; if your bubble doesn't burst, you've made the correct choice!

Play here. Enjoy! Check here whether the server is running correctly.

You can find the corresponding client repository here.

Technologies

This project is a Node.js application running ReactJS with JavaScript.\ Server-Client communications are handled with REST API and Socket.io with the Netty-Socketio library for the server.

High-level Components

Our Server consists of four major components;

GameRoom and Game are the main classes that handle the sequence of game actions and its members. They are summarized and managed by the GameRoomController class.

Our controllers, especially Socket and GameRoom controllers handle all incoming traffic.\ SocketController specifically handles all traffic related to Websockets.

API Service handles the connection to the trivia question API.

The User class is the only entity we store in a Database. This allows users to create and account they can revisit and allows the system to track statistics that can be displayed to the users.

Many helper classes support the main class in their functionalities; these include the service classes for the components, the abstractions of Votes, and manager classes, such as RoomCoordinator or VoteController, that afford finding rooms and evaluating votes respectively.

Launch and Deployment

Prerequisites

All dependencies are handled with Gradle.

Setup this Template with your IDE of choice

Download your IDE of choice (e.g., IntelliJ, Visual Studio Code, or Eclipse). Make sure Java 17 is installed on your system (for Windows, please make sure your JAVA_HOME environment variable is set to the correct version of Java). \ Clone the repo and open in your IDE of choice. Note: you might have to build gradle first.

Build

./gradlew build

Run

./gradlew bootRun

You can verify that the server is running by visiting localhost:8080 in your browser.

Test

./gradlew test

Deployment

It seems that App Engine only has port 80 and port 443 open, but our WebSocket server is listening on port 9092. We have tried several things to get it to work with Google App Engine, unfortunately without success. It looks like App Engine only provides access to ports 80 and 443, so switched to Google Compute Engine, which provides much more flexibility. We included our own GitHub Action, which copies the soprafs23.jar file from the build/libs folder to Google Compute Engine. The old process is shut down and the updated version of soprafs23.js is started.

To use the server in production set the environment variable PRODUCTION=true.

PRODUCTION=true java -jar soprafs23.jar

Roadmap

Developers interested in extending this application are welcome to implement additional features.\ Here are some Ideas that can be used as inspiration:

Authors

In alphabetical order:

Special thanks to the authors of the template:

Contributing

Please read contributions.md for details of our task history.

Acknowledgments

License

This project is licensed under the MIT License - see the LICENSE.md file for details.