A 3D map in the editor, with terrain and roads. What This Module Does
The core of the 3D renderer. A 3D map is still an ordinary RPG Maker map: the grid, passability and events work as always, and 3D data lives in a sidecar file (Map###.r3d.json). Three.js draws on PixiJS's own WebGL context, so windows, pictures and plugin sprites still draw on top of the world.
Example
// Is the current map 3D?
const is3D = Reactor3D.mapMode($dataMap) !== Reactor3D.MODE_2D;
// Ease the camera to an isometric view over 60 frames
Reactor3D.Camera.change({ mode: "isometric" }, 60);
// Is there a stair at this tile?
const stair = Reactor3D.stairAt($dataMap, $gamePlayer.x, $gamePlayer.y);
Classes & Namespaces
Reactor3D
117 functions →
Reactor3D.Viewport
33 functions →
Reactor3D.Geometry
22 functions →
Reactor3D.MapScene
42 functions →
Design Notes from the Source Code
A 3D view of an ordinary RPG Maker map.
Design constraints this file exists to honour:
The grid stays authoritative.
Game_Map,Game_Character, passability, region logic and the event interpreter keep operating on the samewidth * height * 6planes. A 3D event model is the exception: its authored size occupies every tile the mesh covers, so collision matches what is on screen.The map file is never rewritten. Elevation and geometry live in a sidecar (
Map###.r3d.json), so a 2D project never gains a file, and a 3D map'sMap###.jsonremains valid RPG Maker data describing its 2D footprint.Three.js loads on demand. It is ~2 MB; a project with no 3D maps must never download or parse it, so there is no entry in
scriptUrls.Three draws on PIXI's own WebGL context (
_initializeShared): each map pass renders into aWebGLRenderTargetthat PIXI samples as a texture, so there is no per-frame copy and PIXI keeps drawing windows, pictures, weather and every plugin-authored sprite over the world exactly as it does in 2D. If that handover fails,_initializeCanvasfalls back to a separate 3D canvas at z-index 0 under the game canvas. Screen effects keep their WebGL1 overlay; attached effects share the view GPU when supported.This file is the core of the 3D runtime, not all of it. A concern that outgrows it lives in one reactor_3d_<concern>.js named in
Reactor3D.EXTENSIONS(lighting and shadows, models, model effects, the world builder, speech, foliage), loaded right after this file everywhere: scriptUrls in the game, the extension list in the editor, and the tail of this file in Node.
Reactor3D
Namespace and lifecycle. Everything is static; there is at most one viewport.