← Back to ratslair.com
aboutsummaryrefslogtreecommitdiff
path: root/README.md
blob: ba030a18d7f99ba29d1d81e4251782070b0b4302 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# nships

An attempt at networked Battleship over ncurses. Host a game on a raw TCP socket (`server.c`, a plain `socket`/`bind`/`listen`/`accept` pair on port 8888) or join one by IP, trade names, then place ships on your own board before taking turns firing at your opponent's.

Ship placement works: you move a ship around with WASD, rotate it, and lock it in, five ships per side. Turn-taking mostly works too, since coordinates get sent and received over the socket so each player sees where the other is aiming. What never got finished is syncing the actual board state itself. The code that's supposed to exchange each player's ship layout after placement is stubbed out as comments ("send to p1" / "recieve p1"), so a real game currently plays blind past the placement phase.

## Controls

Ship placement:
- `W`/`A`/`S`/`D`: move the ship
- `R`: rotate
- `Enter`: lock it in

Firing:
- `W`/`A`/`S`/`D`: move the cursor
- `Enter`: fire

## Building

Needs ncurses. Resolve the merge conflict in `nships.c` first, then:

```sh
cc nships.c -lncurses -o nships
./nships
```