A collection of classic arcade games built with vanilla JavaScript, featuring a shared game engine, unified input system, procedurally generated audio, and PWA support for installability.
- Ahorcado - Guess the secret word - Random and 1v1 modes
- Arkanoid - Break bricks with paddle and ball
- Busca Minas - Find the bombs using logic and arrays
- Conecta 4 - Connect 4 chips in a row before the AI
- Domino - 4-player online dominoes game
- Efecto Mariposa - Chaotic visualization of the Lorenz Attractor
- Flappy Bird - Fly between pipes without crashing
- Fuera Luces! - Turn off all the lights in the fewest possible pulses
- Gato - Ateti - Classic 3-in-a-row against AI
- Othello - Reversi - Classic strategy board game for two players
- Pac-Man - Classic maze chase - eat dots and avoid ghosts
- Sky Dash - Sky Dash
- Snake Game - Grow the snake by eating food
- Space Invaders - Defend Earth from alien invaders
- Sudoku - Solve the sudoku puzzle
- Typing Speed - Test your typing speed - ES / EN word pools
- Void Sector - Space combat game with online multiplayer
- Word Scramble - Unscramble the letters - ES / EN
- Multi-Engine Rendering - Three renderers: Engine (Canvas 2D), PIXIEngine (WebGL via PIXI.js), LittleEngine (LittleJS), plus DOMEngine for HTML/CSS games. All connected via
RenderBridgefor agnostic shared utilities. - Matter.js Physics -
MatterPhysicsSystemconPhysicsBodycomponent para simulación física 2D (gravedad, colisiones, fuerzas). - Pathfinding -
PathfindingSystemconPathAgentcomponent para rutas A* en grids. - Advanced Audio -
Howler.jspara audio sprites, fade multi-pista y multi-formato. - UI Animations -
GSAPpara tweens de alto rendimiento conTweencomponent ECS. - Roguelike Dungeon -
ROT.jspara generación procedural de mazmorras y FOV. - RenderBridge - Agnostic bridge so shared modules (
UICanvas,GameBoot,SpriteProcessor) work with any engine without coupling. - Sprites & Animations -
SpriteProcessorcuts tilesets,SpriteManagergroups sprites by character,EntityComposerbuilds layered entities, andSpriteStateMachinehandles animation states. Debug grid (Alt+D) for preview. - Unified Input -
Inputclass normalises keyboard, mouse, and multi-touch events into a single API with gesture detection (swipe) and just-pressed/released semantics. - Procedural Audio -
Audioclass synthesises sounds at runtime (square, sine, saw, noise waves with envelope shaping); no external audio files required. - Online Multiplayer (P2P) -
Onlinemodule wraps PeerJS (WebRTC) for P2P multiplayer.OnlineLobbyprovides a shared DOM overlay for room creation/join with lobby list and code clipboard. - Canvas UI Helpers -
UICanvasprovidesdrawButton(),hitTest(),getPointer(), andlayoutButtons()for canvas-based menus, compatible with all engines. - Theme System -
Themeobject provides a shared color palette (bg,accent,success, etc.) and font families (mono,ui) used by all games. - Game Shell CSS -
game-shell.cssprovides base reset, safe-area-aware layout, back button, online lobby overlay UI, and mobile D-pad controls. - Mobile Controls -
MobileControlsbinds on-screen D-pad buttons to game properties, auto-shown on touch devices. - GameBoot - Unified boot sequence:
GameBoot.start()auto-detects the renderer. Also exposesstartCanvas(),startPIXI(),startLittle(),startDOM(). - Hub Page - Minimalist game grid reads
games.jsonand auto-renders game cards with thumbnails, descriptions, and a Play button; fully responsive (auto-fill grid, 1 col on mobile). - Auto-Discovery -
scripts/scan-games.jsscans thegames/directory and updatesgames.jsonautomatically. This runs via a GitHub Workflow on every push. - PWA (Hybrid Cache) - Service worker (
sw.js, cachejs-games-v4) with hybrid strategy: Network-First for code (/games/*, HTML/JS/CSS) and Cache-First for images. Engine code is bundled by Vite intodist/assets/. Each game can be downloaded individually from the hub;scan-games.jsdetects engine dependencies fromindex.html. Auto-migrates from v1/v2/v3 caches. See engine/docs/OFFLINE.md. - Dark Mode - Full dark theme (
#0f0f1abackground) with a consistent red/purple accent palette across the hub and all games. - AI Opponent - Tic Tac Toe features an AI that plays optimally; Connect 4 has AI opponent; Arkanoid and Snake are single-player with progressive difficulty.
-
Create a new folder under
games/withindex.html,style.css, andscript.js. -
Use the shared engine via
<script>tags (order matters):Modern (ESM modules with Vite):
<script type="module" src="./main.js"></script>
Inside
main.js, import fromsrc/:import '../../src/boot/canvas-mobile.js'; // or canvas.js, dom.js, canvas-online.js import { GameBoot } from '../../src/core/GameBoot.js'; import { game } from './script.js'; GameBoot.start(game, { canvasId: 'game', width: 800, height: 600 });
Librerías externas opcionales — cargar vía
<script>antes del module:<script src="../../engine/pixi.min.js"></script> <!-- PIXI.js (WebGL) --> <script src="../../engine/littlejs.min.js"></script> <!-- LittleJS --> <script src="../../engine/matter.min.js"></script> <!-- Matter.js (física) --> <script src="../../engine/howler.min.js"></script> <!-- Howler.js (audio) --> <script src="../../engine/pathfinding-browser.min.js"></script> <!-- Pathfinding --> <script src="../../engine/gsap.min.js"></script> <!-- GSAP (tweens) --> <script src="../../engine/rot.min.js"></script> <!-- ROT.js (dungeon) -->
Los adapters y componentes ECS se importan desde
src/.Boot shims disponibles en
src/boot/:Shim Instala en globalThis canvas.jsEngine, Input, Audio, EventBus, GameBoot, UI canvas-mobile.jscanvas + MobileControls canvas-online.jscanvas + Online, OnlineLobby pixi.jscanvas + PIXIEngine little.jscanvas + LittleEngine dom.jsDOMEngine, EventBus, AnimationSystem dom-online.jsdom + Online Also include
game-shell.cssfor base styles:<link rel="stylesheet" href="../../engine/game-shell.css">
For the full architecture see the engine docs.
-
Push your changes. A GitHub Actions workflow will automatically run
scripts/scan-games.jsto updategames.jsonand deploy it to GitHub Pages. You can also run it locally vianode scripts/scan-games.js.
Each game directory is self-contained and can be opened independently - the engine is loaded via relative paths.
npx serve .
# or
python3 -m http.server 8000Open http://localhost:8000 in your browser. The hub lists all registered games; click any card to play.
├── engine/ # Shared styles, CDN libs & docs
│ ├── game-shell.css # Base reset, online lobby UI, D-pad styles
│ ├── pixi.min.js # PIXI.js library (WebGL)
│ ├── littlejs.min.js # LittleJS library
│ ├── matter.min.js # Matter.js (física 2D)
│ ├── howler.min.js # Howler.js (audio avanzado)
│ ├── pathfinding-browser.min.js # Pathfinding.js (rutas NPC)
│ ├── gsap.min.js # GSAP (tweens UI)
│ ├── rot.min.js # ROT.js (mazmorras roguelike)
│ ├── sprite-processor.js # Sprite cutting, engine conversion, debug grid
│ └── docs/ # Full documentation
├── src/ # Engine source (ESM modules, Vite build)
│ ├── core/ # Engine, DOMEngine, PIXIEngine, LittleEngine, GameBoot, EventBus, RenderBridge
│ ├── modules/ # Input, Audio, Online, MobileControls, UI
│ ├── components/ # Transform, Velocity, Collider, SpriteData
│ ├── systems/ # Movement, Physics, Render, Animation
│ ├── ecs/ # World, Component, System (bases)
│ ├── boot/ # Boot shims (canvas.js, dom.js, …)
│ └── index.js # Barrel export
├── games/ # Individual game directories
│ ├── #games here
├── public/ # Copied to dist/ as-is (Vite)
│ ├── engine/
│ │ └── game-shell.css
│ ├── games.json # Game manifest
│ ├── icon.svg # PWA icon
│ ├── manifest.json # PWA manifest
│ ├── style.css # Hub styles (responsive grid, dark theme)
│ └── sw.js # Service worker (js-games-v4, hybrid cache)
├── assets/ # Game assets (thumbnails, sprites, audio)
├── scripts/
│ └── scan-games.js # Auto-generate games.json from filesystem
├── index.html # Hub - minimal landing page (Vite entry)
├── main.js # Hub logic - fetches games.json, renders cards
| Layer | Tech |
|---|---|---|
| Runtime | Vanilla JS (no frameworks, no bundler) |
| Rendering | Canvas 2D (Engine), WebGL/PIXI.js (PIXIEngine), LittleJS (LittleEngine), DOM/CSS (DOMEngine) |
| Physics | Matter.js (MatterPhysicsSystem + PhysicsBody) |
| Input | Keyboard (keydown/keyup), Mouse, Touch (touchstart/touchend/touchmove) |
| Audio | Web Audio API / Howler.js (Audio, Howl) |
| Multiplayer | PeerJS / WebRTC (Online + OnlineLobby) |
| Pathfinding | Pathfinding.js (PathfindingSystem + PathAgent) |
| Animations | GSAP (TweenSystem + Tween) |
| Roguelike | ROT.js (dungeon gen, FOV, RNG) |
| Sprites | SpriteProcessor, SpriteManager, EntityComposer, SpriteStateMachine |
| PWA | Service Worker + Web App Manifest |
A collection of classic arcade games built with vanilla JavaScript.