2 Player Games Github.io
This guide shows how to host simple 2-player browser games on GitHub Pages (username.github.io), with a complete, ready-to-run example: a turn-based Tic-Tac-Toe game that works locally and when published to GitHub Pages. It includes structure, code, deployment steps, and brief suggestions for extending to real-time play.
Contents
Project overview
File structure
Complete code
index.html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<title>Tic-Tac-Toe — 2 Player</title>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<main>
<h1>Tic‑Tac‑Toe</h1>
<section id="controls">
<label>
Game mode:
<select id="mode">
<option value="local">Pass & Play (local)</option>
</select>
</label>
<button id="newBtn">New Game</button>
<div id="status" aria-live="polite"></div>
</section>
<section id="board" role="grid" aria-label="Tic Tac Toe board">
<!-- 9 cells injected by JS -->
</section>
<footer>
<small>Click a cell to place. X starts.</small>
</footer>
</main>
<script src="script.js"></script>
</body>
</html>
style.css
:root
--bg:#0f1724;
--card:#0b1220;
--accent:#06b6d4;
--text:#e6eef6;
*box-sizing:border-box
html,bodyheight:100%
body
margin:0;
font-family:system-ui,-apple-system,Segoe UI,Roboto,"Helvetica Neue",Arial;
background:linear-gradient(180deg,var(--bg),#071226 80%);
color:var(--text);
display:flex;
align-items:center;
justify-content:center;
padding:32px;
main
width:360px;
background:var(--card);
border-radius:12px;
padding:18px;
box-shadow:0 6px 30px rgba(2,6,23,.6);
h1margin:0 0 12px;font-size:20px;text-align:center
#controlsdisplay:flex;gap:8px;align-items:center;justify-content:center;margin-bottom:12px
#statusmin-width:160px;text-align:center
#board
display:grid;
grid-template-columns:repeat(3,1fr);
gap:8px;
margin:8px 0 12px;
.cell
aspect-ratio:1/1;
background:linear-gradient(180deg,#071427,#0b1b2b);
display:flex;
align-items:center;
justify-content:center;
font-size:48px;
border-radius:8px;
cursor:pointer;
user-select:none;
transition:transform .08s ease, box-shadow .08s;
box-shadow:inset 0 -6px 18px rgba(0,0,0,.35);
.cell:hovertransform:translateY(-2px)
.cell.disabledcursor:default;opacity:.9
footerfont-size:12px;text-align:center;color:#9fb6c6
button,selectpadding:6px 8px;border-radius:6px;border:1px solid rgba(255,255,255,.06);background:#06232b;color:var(--text)
script.js
// Simple Tic-Tac-Toe (pass & play)
const boardEl = document.getElementById('board');
const statusEl = document.getElementById('status');
const newBtn = document.getElementById('newBtn');
let board = Array(9).fill(null);
let turn = 'X';
let over = false;
function init()
boardEl.innerHTML = '';
board = Array(9).fill(null);
turn = 'X';
over = false;
statusEl.textContent = "Turn: X";
for(let i=0;i<9;i++)
const cell = document.createElement('button');
cell.className = 'cell';
cell.setAttribute('data-i', i);
cell.setAttribute('aria-label', `Cell $i+1`);
cell.addEventListener('click', onCell);
boardEl.appendChild(cell);
function onCell(e)
if(over) return;
const i = Number(e.currentTarget.dataset.i);
if(board[i]) return;
board[i] = turn;
render();
const winner = checkWinner(board);
if(winner)
over = true;
if(winner === 'draw')
statusEl.textContent = 'Draw!';
else
statusEl.textContent = `Winner: $winner`;
highlightWinning(winner);
disableBoard();
else
turn = turn === 'X' ? 'O' : 'X';
statusEl.textContent = `Turn: $turn`;
function render()
board.forEach((v,i)=>
const cell = boardEl.querySelector(`[data-i="$i"]`);
cell.textContent = v );
function disableBoard() boardEl.querySelectorAll('.cell').forEach(c => c.classList.add('disabled'));
function checkWinner(b)
const lines = [
[0,1,2],[3,4,5],[6,7,8],
[0,3,6],[1,4,7],[2,5,8],
[0,4,8],[2,4,6]
];
for(const [a,b1,c] of lines)
if(b[a] && b[a] === b[b1] && b[a] === b[c]) return b[a];
return b.every(Boolean) ? 'draw' : null;
function highlightWinning(p)
const lines = [
[0,1,2],[3,4,5],[6,7,8],
[0,3,6],[1,4,7],[2,5,8],
[0,4,8],[2,4,6]
];
for(const [a,b1,c] of lines)
if(board[a] && board[a] === board[b1] && board[a] === board[c])
[a,b1,c].forEach(i=>
const el = boardEl.querySelector(`[data-i="$i"]`);
if(el) el.style.boxShadow = '0 6px 20px rgba(6,182,212,.18), inset 0 -6px 18px rgba(0,0,0,.5)';
);
break;
newBtn.addEventListener('click', init);
init();
How it works
Deploy to GitHub Pages
Extensions
Minimal server example (Node.js + ws)
// server.js (very small)
const WebSocket = require('ws');
const wss = new WebSocket.Server( port: 8080 );
const rooms = new Map(); // roomId => [sockets]
wss.on('connection', (ws, req) =>
ws.on('message', msg =>
// expect JSON room, type, ...
let data;
try data = JSON.parse(msg); catch(e)return;
const room = data;
if(!room) return;
const arr = rooms.get(room) );
ws.on('close', () =>
for(const [k,arr] of rooms)
rooms.set(k, arr.filter(s=>s!==ws));
if(rooms.get(k).length===0) rooms.delete(k);
);
);
console.log('ws server on :8080');
Wrap-up
If you want, I can:
"2 player games github.io" refers to a massive collection of free, open-source, and unblocked multiplayer web games hosted directly on GitHub Pages. Because GitHub Pages uses the github.io domain, these games bypass most school and workplace network filters while offering fast, ad-free gaming experiences. Whether you are looking for local split-screen action or online real-time duels, github.io hosts some of the best indie web games available today.
🚀 Why "github.io" Has Become the Ultimate Hub for 2-Player Games
For gamers and students, the .github.io domain has quickly overtaken traditional flash and web gaming portals for several distinct reasons:
Unblocked Access: Standard gaming websites are frequently blocked by local firewalls. GitHub is recognized as a developer platform, making its hosted subdomains highly accessible.
Ad-Free and Clean: Because developers use GitHub Pages to showcase their source code or portfolio, the games are rarely cluttered with intrusive pop-ups or video ads.
Open Source Development: Players can easily fork the code, submit pull requests, or customize the game logic right from the GitHub repositories .
Zero Downloads: All games run directly in any modern web browser using HTML5, JavaScript, and WebGL, meaning no installation is required. 🕹️ Top 2-Player Games on GitHub.io 2 player games github.io
The types of 2-player games on GitHub Pages fall into two main categories: local shared-keyboard games and online real-time multiplayer games. Below are the top games you can play right now: 1. Fireboy and Watergirl Series Genre: Cooperative Puzzle Platformer
How it works: One player uses the arrow keys, and the other uses the WASD keys. You must work together to open doors, push switches, and safely navigate elemental traps.
Why play it: It is the definitive local co-op game that tests both timing and teamwork. 2. Rooftop Snipers Genre: Chaotic Physics Shooter
How it works: Two players face off on a rooftop, using one key to jump and another to shoot. The physics are intentionally clumsy, causing hilarious falls over the ledge.
Why play it: It features incredibly fast-paced, unpredictable rounds that are perfect for quick breaks. 3. Infinite Tic-Tac-Toe Genre: Strategy/Puzzle
How it works: Built with modern frameworks like React and Socket.IO, this takes the classic paper game and makes it endless. It includes live multiplayer and real-time cursor syncing.
Why play it: Excellent for a quiet, turn-based mental workout with a friend. 4. Pocket-Sized Chess & Connect Four two-player · GitHub Topics
Haseebullah9012 / Chess ... Chess is a Famous Two-Player Turn-based Board Game. Its Code in C++ with Object Oriented Approach. multiplayer-game · GitHub Topics
Date: [Current Date] Prepared For: General Inquiry / Market Research Subject: Overview, Accessibility, and Trends of Two-Player Browser Games Hosted on GitHub.io
If you’ve ever sat in a boring high school computer lab, a college dorm lounge, or an office with a lenient IT policy, you’ve likely heard the quiet whisper: “Pull up the GitHub.io.” This guide shows how to host simple 2-player
Not YouTube. Not Netflix. GitHub.io.
Specifically, the sprawling, unofficial universe of 2-player games hosted on GitHub Pages.
At first glance, it looks like a retro time capsule. A simple black, white, or neon-green layout. No ads. No login walls. No "install our app." Just raw, browser-based JavaScript and a list of titles that read like a fever dream of 2000s gaming: Tic-Tac-Toe, Chess, Checkers, Four in a Row, Flappy Bird (but two players?!), Stickman Fight, and Pixel Tank Battle.
The resurgence of "2 player games github.io" is driven by three main factors:
The next time you hear someone say "local multiplayer is dead," send them to GitHub.io. The platform is currently experiencing a golden age of indie game development. From stick figure warfare to cooperative temple exploration, 2 player games on GitHub.io offer instant gratification, zero cost, and maximum fun.
Your move, Player 2.
Not all browser games are created equal. After extensive research (and many arguments with friends), here are the absolute best 2 player games hosted on GitHub.io.
During a free period in the school library, these games are a lifesaver. Because they run on GitHub.io, they often bypass school web filters that block "gaming" sites (though policies vary). They require no installation on school computers.
While this article focuses on "local" (same device) 2 player games, the GitHub.io ecosystem is evolving. Developers are now using WebRTC to create peer-to-peer connections. Soon, you will click a "2 player games github.io" link, send a code to a friend across the country, and play without a central server.
For now, though, nothing beats the analog magic of sitting next to someone, shoulder to shoulder, screaming at a pixelated car crash. Project overview