Skip to content
YAGE

Yet Another Game Engine

A modular 2D game engine for TypeScript. Batteries included.
Loading…

Self-playing Pong. This is an embedded game not a gif.

import { Engine, Scene, Transform, Vec2 } from "@yagejs/core";
import { RendererPlugin, CameraKey } from "@yagejs/renderer";
import { PhysicsPlugin } from "@yagejs/physics";
import { UIPlugin } from "@yagejs/ui";
import { Ball } from "./Ball";
import { Paddle } from "./Paddle";
import { Wall, Goal, Scoreboard } from "./GameArea";
class PongScene extends Scene {
readonly name = "pong";
onEnter() {
const camera = this.context.resolve(CameraKey);
camera.position = new Vec2(300, 200);
this.spawn(Scoreboard);
const ball = this.spawn(Ball, { w: 600, h: 400 });
this.spawn(Paddle, { x: 30, y: 200, ball, side: "left" });
this.spawn(Paddle, { x: 570, y: 200, ball, side: "right" });
this.spawn(Wall, { x: 300, y: -10, w: 600, h: 20 }); // top
this.spawn(Wall, { x: 300, y: 410, w: 600, h: 20 }); // bottom
this.spawn(Goal, { x: -20, y: 200, w: 20, h: 400, side: "left" });
this.spawn(Goal, { x: 620, y: 200, w: 20, h: 400, side: "right" });
}
}
const engine = new Engine();
engine.use(new RendererPlugin({ width: 600, height: 400, backgroundColor: 0x0a0a0a }));
engine.use(new PhysicsPlugin({ gravity: { x: 0, y: 0 } }));
engine.use(new UIPlugin());
await engine.start();
engine.scenes.push(new PongScene());

Component-Based

Build game objects by composing reusable components — movement, physics, animation, and more.

Plugin Architecture

Rendering, physics, input, audio, particles, tilemaps, UI — pick only what you need.

TypeScript First

Strict TypeScript with typed DI, typed events, and zero any. Full autocomplete everywhere.

Battle-Tested Foundations

PixiJS v8 for rendering, Rapier2D for physics. Production-grade libraries under the hood.