/gamesite

A Go-based game server that hosts a collection of simple turn-based web games. It is designed with flexibility in mind, allowing for easy registration and addition of new games.

Primary LanguageGoMIT LicenseMIT

Gamesite

A Go-based game server that hosts a collection of simple turn-based web games. It is designed with flexibility in mind, allowing for easy registration and addition of new games.

Games Implemented (so far)

  • Three Tic Tac Toe

  • Nested Tic Tac Toe

  • Reversi

Idea

Players can select a game, create a room, and share the room's URL with a friend to play. Rooms are automatically closed under the following conditions:

  • The game reaches an end state.
  • The other player fails to join within the time limit.
  • A player fails to make a move within the time limit (adjustable).

To build

make build

The above command generates a single binary using stuffbin, bundling all HTML files and images.

To run

make run

The application listens on port 8080.

Architecture

The application consists of 3 components

  • Web: Handles REST and WebSocket handlers.
  • Room: An in-memory data structure that manages game states, including making moves, tracking players, and determining game outcomes.
  • Hub: Responsible for managing rooms (creation and destruction).