build engine: docs/guide sections (ART tiles, Build maps) with inputs from tools/fixtures/docs_build.py, bench lines, type fixes; bundles rebuilt
This commit is contained in:
1 parent
aacc78fac2
commit
082ea2019e
10 files changed
+3575
-1085
No files matched your search
+19
-1
@@ -1,7 +1,7 @@
|
||||
# Images
|
||||
|
||||
Every image format (PNG / APNG, JPEG, WebP, GIF, BMP, TGA, QOI, TIFF, ICO / CUR, PNM / PAM / PFM, Radiance HDR,
|
||||
OpenEXR, the [game textures](#game-textures) DDS / KTX / VTF / BLP / TIM, and the [older formats](#formats) PCX, SGI,
|
||||
OpenEXR, the [game textures](#game-textures) DDS / KTX / VTF / BLP / TIM / ART, and the [older formats](#formats) PCX, SGI,
|
||||
Sun Raster, ILBM, XPM, XBM, ICNS, ANI) loads as one `Image`: a width, a height, a pixel format and one tightly packed `buffer`. Animations (GIF, APNG, animated
|
||||
WebP) and multi-image files (TIFF pages, ICO entries) add a list of `Frame`s. Editing goes through `F.ops.image`.
|
||||
|
||||
@@ -214,6 +214,23 @@ local small = assert(F.image.load(vtfBytes, { mip = 1 })) -- or face = n (cub
|
||||
assert(F.detect(tim) == "tim")
|
||||
```
|
||||
|
||||
Build engine ART files (`TILES000.ART` ..., Duke Nukem 3D, Shadow Warrior) hold many tiles: each is one entry of
|
||||
`frames` (in tile order, empty tiles 0 x 0), with its tile number in `meta.tile` and its picanm animation and centre
|
||||
offsets in `meta.picanm`; the top-level image is the first non-empty tile. Colours come from the game's
|
||||
`PALETTE.DAT`, passed as `palette` or found next to the file through `resolve` (without it the tiles decode as a grey
|
||||
ramp). Index 255 is transparent. `shade` / `pal` apply a PALETTE.DAT shade table / a LOOKUP.DAT palookup, `native`
|
||||
keeps the palette indices (gray8), and ART writes back from either form:
|
||||
|
||||
```luau
|
||||
local tiles = assert(F.image.load(artBytes, { palette = paletteBytes }))
|
||||
local second = tiles.frames[2].image
|
||||
assert(second.meta.tile == 1 and second.width == 8)
|
||||
assert(second.meta.picanm.type == "forward" and second.meta.picanm.frames == 2)
|
||||
local raw = assert(F.image.load(artBytes, { format = "art", native = true }))
|
||||
assert(raw.frames[1].image.format == "gray8")
|
||||
assert(buffer.tostring(assert(F.save(raw, nil, { format = "art" }))) == buffer.tostring(artBytes))
|
||||
```
|
||||
|
||||
Doom's graphics come from WAD lumps rather than files: `F.format("wad").image(wad, name)` (see
|
||||
[archive.md](archive.md#game-archives)).
|
||||
|
||||
@@ -233,6 +250,7 @@ Read and write unless noted; see [FORMATS.md](../FORMATS.md) for depths and deta
|
||||
| TIM | | yes | PlayStation; 4 / 8-bit CLUT, 15 / 24-bit |
|
||||
| BLP | | yes | Blizzard BLP1 / BLP2 (DXT through the BCn codec); writes BLP2 BGRA |
|
||||
| VTF | frames | yes | Valve; read only; mips / faces / slices by option |
|
||||
| ART | tiles as frames | index 255 | Build engine tiles; palette from PALETTE.DAT (`palette` / `resolve`), picanm in `meta.picanm` |
|
||||
| DDS, KTX / KTX2 | faces / layers / slices | yes | GPU textures: BC1..BC7, ETC / EAC, every uncompressed layout; mips in `meta.mipmaps` |
|
||||
| OpenEXR | parts (`opts.part`) | yes | half / float / uint, NONE / RLE / ZIPS / ZIP / PIZ, tiles; writes NONE / ZIPS / ZIP |
|
||||
| PCX, SGI, Sun Raster, IFF ILBM / PBM, XPM, XBM | | yes (XBM 1-bit) | old paint / workstation formats; ILBM reads HAM and EHB |
|
||||
|
||||
@@ -507,6 +507,29 @@ local again = assert(F.save(barney, nil, { format = "smd" })) -- SMD writes ba
|
||||
assert(F.model.load(again).skins[1])
|
||||
```
|
||||
|
||||
## Build engine maps
|
||||
|
||||
Duke Nukem 3D / Shadow Warrior `.map` files (versions 7-9; the text Quake `.map` is a different format, told apart by
|
||||
content) load as one mesh: floors and ceilings triangulated with their slopes, walls with upper and lower parts at red
|
||||
walls (and masked walls), a primitive per surface kind and tile (`extras.build = { kind, tile }`); materials and
|
||||
textures are named `tile<n>`. Sprites become nodes under the map with their tile in `extras.build.tile` (the raw
|
||||
sprite in `extras.build.sprite`), and the player start is the node `start`. Coordinates turn z up (Build's y and z
|
||||
point down), z is divided by 16 so all axes share Build's xy unit, and `scale` multiplies everything. `tiles` (tile
|
||||
number to Image, e.g. from an ART file) gives the texture sizes for the UVs and attaches the images.
|
||||
|
||||
The raw sector, wall and sprite tables stay in `meta.build`, and saving writes them back:
|
||||
|
||||
```luau
|
||||
local map = assert(F.model.load(buildmapBytes, { scale = 1 / 512 }))
|
||||
local level = map.meta.build
|
||||
assert(level.version == 7 and #level.sectors == 3)
|
||||
assert(map.nodes[2].name == "start" and map.nodes[3].extras.build.tile == level.sprites[1].picnum)
|
||||
local again = assert(F.save(map, nil, { format = "buildmap" }))
|
||||
assert(buffer.tostring(again) == buffer.tostring(buildmapBytes))
|
||||
local Build = F.format("buildmap") -- the floor height under a point, slopes included
|
||||
assert(Build.slopeZ(level, 0, true, 100, 100) == level.sectors[1].floorz)
|
||||
```
|
||||
|
||||
## Blitz3D (B3D)
|
||||
|
||||
`.b3d` files (Blitz3D, also written by many old game tools) load read-only. The node tree keeps its names and TRS;
|
||||
@@ -745,6 +768,7 @@ assert(back.meshes[1].primitives[1].indices.count == 3)
|
||||
| X3D (XML / classic) | yes | yes | the VRML reader plus the X3D triangle / quad / line sets; no binary `.x3db` |
|
||||
| STEP | via the CAD plug-in | | see [cad.md](cad.md) |
|
||||
| MD2, MD3, MDL, MD5, BSP | yes | - | game models and maps: see "Game models" above |
|
||||
| Build engine MAP (v7-9) | yes | yes | sloped sectors, walls, sprites as nodes, raw tables in `meta.build`; see "Build engine maps" above |
|
||||
| SMD | yes | yes | Valve studiomdl data |
|
||||
| Roblox `.mesh` (robloxmesh) | yes | yes | see [roblox.md](roblox.md) |
|
||||
| Roblox `.rbxm` / `.rbxl`, `.rbxmx` / `.rbxlx` | as an `RbxTree` | yes | instance trees with typed properties: see [roblox.md](roblox.md) |
|
||||
|
||||
Reference in new issue
Block a user