Jump to content


Photo

Lionheart Map Editor

Lionheart terrain editor

  • Please log in to reply
6 replies to this topic

#1 AlleyV

AlleyV
  • Member
  • 5 posts

Posted 18 June 2026 - 08:07 PM

mkpRU7a.png



Well, this is my first post in this great community, and I wanted to pitch in and do my bit.


 

I’ve managed to extract all the FRM16 files contained within the MDL16 files into PNG format. I did all of this with the little I know and with the help of Claude AI, because honestly, I HAVE ABSOLUTELY NO CLUE. I'm just your typical noob who takes an AI and makes stuff happen without really understanding any of it.

 

I’ve documented the entire format; it’s uploaded and can be downloaded both directly from the editor itself and in the GitHub zip file.

 

This is made for the community, so feel free to do whatever you want with it. I’m just here to contribute and, obviously, for my own personal interest as I get started with Baldur's Gate mods.

 

The Terrain Editor's options are currently in Spanish, but later today I'll release an English version and fix some issues with a few PNGs.

 

When exporting to PNG, the alignment isn't perfectly corrected yet, so it still exports the seams between the terrain textures.

 

I'll be updating it over the next few days. In the meantime, if anyone wants to use the images however they like, they are all available in the cache folder of my Google Drive.


P.S: : I'll also add an option to generate the original Lionheart maps and export them


GITHUB : https://github.com/A...G---Map-Editor-
 

 



#2 AlleyV

AlleyV
  • Member
  • 5 posts

Posted 22 June 2026 - 01:56 AM

fv2LKxR.jpeg



#3 AlleyV

AlleyV
  • Member
  • 5 posts

Posted 05 July 2026 - 12:31 AM

Final update :

Lionheart Map Editor

A browser-based map editor to reuse assets from Lionheart: Legacy of the Crusader (proprietary MDL16 and FRM16 formats) as static maps for the Infinity Engine (BG2:EE / EET and compatibles).

It decodes Lionheart sprites and models directly in the browser—without prior conversion or external tools—and allows you to paint terrain in layers, place MDL16 objects with their shadows, and export the map as a single PNG ready to be imported into your pipeline (TIS/BAM, DLTCEP, NearInfinity).

Created as a tool for the Myth Drannor mod (reusing ~4,000 Lionheart assets in static BG2:EE maps).

What It Is For

  • Explore and preview Lionheart assets (.mdl16, .frm16, .seq16) without decompiling anything.

  • Compose static maps: layer-painted terrain + hand-placed objects.

  • Export the result as a high-resolution PNG, serving as the base for an Infinity Engine area.

  • Serve as a reference decoder for MDL16/FRM16, with the format specification (Python) included and downloadable directly from the UI.

Note: It is not an IE area editor in itself (it does not generate .are/.tis/.wed files). It produces the map image, which you then assemble with DLTCEP / NearInfinity / WeiDU just like any other custom area.

What It Does Lionheart Format Decoding (Native, in-browser)

  • FRM16: 36-byte header, up to 5 layers per frame, 3-case RLE (SKIP / LITERAL / RUN) on RGB565, with row offset tables. Supports frames embedded in MDL16 (01 32 10) and standalone FRM16 (32 10), both RAW (terrain textures) and compressed.

  • MDL16: Multi-frame composition matching the game engine—object (slot 0) + silhouette/shadow (slot 4 with its alpha in slot 3)—with blending derived from engine decompiles (linear alpha a·v/255, shadows Blend_Black_Bias ≈ multiply).

Terrain

  • Splatmap-style layer system: Each layer is a tiled texture masked by a paint map.

  • Soft round brushes (size, flow, hardness), eraser, per-layer opacity and visibility, layer fill/clear, and undo.

  • Shortcuts: [ / ] for brush size, B / E for brush/eraser.

MDL16 Objects

  • Placement, movement, scaling, and H/V flipping.

  • Layer Mode (, / .) Cycle through the model's frames or view everything merged.

  • Shift Mode (S, then , / .) Fine-tune the row shifting live on the terrain.

  • Shadow linked to the object on a single canvas, composited correctly over the terrain.

Map and Export

  • Configurable grid (128 px tile by default).

  • Save / open projects in a custom JSON format ("lionheart-map", version 3, backward compatible).

  • Import .zax, export the full map to PNG without grid lines or seams.

  • Minimap, asset viewer, credits and shortcuts modals, bilingual ES/EN interface.

Diagnostics

  • Press D on an MDL16 object: Dumps raw 01 32 10 signatures to the console (F12) compared against actually accepted frames, detailing position, slot sizes, opacity, and shadow/duplicate flags. Designed to debug problematic assets.

Installation

There is no installation or build process. It is a set of static files (HTML + CSS + vanilla JS) that run locally.

  1. Download or clone the repository.

  2. Open index.html in a modern browser (Chrome / Edge / Firefox).

  3. Use the load button to select your Lionheart Data folder (the one containing Textures, Models, Environments, etc.).

    • Terrain Mode displays Textures assets.

    • Objects Mode displays Models / Environments assets.

Note: Folder loading uses the browser API (webkitdirectory), available in recent Chrome/Edge and Firefox versions. All processing is local; nothing is uploaded to any server.

Optional: To serve it from a local server (e.g., if your browser restricts file://)

Bash
 
# Python python -m http.server 8000 # then open http://localhost:8000 

Project Structure

Previously a single HTML file of ~3,000 lines, it is now modularized into folders by section to facilitate maintenance:

Directory/File Description index.html Skeleton + script loading in order estilos/ CSS stylesheets nucleo/ State management, i18n (ES/EN), constants carga/ Cache folder loading + file tree decodificador/ FRM16 logic, image cache, Python spec of the decoder objetos/ MDL16 logic: layers, shift, shadows, render loop terreno/ Splatmaps and brushes interfaz/ Minimap, mouse controls, drag-drop, layer panel, modes, modals, viewer, keyboard inputs, init mapa/ Undo stack, new/save/open logic, import .zax, export PNG herramientas/ MDL16 tools, save to disk, shift adjuster, extractor/converter, recolor, sizing What's New in This Version (v12)

This version resolves shadow rendering defects that primarily affected objects with heavy silhouettes (trees/pines), verified against real files.

Fixed

  • Shadows with black lines / rippling (decodeSilhouette) The silhouette alpha channel (slot 3) was mistakenly consuming 1 byte per pixel even during RUN-type RLE stretches. The correct rule is 1 byte of alpha per operation, shared by all pixels in the RUN. This misalignment caused dark pixels to read unrelated high alphas, leading to opaque black streaks and rippling. Validated row-by-row against actual Pine3_A.mdl16 tables: 363/363 rows correct, including the 79 discriminant rows where RUN>1.

  • Black specks from residual shadow frames: Shadow frames now honor their actual alpha. In Pine3_A, the residual frame (39 px, alpha ≤ 8) is now imperceptible instead of painting as opaque black dots.

  • Shadow linked to object: The shadow is now composited onto the same canvas as the object (baked as translucent black, exact equivalent to the Blend_Black_Bias multiply for grays), meaning the object and its shadow move together on the map, viewer, and PNG export.

  • False geometry frames (_tableOK) A 01 32 10 signature could randomly appear within RLE data. The engine now requires the row table to be monotonic and its offsets to fit within the layer; pseudo-frames are discarded, eliminating distorted lines.

  • Stacked animation variants: Animated models (swaying trees) come with multiple nearly identical frames. Stacking them used to superimpose N shifted shadows. Now, only one is painted per group (structural criteria: same size and position ±2 px); the rest remain accessible as layers.

  • Main frame selection: A large shadow frame used to sometimes have more pixels than the actual object, "stealing" the bounding box/anchor. Non-shadow frames now take priority when selecting the main image.

Design Principles

  • Generic, no special cases: All logic is structural and works with any MDL16/FRM16; there are no filename-based configurations.

  • Format fidelity: Blending and alpha consumption rules are derived from engine decompiles (Ghidra), not visual approximations.

  • Self-contained: Static files only; no dependencies or build tools needed.

  • Version indicator: A visible stamp in the UI corner helps discard cached copies or older builds at a glance.

Credits and License

  • FRM16 Specification: Based on reverse engineering of the format (Edheldil's RLE scheme as a starting point) and engine decompiles.

  • Lionheart: Legacy of the Crusader is the property of its respective owners. This tool does not distribute game assets; it only reads them from your local copy. Add the license you decide for the editor code here (e.g., MIT).

    https://github.com/A...G---Map-Editor-


Edited by AlleyV, 05 July 2026 - 01:25 AM.


#4 Relican

Relican
  • Member
  • 2 posts

Posted 05 August 2026 - 03:08 AM

fv2LKxR.jpeg

looks nice



#5 AlleyV

AlleyV
  • Member
  • 5 posts

Posted 17 August 2026 - 05:15 AM

 

looks nice

That image is from the first version; it looks even better now.
 



#6 Relican

Relican
  • Member
  • 2 posts

Posted 25 August 2026 - 03:17 AM

have u tried to implement the map into the game or are these only images?



#7 AlleyV

AlleyV
  • Member
  • 5 posts

Posted 28 August 2026 - 01:39 PM

have u tried to implement the map into the game or are these only images?


Yes, and it looks perfect, maybe a little bigger than the original Infinity size, but the terrain editor has a resizing tool.

waHrRGb.png

lNY2Fvt.png
cZIZW17.png
0t4Lvge.png


Edited by AlleyV, 28 August 2026 - 01:41 PM.






Also tagged with one or more of these keywords: Lionheart, terrain editor