Skip to content
This repository was archived by the owner on Jul 10, 2026. It is now read-only.

js360000/rcedit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RCEdit — Ratchet & Clank Web Level Editor

A browser-based level editor for Ratchet & Clank (PS4, 2016) and Ratchet & Clank: Rift Apart (PS5/PC) — built entirely from reverse-engineered game formats.
Python tooling decodes the retail dumps into glTF/PNG; a Vite + Three.js app renders, inspects, and edits them — switching between games live — and writes PS4 changes back into the game.

Games Three.js Python Vite status


Important

This repository is archived. The project has been renamed Theia and development continues at github.com/js360000/Theia — a C++20 / Dear ImGui / Direct3D 11 native editor (x86_64 + ARM64) with the Python format-reference tools, complete format documentation, and compiled releases. The web editor (editor/) here remains functional as a reference viewer; the final snapshot of the native editor's source lives in native/.

One editor, two games

Both games run Insomniac's IG engine, and their built assets share the same 1TAD container with identical section CRCs — so one set of decoders unlocks both. RCEdit loads either game from its table of contents and swaps between them from a dropdown in the top bar: the PS4 side gets the full editing stack (mod overlay, spawning, variables, import, AI Studio); Rift Apart gets full decoding, browsing and on-demand rendering of its 9,046 streamed open-world zones, plus cross-game porting in both directions.

Ratchet & Clank (PS4, 2016) Rift Apart (PS5/PC)
Render levels / zones ✅ all 29 levels (+11 PS2 originals) ✅ all 9,046 shipped zones, on demand
Models · textures · materials ✅ incl. DirectStorage-streamed hi-res mips
Zones · actors · variables
Editing → in-game mod overlay 🔜 (read-only for now)
Cross-game asset porting ✅ PS4 → RA bundles ✅ RA → PS4 canvas zones

Gallery

Rift Apart

Nefarious City Ardolis pirate bar
Nefarious City — 16,612 building instances decoded straight from the PS5 open-world stream Ardolis — pirate bar — full material → albedo texture chain, with the per-zone instance tree open
Shipwreck Zone browser
Ardolis shipwreck — props use subset-relative index buffers, decoded per-subset Zone browser — all 9,046 zones in a pre-expanded folder tree mirroring the game's archive layout, with multi-select + Load all

Ratchet & Clank (PS4, 2016)

Dual-game editor Aridia
The same editor, one dropdown later — a full PS4 level with zones, checkpoints and spawn points Aridia — the real night-nebula sky, decoded from the game's atmosphere
AI Studio Nebula G34
✨ AI Studio — IRIS — the natural-language level composer assembling encounters from real game assets Nebula G34 — the Blarg space station under its full nebula panorama, including cut content
Metropolis Veldin
Metropolis (Kerwan) — 90k instances, culled to a playable cityscape Veldin — sunset sky from atm_veldin (switchable to night on the fly)
More — checkpoints, overlays, decoding, editing & import
Checkpoints Veldin garage
Checkpoint scenes — the decoded checkpoint table incl. cut entries Placement precision — GUID-verified records only
Overlays PS2 Novalis
Semantic overlays — collision, typed volumes, grindrail splines PS2 · Novalis — the original 2002 game, also in the PS4 files
Model decode Texture decode
.model → glTF (verts, normals, UVs, LODs, 193 joints) .texture → PNG (BC7/BC5, PS4 untile, mip streams)
Editing Import
Spawn + gizmo-transform any actor, save to a mod overlay Import an OBJ/FBX — real .model + .texture in-game

What it does

Both games

  • Live game switching — pick a game in the top bar; the workspace clears, the right browser appears (level list for PS4, zone tree for Rift Apart), and every API call re-targets the active game's table of contents.
  • Per-zone instance tree — every loaded zone unfolds in the sidebar into its indexed assets and placements; click to fly the camera to any instance, right-click to edit its attributes (PS4 fully editable; Rift Apart read-only for now).
  • Full inspection — click any object for its transform, model, material, and (PS4) the game's own typed variables.
  • Cross-game porting — a zone's models + textures re-encode through a shared mesh IR in either direction: PS4 zones export to Rift Apart-format bundles; RA assets inject into a PS4 canvas zone and survive repack through the game's own TOC path.

Ratchet & Clank (PS4) — the editing stack

  • Renders all 29 shipping levels — 17 remake planets (art + gameplay + skybox), Veldin's cut early layout, and 11 PS2 originals that ship inside the PS4 files — at 60 fps.
  • Faithful visuals — decoded models & textures, per-instance culling, real atmosphere skies with day/night switching, sky-driven lighting, semantic colouring (collision, swim/lava/grindrail volumes, spawns).
  • Real editing — transform gizmos, a categorised zone-variables modal, duplicate/spawn from the entire actor catalogue, OBJ/FBX import, generated Havok collision — all written back to a non-destructive mod overlay (toc + mods000) the game loads like a shipping asset.
  • Level authoring (Create…) — parametric primitives, spawn any game model or moby from any level into any other, live-editable path/curve control points.
  • Checkpoint scenes — the compiled checkpoint table decoded (incl. dev/cut checkpoints); fly to any spawn or isolate its scene.
  • ✨ AI StudioIRIS, a natural-language level composer (Claude via the Messages API tool loop) that assembles encounters from the game's own asset library; texture generation via Nano Banana 2; 3D model generation via Meshy with triangle-budget decimation. Works with no API keys in dry-run mode.
  • 🌍 New Level Workshop — author a brand-new campaign planet slot, selectable on the in-game galactic map, backed by a donor level id. Fully reversible.

Rift Apart (PS5/PC) — the decoding stack

  • The whole open world, zone by zone — Rift Apart streams one giant world, so RCEdit browses it as the game stores it: a pre-expanded folder tree of all 9,046 shipped zones (levels/i29/instance/<planet>/…), searchable, with per-folder counts. Click a zone to decode + render it on demand (~10–40 s first time), or tick zones/folders and "Load all" to merge a whole area into one scene — a 115k-instance multi-zone load is routine.
  • True textures at native resolution — the full material → albedo chain: MODEL_MATERIAL records → .material texture tables → BCn textures, including the DirectStorage-streamed hi-res mips (reversed: they live in a headerless TOC asset sharing the texture's path hash in stream group 1). The decoder seeks directly to the mip it needs, so a 16k-instance zone with 27 streamed textures exports in ~40 s.
  • Every visual format decoded — BC1/3/4/5/6H/7, RGBA8, RG8, R8, PS5 recursive Z/N-order unswizzle, GDeflate decompression in pure Python, verified byte-exact against NVIDIA's reference codec.
  • Shader-constant materials — texture-less materials (glass, glows, light values) render with their real opacity read from the material and a name-derived colour, so buildings aren't mysteriously transparent.
  • Actors & components decoded — RA's 32-byte component records, string tables and zone layouts are auto-detected against the PS4 variants, so the same inspector works on both games.

Everything is verified end-to-end: PS4 edits, spawns, imports, and generation round-trip byte-exactly through the game's own TOC resolution; Rift Apart decoding is validated against the real 340k-asset retail build on every run of tools/ra/test_real.py.


Quick start

You supply the game(s):

  • PS4 — a decrypted retail dump (an asset_archive/ with layout.csv, toc, and archives). Point tools/rcdb.py's DEFAULT_ROOT at it.
  • Rift Apart — the PC build's install folder (contains toc, dag, and the d/ archives). Point tools/games.py's RIFT_ROOT at it. Either game alone works; with both, the in-editor switcher appears.
# 1. Python codecs (Python 3.11+)
pip install lz4 pillow texture2ddecoder numpy

# 2. Export the PS4 level library -> GLBs + a picker index (Rift Apart needs no pre-export)
cd rcedit
python -m tools.export_all editor/public/data

# 3. Run everything (starts the API bridge + the editor, opens your browser)
./start.ps1              # Windows quick-start; or manually:

#    python -m tools.serve_api     # editing/decoding API  http://127.0.0.1:8791
#    cd editor && npm install && npm run dev    # editor   http://localhost:5173

# 4. (optional) AI Studio keys — omit for dry-run mode (existing-asset assembly)
#    env: ANTHROPIC_API_KEY / GEMINI_API_KEY / MESHY_API_KEY
#    or _work/ai_keys.json: {"anthropic": "...", "gemini": "...", "meshy": "..."}

Viewport: LMB orbit · RMB pan · wheel zoom · WASDQE fly (Shift = fast) · click to select · G/R/X gizmo · V duplicate · F frame. Games: top-bar dropdown switches PS4 ↔ Rift Apart. PS4 picks levels from the level list; Rift Apart opens the 📂 zone browser (folder tree, search, multi-select + Load all). 🧹 Clear empties the workspace. Settings ⚙: overlays, gameplay items, mipmaps, LOD/culling, skybox + sky/time-of-day picker, level lights, SSAA, draw distance — all persisted.


How it works

Both games share one universal container: every decompressed asset — .level, .zone, .model, .texture, .material, .actor — is a 1TAD (DAT1) sectioned container, and the section CRCs for zones, actors, models and config data are identical across both games. One parser, two games; the per-game differences (record strides, string-table layouts, index conventions) are auto-detected per file.

PS4 (2016)

  1. Archives + TOC — assets live in big archives indexed by a zlib-compressed toc (magic AF 12 AF 77); the dump's layout.csv maps asset paths → archive/offset/size.
  2. Per-asset compression — each built asset is an LZ4 block behind a 0x24-byte header.
  3. Asset IDs — the runtime path→id hash is a proprietary one-way hash; new content ships via a donor-overlay mechanism.

Rift Apart (PS5/PC)

  1. DSAR archives — 147 block-compressed archives (GDeflate — DirectStorage's 32-lane DEFLATE64 — or LZ4). RCEdit ships a from-scratch pure-Python GDeflate decoder, verified byte-exact against NVIDIA's reference.
  2. TOC + DAG — the toc indexes 340,665 assets by a computable CRC-64 path hash (crc64_path, CRC-64/XZ variant); the dag dependency graph is the path oracle (169,245 names).
  3. DirectStorage texture streaming (reversed here) — a streamed texture's hi-res mip chain is a separate headerless TOC asset with the same path hash in stream group 1; the base .texture keeps only the low mips. RCEdit computes the byte range of the mip it wants and decompresses just that slice.

A .level is a manifest of zones; a .zone holds the content — model instances (4×4 transforms), actor placements, volumes, script variables. Rift Apart's open world is one streamed mega-level of 9,046 zones, so RCEdit browses and renders it zone-by-zone.

Reversed & implemented

Area PS4 (2016) Rift Apart
Archives ✅ zlib TOC + LZ4 assets ✅ DSAR (GDeflate pure-Python + LZ4), TOC + DAG
Models ✅ int16 verts, LODs, joints ✅ s16 × header scale, dual index conventions, 16-byte material records
Textures ✅ BC7/BC5/BC1/RGBA8, PS4 untile, .stream mips ✅ BC1–7/BC6H, PS5 unswizzle, DirectStorage group-1 hi-mip streams
Materials ✅ binding tables → albedo ✅ texture tables → albedo + shader-constant opacity
Zones / actors ✅ instances, actors, volumes, splines ✅ same lumps; RA strides auto-detected
Variables (prius) ✅ full typed-dict, editable ✅ readable
Havok collision ✅ parser + writer (byte-exact)
Repack / mods ✅ non-destructive overlay, TOC-verified 🔜
Cross-game port ✅ PS4 → RA bundle ✅ RA → PS4 canvas, repack-verified

See the full technical log in docs/FORMATS.md.


Repository layout

rcedit/
  tools/            Python codecs & CLIs  (python -m tools.<name>)
    rcdb.py          PS4: layout.csv index + archive reader + LZ4
    games.py         multi-game registry (PS4 + Rift Apart roots)
    dat1.py          DAT1 ('1TAD') container parser — both games
    model.py zone.py prius.py texture.py    PS4 decoders
    ra/              Rift Apart: db.py (TOC+DAG), archive.py (DSAR),
                     gdeflate.py (pure-Python), model.py, texture.py,
                     material.py, export.py, crc.py, test_real.py
    crossport.py     PS4 <-> Rift Apart porting through a shared mesh IR
    havok.py         Havok packfile reader + collision writer
    zone_edit.py     spawn / clone / grow zones      import_mesh.py  OBJ/FBX import
    export_*.py      model/zone/level -> glTF        serve_api.py    editing HTTP bridge
    test_*.py        repack / spawn / import / crossport verification suites
  editor/           Vite + Three.js app ("RCEdit")
    src/main.js      renderer, culling, gizmos, game switcher, zone browser
    public/data/     exported GLBs + index.json  (git-ignored)
  start.ps1         one-command quick start (API + editor + browser)
  docs/             logo, screenshots, format notes

Roadmap / known gaps

  • Rift Apart editing — the mod-overlay/repack path for RA (currently read-only; PS4 editing is complete).
  • Rift Apart skyboxes — RA's 156 .atmosphere assets are enumerated; sky-dome rendering is next.
  • Per-frame animation & cinematic curve interpolation (base pose decoded; delta stream WIP).
  • Materialgraph multi-layer blending (currently the primary albedo slot).
  • PS4 asset-ID minting (the runtime hash is confirmed irreversible; new content ships via donor overlay).

Credits & legal

Format groundwork builds on the community ig-tools research, the ripped_apart project, and the R&C modding scene. Havok, Insomniac, and Ratchet & Clank are trademarks of their respective owners.

This project ships no game assets. It is a set of tools and a viewer; you must provide your own legally-obtained game dumps. For research, preservation, and personal modding use.

MIT-licensed tooling — see LICENSE.

About

Web-based level editor for Ratchet & Clank (PS4), built from reverse-engineered game formats. Decodes models/textures/zones/Havok to glTF, renders in Three.js, and repacks edits back into the game.

Topics

Resources

License

Stars

3 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors