a tile-game framework, 2D or 3D
Open it by double-clicking.
No server, no install, no runtime to download. Build a dungeon crawl, a hand-authored RPG, a creature battle or a dialogue scene: ship it as a folder a player opens directly. The game logic needs no renderer at all, so draw it with PixiJS in 2D or Babylon.js in 3D, over rot.js's classic algorithms.
npm install @datamoc/mw_games pixi.js
<script src="mw_games.global.js"></script>
<script>
const game = new mw_games.Game(canvas);
game.start(TitleScene);
</script>
the load-bearing rendering feature
Tint can only darken. mwg can also light up.
Every sprite in mwg carries a per-pixel colour transform,
texel × M + A, computed in the batch shader at no extra cost per
sprite. Darkness outside the field of view, a poisoned enemy, a hit flash, a room
lit by a fireplace: all of it is that one operation. A framework whose tint is
multiply-only, which is what most 2D engines ship, can only ever pull a sprite
towards black. Drag the sliders.
capability spec
Nine reference games, one shared floor
Each defines what the others do not need: none is copied, no code, asset, data table or file format is taken from any of them. They mark out the corners of what a tile game has to cover.
| reference | what it demands that the others do not |
|---|---|
| Shattered Pixel Dungeon | generated dungeons, field of view, energy-cost turn scheduling, permadeath, dense inventory UI |
| ADOM | many persistent maps joined by a world map, hunger and long-running effects, skills and attributes, quests inside a roguelike |
| RPG Maker projects | hand-authored maps, events on tiles, dialogue and cutscenes, a party, menu combat, save slots |
| Pokémon, in its traditional form | encounter tables by terrain, a roster of creatures with derived stats, an effectiveness matrix, speed-ordered battles, capture and storage |
| Ren'Py conversation scenes | a backdrop with characters standing in front of it, expressions, whoever speaks picked out from the rest, branching written as data |
| The Battle for Wesnoth | hexagonal tactical maps, movement cost and defense by terrain, zone of control, turn-based unit combat with recruiting and upkeep |
| Flare's Empyrean Campaign | isometric tile maps, loaded straight from Tiled's own isometric export |
| Dungeon Crawl Stone Soup (Tiles) | a branching dungeon of many interconnected levels, and autoexplore pathing to the nearest unseen tile |
| Twine | a story as named passages, not one linear list - a choice jumps to another passage by name, which can loop back or braid together, entirely on state and no visual stage at all |
running from file://
Opening a page from disk takes three things away
mwg is shaped around the restrictions, rather than pretending they aren't there.
| what is blocked | consequence | how mwg handles it |
|---|---|---|
| ES modules | <script type="module"> will not run |
the standalone build is a classic IIFE |
fetch() / XHR |
no asset can be loaded on demand, no directory can be listed | tools/compile-resources turns assets into scripts loaded before the game |
| cross-origin images | an <img> from a sibling file taints a WebGL texture in Chrome |
assets travel as data: URIs inside those scripts |
The practical effect: resources are compiled at build time, so at runtime every lookup is synchronous. Game code never awaits an asset.