A colorful pixel-art quiz game engine for building browser-based fact-matching games. Players match facts to characters/picks and try to reach the maximum number of consecutive successful guesses!
- ๐ฎ Browser-based game engine - No installation required, runs in any modern browser
- ๐จ Pixel-art aesthetic - Colorful retro-style UI with pixel fonts and vibrant gradients
- ๐ฏ Fact-matching gameplay - Match interesting facts to characters/items
- ๐ Flexible data loading - Support for both GitHub-hosted JSON files and SQLite databases
- ๐ผ๏ธ Image support - Optional pixel art images for picks and facts
- โ๏ธ Built-in database editor - Easy-to-use browser-based tool for creating and editing game data
- ๐ Streak-based scoring - Players aim for the maximum consecutive correct guesses
- ๐ฑ Responsive design - Works on desktop and mobile devices
npm install
npm startThis will start a local web server and open the game in your browser at http://localhost:8080.
npm run editorThis will open the database editor at http://localhost:8080/editor.html.
- The game presents a fact with a category hint (e.g., "AWARDS", "FOOD")
- You're asked: "Who [FACT]?" (e.g., "Who WON THE NOBEL PRIZE?")
- Choose from multiple character options
- If you guess correctly, your streak continues
- If you guess wrong or run out of time, the game ends
- Try to achieve the maximum consecutive correct guesses!
The game uses a compact JSON format where each pick carries its own facts:
{
"picks": [
{
"id": "1",
"name": "Alice",
"description": "Famous Singer",
"image": "https://example.com/alice.png",
"facts": [
{
"description": "WON THE NOBEL PRIZE",
"category": "AWARDS",
"quantity": 1,
"image": null
},
{
"description": "HAS THE MOST DOGS",
"category": "ANIMALS",
"quantity": 10,
"image": null
}
]
}
]
}Key features:
- Compact structure: Facts are embedded directly in each pick
- Optional quantity field: When multiple picks share the same fact, the one with the highest quantity wins (e.g., if both Alice and Bob won Nobel Prizes, Alice with quantity=2 beats Bob with quantity=1)
- No fact IDs needed: Facts are identified by their description
Note: The SQLite loader is not currently updated for the compact format. Only the JSON format is supported with the new compact structure.
The database editor (/editor.html) provides a visual interface to:
- Add Picks - Create characters/entries with embedded facts
- Add Facts to Picks - Define facts with descriptions, categories, optional quantities, and images
- Add Images - Optionally add pixel art images for picks and facts
- Import Data - Load existing JSON data
- Export JSON - Download your database as a JSON file
- Visual editing - Click-based interface, no code required
- Inline fact editing - Add and edit facts directly within each pick
- Quantity support - Specify quantities for facts to determine the "winner" when multiple picks share a fact
- Live preview - See your picks as cards with their associated facts
- Local storage - Automatically saves your work in the browser
- Bulk import - Paste JSON data to quickly populate the database
You can host your game data on GitHub and load it directly:
const dataLoader = new JSONLoader('https://raw.githubusercontent.com/username/repo/main/data/game-data.json');This allows you to:
- Version control your game data
- Share data across multiple game instances
- Update game content without redeploying
versus/
โโโ public/ # Web-accessible files
โ โโโ index.html # Main game page
โ โโโ game.js # Game UI and logic
โ โโโ styles.css # Game styling
โ โโโ editor.html # Database editor page
โ โโโ editor.js # Editor logic
โ โโโ editor-styles.css # Editor styling
โโโ src/ # Source code (for Node.js usage)
โ โโโ models/ # Data models
โ โ โโโ Pick.js # Pick/entry model
โ โ โโโ Question.js # Question model
โ โโโ loaders/ # Data loaders
โ โ โโโ DataLoader.js # Base loader
โ โ โโโ JSONLoader.js # JSON loader
โ โ โโโ SQLiteLoader.js # SQLite loader
โ โโโ engine/ # Game engine
โ โโโ GameEngine.js # Core game logic
โโโ data/ # Example data
โ โโโ example-data.json
โโโ examples/ # Usage examples
โโโ package.json
โโโ README.md
Represents a fact that can be associated with picks (e.g., "WON THE NOBEL PRIZE", category: "AWARDS").
Represents a single character/item in the game with associated facts and optional pixel art image.
Represents a game question with a fact, options (picks), and the correct answer.
Base class for loading game data from various sources.
Loads data from JSON files (local or remote).
Loads data from SQLite databases (requires sql.js in browser).
Core game logic - manages game state, question generation, and scoring.
Edit public/styles.css to customize:
- Colors and gradients
- Fonts and sizes
- Layout and spacing
- Animations
Edit src/engine/GameEngine.js to customize:
- Number of options per question
- Scoring logic
- Question generation algorithm
- Chrome/Edge: โ Full support
- Firefox: โ Full support
- Safari: โ Full support
- Mobile browsers: โ Full support
ISC
Contributions welcome! Please feel free to submit issues and pull requests.