A TypeScript-based point & click adventure game engine built with HTML5 Canvas.
Originally a pure JavaScript engine for point & click adventures, now modernized with TypeScript for better type safety and developer experience.
- Node.js (v18 or higher)
- pnpm (v9 or higher)
Install dependencies using pnpm:
pnpm installBuild and serve the game locally:
pnpm startThis will:
- Compile TypeScript to JavaScript (ES2020 modules)
- Compile SCSS to CSS
- Copy assets to the
dist/folder - Start a local server at
http://localhost:8080
The game will open automatically in your browser.
If you need to run individual build steps:
# Compile TypeScript only
pnpm run compile
# Compile SCSS only
pnpm run compile:scss
# Copy assets only
pnpm run copy:assets
# Build everything
pnpm run build
# Serve the dist folder
pnpm run serveRun TypeScript type checking without building:
pnpm type-checkbeAdventureEngineTS/
โโโ src/
โ โโโ assets/ # Game assets (copied to dist during build)
โ โ โโโ fonts/
โ โ โโโ images/
โ โ โ โโโ maps/ # Map backgrounds (R/M/F layers)
โ โ โ โโโ ui/ # UI elements, characters, objects
โ โ โโโ maps/ # Map JSON definitions
โ โ โโโ minigames/
โ โ โโโ musics/
โ โ โโโ sounds/
โ โ โโโ settings.json
โ โโโ css/
โ โ โโโ style.scss # Main styles
โ โโโ js/ # TypeScript modules
โ โ โโโ engine.ts # Main game loop and rendering
โ โ โโโ settings.ts # Game settings loader
โ โ โโโ mathHelper.ts # Math utilities
โ โ โโโ soundsSystem.ts # Audio management
โ โ โโโ spriteManager.ts # Sprite loading and management
โ โ โโโ fontManager.ts # Text rendering
โ โ โโโ effectManager.ts # Visual effects
โ โ โโโ minigame.ts # Base minigame class
โ โ โโโ mapManager.ts # Map loading and transitions
โ โ โโโ mouseManager.ts # Mouse interaction handling
โ โ โโโ interactableManager.ts # Game interactables logic
โ โโโ types/
โ โ โโโ index.ts # TypeScript type definitions
โ โโโ index.html # Entry HTML file
โ โโโ main.ts # Application entry point
โโโ dist/ # Production build output
โ โโโ assets/ # Copied game assets
โ โโโ css/ # Compiled CSS
โ โโโ js/ # Compiled JavaScript modules
โ โโโ types/ # Type declarations
โ โโโ main.js # Compiled entry point
โ โโโ index.html # HTML file
โโโ package.json
โโโ tsconfig.json # TypeScript configuration
โโโ README.md
The project uses a simple build pipeline without bundlers:
- TypeScript Compiler: Compiles
.tsfiles to ES2020 modules with.jsextensions - Sass: Compiles SCSS to CSS
- http-server: Serves the game locally for testing
This approach preserves the original JavaScript behavior, including synchronous asset checking with XMLHttpRequest, which is important for the game's asset loading system.
The tsconfig.json is configured for:
- ES2020 module output with Node resolution
- Strict type checking enabled
- Source maps for debugging
- Relative imports with
.jsextensions (required for ES modules without bundlers)
All relative imports must include the .js extension, even in TypeScript files:
import { Settings } from './settings.js';
import { SpriteManager } from './spriteManager.js';This is required for ES modules to work properly when served directly without a bundler.
- Engine: Main game loop, rendering pipeline, and state management
- SpriteManager: Loads and manages all sprites with synchronous asset checking
- MapManager: Handles map loading, transitions, and camera system
- InteractableManager: Processes player interactions (look, take, talk, combine, etc.)
- MouseManager: Handles mouse input and cursor states
- SoundSystem: Audio playback for music and sound effects
- FontManager: Text rendering system
- EffectManager: Visual effects (fade, shake, etc.)
The engine uses a synchronous XMLHttpRequest approach to check if optional assets exist before loading them. This ensures the game doesn't get stuck waiting for missing files.
Maps consist of:
- Background layers (Rear, Middle, Foreground)
- Animated characters
- Interactive objects
- Interactable zones with actions
- Spawn points and camera settings
- All core game systems
- Full type definitions
- Working map transitions
- Partner/companion system
- Inventory system
- Dialog system
- Question/answer system
- Minigame integration (Fallout-style hacking minigame)
- Fixed Vite compatibility issues with synchronous asset checking
- Fixed map transition bugs (UI and characters now render correctly)
- Fixed partner animation bug (talking animations work properly)
- Fixed partner object collection (objects removed from screen correctly)
- Fixed question answer validation (numeric
validfield instead of boolean)
import { beAdventurousEngine } from './js/engine.js';
import { FalloutMinigame } from './assets/minigames/fallout-minigame/falloutMinigame.js';
// Initialize the game
const game = new beAdventurousEngine('game');
// Register minigames
game.registerMiniGame('FalloutMinigame', FalloutMinigame);
// Start from map 0
game.start(0);For the original JavaScript engine, see the .pdf documentation covering configuration, minigames, tutorials, and more.
To make a simple demo project and to speedup development I used many graphical resources I found on the Internet. I'll try to give proper credit here for every resource I'm able to. If I've missed some, please, help me correct this. This is a didactical, fun and hopefully useful project and none of these resources were used with any commercial intent.
https://www.fontpalace.com/font-details/00-starmap-truetype/
https://www.artstation.com/pixeljeff1995
https://pixpilgames.tumblr.com/
https://www.reddit.com/r/Cyberpunk/comments/d6jf4x/i_made_a_pixel_art_background_from_osaka_for/
https://opengameart.org/content/cyberpunk-street-environment
https://www.reddit.com/r/Terraria/comments/98o10w/all_terraria_potions_resprited/
https://www.pinterest.it/pin/714946509587457586/
https://www.deviantart.com/cayiika/art/Dr-Nefarious-Pixel-Art-animated-668660087
https://www.spriters-resource.com/pc_computer/cherrytreehighcomedyclub/sheet/51851/
https://www.spriters-resource.com/neo_geo_ngcd/ms2/sheet/11231/