Skip to content

sopra-fs23-group-11/sopra-fs23-group-11-server

Repository files navigation

Battleship Game - Server

Table of Content

Introduction

Welcome to the Battleship Game project! This is a digital implementation of the classic strategy game where players engage in a battle of wits and strategy on the high seas. The game challenges players to strategically position their fleet of ships on a grid and tactically guess the locations of their opponent's ships.

This project aims to provide an enjoyable gaming experience while showcasing the use of modern web technologies. Whether you're a fan of the original board game or simply looking for a fun and engaging online game, Battleship Game offers an immersive experience that will keep you hooked.

Play here.

Technologies Used

  • Spring - Framework that enables running JVM and JPA
  • Gradle - Build automation tool
  • STOMP - Used for Websockets
  • Dicebear API - For creating Avatars

Main Components

The controllers (eg. GameController) act as the receivers of REST and WebSocket calls. They handle incoming requests and delegate the necessary tasks to the appropriate services.
The service plays a crucial role in the project as they encapsulate the core game logic and ensure the integrity of the gameplay. These services are responsible for checking and validating the game rules, handling player actions including the shooting mechanism, and managing the game state.
Among the services, the gameService holds a key role. It oversees the overall game flow, tracks hits and misses, and determines the outcome of the game. This service acts as the central hub for managing the gameplay logic, ensuring fair and accurate gameplay.
Another essential component is the ShipPlayer and ShipPlayerService class. These classes are responsible for efficiently joining ship and player information and coordinating the placement of ships. They work closely with the gameService to update the game state and progress accordingly.
WebSockets play a vital role in real-time communication and keeping players updated about ongoing game events. They facilitate the transmission of messages from the controllers to inform players about significant occurrences, such as successful hits, ship sinkings, and the end of the game. These messages keep players engaged and provide real-time feedback on the progress of the game.
Overall, the controllers, services, and WebSockets form an integral part of the Battleship project. The controllers handle incoming requests, the services ensure proper game logic and functionality, and the WebSockets enable real-time communication and updates. This collaborative approach contributes to an immersive and engaging gaming experience.

Launch

Prerequisites

All dependencies are handled with Gradle.
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 Repository

Clone the client-repository onto your local machine with the help of Git.

git clone https://github.com/sopra-fs23-group-11/sopra-fs23-group-11-server.git

You can find the corresponding client repository here.

Build

./gradlew build

Run

./gradlew bootRun

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

Test

./gradlew test

We also recommend using Postman to test your API Endpoints.

Deployment

The main branch is automatically mirrored onto Google Cloud App Engine via GitHub workflow, each time you push onto the main branch.

Create Releases

Roadmap

  • Add secure connection (https instead of http)
  • Different Game modes
  • Different shot types (salvo, grenade, atomic bomb)
  • Make game responsive for mobile screens

Authors and Acknowledgment

Authors

Acknowledgments

We would like to thank our TA Isabella and the whole team of the course Software Engineering Lab from the University of Zurich.

License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 7