/battleship

Kotlin Battleship game with server client structure to play together.

Primary LanguageKotlin

Battleship

A simple Battleship game developed with Kotlin (Ktor and coroutines) using Processing.

Features:

  • Server Client Architecture - play with friends
  • Custom game field size, ship counts and if there is spacing between ships necessary
  • Queue to randomly play against another player or use a lobby (with password option)
  • Server is automatically found via Broadcast on Port 8000
  • One Server can host multiple games
  • Standalone headless server or start server within Client
  • Optional https if server has a valid certificate

Play

  • Download the game battleship_client.jar from Releases
  • Install JDK
  • Start Game by double clicking it.

If you are using windows you can download OpenJdk from Microsoft for Windows.

If you cannot run the game try by starting it with java -jar battleship_client.jar.

Build

To build the game, open the project in IntelliJ and Select Build -> Build Artifacts, .jar Files can be found in out/artifacts.

Server Client Architecture

  • Connection via websockets

Server

  • Server can be started from Client jar or from Server jar (Headless)
  • Runs Broadcast on Port 8000
  • Hosts multiple games (aka lobbies) and one Queue
  • Validates all API calls

Client

  • Receives id from Server
  • Only knows it's own ships and hit/miss result (no information about enemy)

Images