explaingit

tridpt/twoplayergames

13JavaScriptAudience · generalComplexity · 2/5Setup · easy

TLDR

TwoPlayerGames is a self-hosted collection of 47 two-player browser games, classics like Connect Four, Battleship, and Yahtzee, playable locally at one keyboard or online with a friend using a room code.

Mindmap

mindmap
  root((repo))
    What It Does
      47 two-player games
      Self-hosted browser app
      Local and online play
    Game Types
      Classic board games
      Dice and card games
      Action games
    Online Play
      Four-digit room code
      Move relay server
      In-room chat panel
    Customization
      Custom board settings
      Synced game options
      Sound effects
    Tech Stack
      HTML CSS JavaScript
      Node.js server
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Host a collection of classic board and dice games on your own computer for two people to play at the same keyboard.

USE CASE 2

Play games like Connect Four, Battleship, or Yahtzee online with a remote friend using a four-digit room code.

USE CASE 3

Extend the collection by adding your own two-player browser game to the existing server and game registry.

Tech stack

JavaScriptHTMLCSSNode.js

Getting it running

Difficulty · easy Time to first run · 5min

Requires Node.js 18+, playing over the internet beyond your local network requires a tunneling tool like ngrok.

In plain English

TwoPlayerGames is a self-hosted collection of 47 two-player games that you run on your own computer. The README is written in Vietnamese. Players can sit together at one keyboard (called hot-seat mode) or play from two separate machines over a local network or the internet. The entire game logic runs in the browser using plain HTML, CSS, and JavaScript, while a small Node.js server handles hosting the page and relaying moves between players over a live connection. The game list covers a wide range of types. Classic board games include Connect Four, Reversi, Checkers, Battleship, Mancala, Pentago, Quoridor, and several varieties of gomoku-style grid games. There are dice games such as Yahtzee, Pig, and Domino, card-style games like Auction War, and action games including Pong, a billiards game, and a slingshot game. Several games are designed for hidden-information play and work only in online mode, where each player sees a different view of the board. Online play works through a four-digit room code. One player creates a room and shares the code, the other player enters it to join. The server relays moves between the two browsers. An in-room chat panel lets players send messages or quick preset phrases, and sound effects signal moves, wins, and incoming chat. Some games let both players agree on custom settings before starting, such as board size or winning conditions, and those settings sync between the two machines automatically. To run it locally you need Node.js version 18 or higher. Three terminal commands install dependencies, start the server, and open the app in a browser at port 8777. A built-in test script checks JavaScript syntax, verifies the game registry, and runs a quick server and connection test. Playing over the internet beyond a local network requires a tool like ngrok to expose your local server to the outside world.

Copy-paste prompts

Prompt 1
I want to run TwoPlayerGames locally so my friend and I can play Battleship on the same computer. Walk me through the three terminal commands to install, start the server, and open it in a browser.
Prompt 2
I want to play TwoPlayerGames online with a friend who is not on my network. How do I use ngrok to expose my local port 8777 to the internet, and what does my friend need to do to join my room?
Prompt 3
I want to add a new two-player game called Hex to TwoPlayerGames. Walk me through what files I need to create, how to register the game in the game registry, and how to wire up the online move relay.
Open on GitHub → Explain another repo

← tridpt on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.