🚢 Battleship game implemented in Rust

Overview

Battleship 🚢

Battleship game implemented in Rust.

demo

Fully playable between 2 players on the terminal.

To play on the public instance:

$ nc battleship.orhun.dev 1234

Building

Minimum supported Rust version: 1.38.0

$ cargo build --release

Running

$ ./target/release/battleship

This will start the server on port 1234, then players can connect to it with any tool that supports TCP sockets. For example, using netcat:

$ nc 127.0.0.1 1234

Docker

Dockerfile is available in the repository.

Building

$ docker build -t battleship .

Running

$ docker run --rm -d --name battleship -p 1234:1234 battleship

Configuring

You can use the following environment variables for specifying the game settings:

  • BATTLESHIP_SOCKET: TCP socket address (default: 127.0.0.1:1234)
  • BATTLESHIP_GRID_WIDTH: Width of the game grid (default: 10)
  • BATTLESHIP_GRID_HEIGHT: Height of the game grid (default: 10)

Playing

After joining the game, players take turns firing shots (by calling out a grid coordinate) to attempt to hit the opponent's enemy ships. Example coordinates would be a1, g8, E4, I2, and so on.

hit

Each player has two grids: an upper and lower grid.

grids

The lower grid views the location of the player's own ships, while the upper grid shows the shots fired toward the opponent and also gives information about whether those shots were hits or misses.

  • : hit
  • : missed

Ship types

  1. Boat
  1. Destroyer
▯
▯
  1. Battleship
▧▧
▧▧
▧▧

License

All code is licensed under The MIT License.
You might also like...
A refreshingly simple data-driven game engine built in Rust

What is Bevy? Bevy is a refreshingly simple data-driven game engine built in Rust. It is free and open-source forever! WARNING Bevy is still in the ve

Data-oriented and data-driven game engine written in Rust
Data-oriented and data-driven game engine written in Rust

What is Amethyst? Amethyst is a data-driven and data-oriented game engine aiming to be fast and as configurable as possible. Principles These principl

Rust library to create a Good Game Easily

ggez What is this? ggez is a Rust library to create a Good Game Easily. The current version is 0.6.0-rc0. This is a RELEASE CANDIDATE version, which m

Minesweeper game developed with Rust, WebAssembly (Wasm), and Canvas
Minesweeper game developed with Rust, WebAssembly (Wasm), and Canvas

👉 click here to play the game 👈 Minesweeper game Revealing all the cells without hitting the mines is the task. Each number in the cell denotes how

Snake Game in rust for the web

About This template shows how to create a web app using Yew and wasm-pack. 🚴 Usage 🛠️ Build When building for the first time, ensure to install depe

A solver for the popular Wordle game written in Rust.

Wordle Solver A solver for the popular Wordle game written in Rust. It does not attempt to be the most efficient solver possible but tries to avoid us

A simple power 4 game wrote in Rust.

🔴 🔵 Power 4 This is a simple power 4 game wrote in native Rust. There's only one dependencie for colored terminal. ❓ How to try it? To try this game

👾 The classic Space Invaders game made in rust!
👾 The classic Space Invaders game made in rust!

👾 Invaders The classic space-shooter game now in your terminal! And the good part: made in Rust! ❕ This game was made during the course Ultimate Rust

A block game made in Rust and SFML
A block game made in Rust and SFML

septadrop A block game made in Rust and SFML. For packaging instructions, see the build folder. Game Controls 🠔/🠖 arrow keys: horizontal movement 🠕

Releases(v0.1.1)
Owner
Orhun Parmaksız
FOSS developer, @archlinux package maintainer, oxidizing things with @rust-lang
Orhun Parmaksız
A finnish version of the word guessing game Wordle implemented in Rust.

Sanuli A finnish version of the word guessing game Wordle implemented in Rust. Live version running at sanuli.fi. Quick start Follow Rust installation

Jaakko Husso 59 Nov 29, 2022
The video game for Fonts of Power. A tabletop roleplaying game made in Rust with Bevy!

The code and rules for Fonts of Power, a tactical TTRPG / video game about exploring magical places. You can follow its development in our Discord ser

null 25 Dec 23, 2022
Red Light, Green Light is a traditional Korean children's game, popularised by the Squid Game TV series.

Red Light, Green Light Red Light, Green Light is a traditional Korean children's game, popularised by the Squid Game TV series. This project is the di

Cedric Chee 1 Jan 10, 2022
A game inspired by the classic atari game: demon attack

rusty_demon_attack A game inspired by the classic atari game: demon attack You can play the game in the web!

null 58 Jan 4, 2023
Snake implemented in rust.

rsnake - An implementation of classic snake in rust This game was built using the piston_window window wrapper. Download the game If youre using mac-o

Maximilian Schulke 85 Jan 7, 2023
A roguelike game in Rust

A fantasy deathcrawl in Rust Work in progress. To run, with Rust compiler and Cargo package manager installed: cargo run --release When building on W

Risto Saarelma 347 Nov 21, 2022
😠⚔️😈 A minimalistic 2D turn-based tactical game in Rust

Zemeroth is a turn-based hexagonal tactical game written in Rust. Support: patreon.com/ozkriff News: @ozkriff on twitter | ozkriff.games | facebook |

Andrey Lesnikóv 1.3k Jan 5, 2023
⬡ Zone of Control is a hexagonal turn-based strategy game written in Rust. [DISCONTINUED]

Zone of Control The project is discontinued Sorry, friends. ZoC is discontinued. See https://ozkriff.github.io/2017-08-17--devlog.html Downloads Preco

Andrey Lesnikóv 354 Nov 14, 2022
This is a simple implementation of the classic snake game in rust

My snake game Looks like this. This is with Roboto Mono Nerd Font. If you use a different font it may look different or distorted. Install rust In ord

Konstantinos Kyriakou 16 Apr 4, 2021
The classic tetris game written in Rust using ncurses

tetris.rs This is the classic tetris game I wrote to have a bit of fun with Rust. Installation and playing cargo install --

null 71 Jul 25, 2022