A lightweight implementation of the classic Dinosaur game, played entirely within the browser's address bar.
Play the Live Demo β¨
Note
This project was recently updated to address browser compatibility issues. For context, invisible characters (previously used in this project) and spaces, such as the Zero-Width Space (U+200B), pose a significant security risk because they allow attackers to create homograph URLs that appear identical to legitimate sites but lead to phishing or malware. To counter this, Chrome and other Chromium-based browsers (like Edge and Brave) have implemented sophisticated protections that detect these hidden Unicode characters and automatically "defang" them by displaying the URL in Punycode (e.g., xn--...), which was breaking the aesthetics of the game.
clipdemo.mp4
| Character | Entity | Description |
|---|---|---|
C |
Player | Your dinosaur character. |
β’ |
Food | Basic pickup (+1 point). |
@ |
Fruit | Rare pickup (+5 points). |
X |
Enemy | Obstacle to avoid (-1 point/Death). |
* |
Shield | Power-up (5s invincibility). |
- Launch: Open the live demo or
index.htmlin a desktop browser. - Start: Press any key to begin the 3-second countdown.
- Controls: Use the
Up ArroworSpacebarto jump and dodge obstacles. - Goal: Survive as long as possible while collecting pickups to maximize your score.
Play with up to 6 players in real-time P2P multiplayer!
- Click the "Multiplayer" button in the top-right corner
- Enter your name (max 16 characters)
- Click "Create Room"
- Share the generated room name or copy the invite link
- Wait for players to join (max 6 players)
- Click "Start Game" when everyone is ready
- Click the "Multiplayer" button
- Enter your name (max 16 characters)
- Click "Join Room"
- Paste the invite link or enter the room name
- Click "Ready β" when you're prepared
- Wait for the host to start the game
You can also join directly via URL: https://neilblaze.github.io/URL-Dinogame/?room=<PEER_ID>
- Live Leaderboard: See all players' scores in real-time during gameplay.
- Host Controls: Host can adjust difficulty and speed settings for all players.
- Post-Game Stats: View final rankings with winner announcement.
- Session History: Game logs stored locally for 7 days (IndexedDB)
- P2P Architecture: Serverless peer-to-peer using WebRTC (PeerJS 1.5.2)
- Host-Authoritative: Host validates scores and manages game state
- Max Players: 6 players per room
- Score Sync: Updates every 150ms
- Heartbeat: 4s interval with 10s timeout for disconnect detection (Web Worker)
Important
Multiplayer is desktop-only and requires a visible URL bar and full keyboard. The session is tied to your tab, i.e., refreshing disconnects you, only one session per browser is allowed, and if the host leaves, the game ends for everyone. Players behind strict NATs or firewalls may have trouble connecting, and keeping the tab focused is necessary for smooth visuals.
git clone https://github.com/Neilblaze/URL-Dinogame.git
cd URL-Dinogame
# Open index.html in your browserWarning
"Multiplayer unavailable" error β An ad-blocker or privacy extension is likely blocking the PeerJS CDN (unpkg.com). Disable it for this page, or try Chrome, Edge, or Firefox with extensions off.
Caution
"Could not find host" error β Double-check the room name. If it's correct, the host may be behind a firewall blocking WebRTC. Try having the host create a fresh room and reshare the invite link.
Note
"Multiplayer already open in another tab" β Only one multiplayer session per browser is supported. Close any other tabs running the game and try again.
Tip
Players can't connect β Corporate and school networks often block P2P traffic. Both players using a VPN (or switching to mobile hotspot) usually fixes this.
Note
Game slows down when tab is backgrounded β This is intentional browser throttling, not a bug. Keep the game tab in focus for smooth visuals. Score syncing continues in the background via Web Workers regardless.
Contributions are welcome! Please open an issue or submit a pull request for any features or bug fixes.
This project is licensed under the Apache License 2.0. See LICENSE for details.
