montyengine
v0.2.1
Published
A lightweight, high-performance 2D game engine for TypeScript and HTML5 Canvas.
Maintainers
Readme
MontyEngine
A lightweight, opinionated 2D game engine with a clean, beginner-friendly API, built on top of an internal ECS architecture.
🎮 See it in action: Play Monty Dive, a game built entirely with MontyEngine!
🌟 Philosophy
MontyEngine is designed with Developer Experience (DX) as the absolute priority.
- Fast Prototyping: You should be able to create something on screen in under 2 minutes without understanding the engine internals.
- Scene-Driven Architecture: The
Sceneis the main entry point for all your game logic. - Powerful Internals, Simple API: Built on a highly-flexible ECS (Entity-Component-System) core, which is entirely hidden behind a simple, intuitive public API. No manual entity or system registration required!
🚀 Quick Start
Installation
npm install montyengineYour First Scene
import { Engine, Scene } from 'montyengine';
class MainScene extends Scene {
onCreate() {
// Render a simple sprite instantly!
const player = this.add.sprite({
texture: 'player', // Note: ensure 'player' texture is loaded
x: 100,
y: 100
});
}
onUpdate(dt: number) {
// Handle game logic effortlessly
if (this.input.isDown('ArrowRight')) {
// Logic to move right...
}
}
}
// Initialize the engine and start rendering!
const engine = new Engine({
canvas: document.getElementById('game-canvas') as HTMLCanvasElement,
width: 800,
height: 600,
scene: MainScene
});
engine.start();✨ Core Features
- 🏗️ No ECS Boilerplate: ECS is powerful, but you don't need to manually create entities, attach components, or register systems. Just use simple factory methods like
this.add.sprite(...). - 🎬 Clean Lifecycle: Intuitive
onCreate()andonUpdate()hooks in Scenes. - 📦 Automatic Dependency Injection: Input handling, object factories (
this.add), and time utilities are automatically passed to your Scene. - 🛡️ TypeScript First: Built with 100% TypeScript, giving you predictable autocomplete and type safety right out of the box.
🎮 Showcase
Check out what can be built with MontyEngine:
- Monty Dive - A complete, production-ready depth-diving game featuring parallax scrolling, state management, and asset loading—all powered by MontyEngine.
📄 License
MIT © legamuka
