Skip to content

js360000/Theia

Repository files navigation

Theia

Theia

A native level editor for Insomniac's Luna-engine games. Named for the planet that struck the young Earth and made the Moon — because everything here orbits Luna.

Theia is a fast Dear ImGui + Direct3D 11 editor, built for x86-64 and ARM64 Windows from day one, that opens retail game data directly — no extraction step — renders levels with the game's own reversed material system, and writes real, repackable edits.

The editor The suite in action: hierarchy, checkpoint browser, inspector with gizmo/undo controls, and the Animation panel on a rigged moby (318 joints, live clip list).

Ardolis bar Megalopolis
Rift Apart — Ardolis bar, reversed gbl_rgb_blend materials Rift Apart — Megalopolis skyline
Islands RCPS4 Veldin
Atmosphere-lit sky, overlays Ratchet & Clank (PS4) — Veldin, detiled GNM textures
IRIS authoring PS4 Ratchet posed
a scene built by an LLM over IRIS: whitebox floor, primitives, a real crate PS4 Ratchet posed by the reversed animclip decoder
Bat wing flap Whitebox grid
one clip, two frames — skinned playback in-viewport dev blockout materials render the game's world-space grid

orbit clip

Supported games

game status
Ratchet & Clank: Rift Apart (PC) full: rendering, checkpoints, actors, volumes, editing, mods
Ratchet & Clank (PS4, 2016) zones, models, GNM-detiled textures, actors/configs (shared parsers)
Marvel's Spider-Man Remastered / Miles Morales initial: TOC indexing per ALERT; payload reads finalized when game files are available
Marvel's Wolverine (M8/M13 builds) initial: TOC-family detection

A startup dialog picks the game and asks for its toc / asset_archive location.

What it does

  • Load anything: multi-zone scenes, whole-level loading via the checkpoint system (860 named checkpoints reversed from i29.level — including content with no obvious zone path), per-zone visibility, category filters (art / gameplay / lighting / audio). Checkpoints select zones through the game's own spatial load-unit tables (region tree → load units → zone ranges), so a checkpoint loads exactly its area — no cross-planet bleed — and frames it from a clean aerial angle.
  • See it like the game: the gbl_rgb_blend material family was reversed from the game's own compiled shaders (per-layer HSV grading, id-mask blending, material-pack gloss/height/normal slices), plus atmosphere-driven lighting, height fog, SSAO, sky, and experimental compute-BVH ray-traced sun shadows. Vendor-aware defaults for NVIDIA / AMD / Snapdragon.
  • Populate it: mobys/actors placed from the zone GUID tables (the game's own placement oracle — no duplication), typed translucent volumes (kill / swim / checkpoint / camera / trigger), grind-rail & ledge-path splines.
  • Edit it: full undo/redo command stack, multi-select (ctrl-click, shift-drag marquee) with group gizmo transforms, a Hierarchy outliner (zone → model → instance, search, per-batch visibility), camera bookmarks (F1–F5), W/E/R gizmo hotkeys with local/world space, grid & angle snapping, duplicate/delete, add instances from every shipped model, edit actor attributes (Grind / Slide / Hang / Kill flags, health, rewards…) and .config variables with same-size in-place patching, with field documentation on hover when a metadata oracle is present. Whitebox/blockout dev materials render the game's own world-space grey grid. A code-built default dock layout (tabbed panels around a clear viewport) rebuilds on View → Reset layout.
  • Animate it: the .animclip keyframe compression was reversed here (min-anchored base state + per-channel bit-packed rows — both the RCRA and PS4-2016 variants, typed PS4 skin batches included). Click a rigged moby → Animations → play any of its clips skinned in-viewport, scrub, freeze poses — and export mesh + skin + clips as glTF 2.0 for Unreal 5's native importer or Unity (glTFast/UnityGLTF).
  • Import your own: OBJ and FBX with automatic texture mapping, placed like native content, and repacked into genuine .model assets (quantized positions, hemisphere-encoded normals) that Theia's own parser round-trips.
  • Hand it to an agent: IRIS exposes the whole editor over the Model Context Protocol — 35 tools for loading worlds, editing/set-dressing existing zones, authoring levels from scratch with whitebox primitives, tuning attributes, playing animations, and taking screenshots that are returned to the model as images so it can visually verify its own work. Zero-dependency Python bridge; localhost only.
  • Ship it: zone edits are written back into real .zone files; everything exports as a .stage mod (Overstrike/ALERT layout), and existing .stage files import as live asset overrides.

Building

MSVC 2022+, CMake ≥ 3.24, Ninja. Dependencies (Dear ImGui, ImGuizmo, lz4, miniz, ufbx) fetch automatically.

cmake --preset x64-release    && cmake --build --preset x64-release
cmake --preset arm64-release  && cmake --build --preset arm64-release

Tests: ra_probe.exe (42 data-level checks against a retail dump), theia.exe --uitest <zone> (headless UI pass), theia.exe --screenshot <zone> <png> (automated renders; many RC_* env overrides for camera, checkpoints, overlays, RT, imports, animation poses).

IRIS — the agentic editor

Connect Claude (or any MCP client) and let it drive Theia: see docs/IRIS.md for setup (one claude mcp add line), the full 35-tool reference, and prompts that work well — from "build a combat arena from scratch and screenshot it as you go" to "make the bar feel more lived-in and show me before/after". The screenshot above of the grid-floored scene with the crate was authored entirely by an agent over IRIS.

Format documentation

Everything Theia knows is written down in docs/RIFT_APART.md: DAT1, DSAR + GDeflate, TOC/DAG, slice-major texture arrays, the model/material/zone layouts, the level ↔ region ↔ checkpoint tables, mod containers, the skeletal animation formats (§14 — skeleton, both skin encodings, and the animclip bitstream, reversed here), and the param-name hash (DDLParser StringCrc32, seed 0xEDB88320). The tools/ directory holds the Python reference implementations used as regression tests.

Credits

  • ALERT — Tkachov's Luna research; the primary structural oracle for this project.
  • DDLParser — the param-name hash.
  • rivet, ufbx, Dear ImGui, ImGuizmo, lz4, miniz.
  • The Spider-Man / Rift Apart modding community.

Theia began life as RCEdit, a web-based editor whose archived source remains available for reference.

About

A native level editor for Insomniac Luna-engine games (Rift Apart, R&C PS4, Spider-Man)

Resources

Stars

1 star

Watchers

0 watching

Forks

Packages

 
 
 

Contributors