OpenTPW

Content kit: authoring new objects#

The content kit turns original, newly made art into files the game reads: MD2 models, textures, ride scripts and sprite banks, packed as an object a data-only mod adds through objects.json (MODS.md). It exists for community content, and it builds the shipped swimming pools (POOLS.md), the umbrellas' content (UMBRELLAS.md) and the winter shops and warm items (WINTER.md). Nothing in it reads or copies art from the original game; the original corpus is only used to prove that each writer produces files the readers (and the formats) accept.

Status (October 17, 2026): phase 0 is complete in the code. In place:

Not done: nothing has been run in the original game or in the renderer (see "What is unverified").

Blender scene --opentpw_export.py--> pool.glb --opentpw-kit object--> archive folder --opentpw-kit mod--> mod folder
                                                (pool.MD2, textures/*.tga, Pool.sam, Pool.RSE)        (opentpw-mod.json, objects.json)

Blender conventions#

tools/blender/opentpw_conventions.py holds the rules, and the exporter checks them before it writes anything:

Export a scene (or one collection) with:

/Applications/Blender.app/Contents/MacOS/Blender -b scene.blend --python tools/blender/opentpw_export.py -- --out object.glb --collection Pool

tools/blender/opentpw_sample_pool.py builds the kit's sample from code: a 3 × 3 cell pool (four rim boxes and a self-lit water box with generated checker textures) standing on the Blender X/Y range 0..30, with six head points just above the water, and exports it:

/Applications/Blender.app/Contents/MacOS/Blender -b --factory-startup --python tools/blender/opentpw_sample_pool.py -- --out pool.glb

glTF reader#

GltfScene.Read reads binary glTF 2.0 (.glb) with one embedded buffer:

It refuses rather than ignores anything it cannot carry into an MD2 object: skins, animations, morph targets, sparse accessors, external buffers or images, required extensions, non-triangle primitives, shared or cyclic children, and indices outside the vertices. Animation is out of scope for now.

Converter conventions#

GltfModelConverter.Convert( GltfScene ) returns a ModelBuilder and the images the model names. Two conventions are not a matter of taste, because the original data fixes them. Both were determined from the original models and OpenTPW's renderer, which draws the originals correctly; neither was compared against a screenshot of tp.exe.

(a) Texture V: stored bottom-up, so V = 1 - v#

glTF's V is 0 at the top row of the image. MD2's V is 1 at the top row. Evidence:

(b) Handedness: MD2 is left-handed, a glTF model must be mirrored#

OpenTPW's renderer shows the originals correctly, and its chain is: MD2 (x, y, z) (Y up) → ObjectAssets.ConvertAxes swaps Y and Z → engine (x, z, y) with Z up, drawn by a right-handed camera (Matrix4x4.CreateLookTo, CreatePerspectiveFieldOfView) with FrontFace.Clockwise and back faces culled. Evidence that this means MD2 is a left-handed Y-up system (Direct3D's):

The conversion is therefore the mirror (x, y, z) → (x, y, −z) of the glTF frame:

glTF (right-handed, Y up)MD2
position, normal(x, y, z)(x, y, −z)
triangle(a, b, c) counter-clockwise from the front(a, c, b): the stored face normal cross(p1 − p0, p2 − p0) points outward
node matrix (row vectors)MR M R with R = diag(1, 1, −1): M13, M23, M31, M32, M34, M43 change sign
texture Vv1 − v
from Blender(x, y, z)(x, z, y)

GltfModelConverterTests pin the mapping with a hand-built quad: after ModelBuilder, the file writer, ObjectAssets.ConvertMesh and the node composition of OriginalObject (ObjectPlacement.SwapAxes), the quad seen from its glTF front side has U to the right and the image's top row up, for a plain quad, a rotated and translated one, and one under a rotated parent. Negating Z (rather than X) keeps X right and Y up and turns the front to MD2's −Z side; the footprint reading above (Blender's top view equals the shape text, because the engine frame equals Blender's) follows from the same equation, since the engine frame is Blender's frame.

What is converted#

Lights#

A KHR_lights_punctual light of type point on a node with opentpw_light → AddLight( number, colour, radius ) on that node's dummy ([EXT:object-lights], LIGHTS.md): the light's color is the base colour (clamped to 0..1 with a warning), its range the radius in model units (a scene unit is one model unit; rounded, 1 to 65535; no range means the engine's default of 100), the node extra opentpw_light = n the light number (required: a point light without it is skipped with a warning, because exporters write every light of a scene) and opentpw_light_radius = r a radius that beats the range. The glTF intensity is not carried (candela or lux, its unit differs between exporters; one warning per file when it is not 1): scale the colour, and a script's SETLIGHT dims the base colour at run time. Spot and directional lights are skipped with a warning. KHR_lights_punctual may be listed as a required extension (any other required extension is still refused). A node that is a rider head cannot also be a light, and numbers must be unique.

Textures and TGA#

object converts every texture the model names from the glTF's PNG or JPEG to textures/<name>.tga with TgaWriter: image type 2 (uncompressed true colour), 24 bits per pixel, or 32 bits with 8 alpha bits when any pixel is translucent, bottom-left origin (descriptor 0x00 / 0x08, rows stored bottom to top), BGR(A), no image ID, followed by the 26-byte TGA 2.0 footer with no extension area.

Why this variant. The 160 .tga files of the shipped game (loose and inside WADs) are 156 uncompressed true-colour files with a bottom-left origin and a 26-byte footer (24-bit, descriptor 0x00; or 32-bit, descriptor 0x08), 3 of the same type with a 495-byte extension area, and 1 paletted file (a cursor). None is RLE-compressed or has the top-left bit. TgaWriterTests decodes all 155 of the first kind that are not opaque 32-bit, writes them again with TgaWriter and gets the original byte for byte (155 of 155). tp.exe loads .wct and .tga through one loader (0x46EAD0 appends .wct and then .tga and calls 0x46F120, which reaches a codec factory at 0x5C4D50); that factory's TGA reader was not traced, so which other variants it takes is unknown. The engine reads TGA rows in file order (World/Sky.cs: the sky files are bottom-up and addressed as stored), so the kit writes exactly what the game's own files are, rather than a top-left file stb would also read.

Textures are not resampled. Every shipped model texture is a power of two (and at most 256 × 256 for objects); a texture that is not draws a warning, one above 4096 pixels is refused.

The command line#

opentpw-kit (source/OpenTPW.ContentKit, in OpenTPW.sln):

dotnet run --project source/OpenTPW.ContentKit -- <command> ...

object: a glb into an object archive folder.

opentpw-kit object --glb pool.glb --name pool --out mymod/objects/pool [--sam <file|template>] [--script <text .rse>] [--display-name "Pool"] [--force]

Writes pool.MD2, textures/*.tga, Pool.sam and an assembled Pool.RSE into the folder: the layout of an original archive such as the jungle sideshow puzzle.wad (puzzle.MD2, Puzzle.sam, Puzzle.RSE, textures/; its qickload.txt and .hmp are optional and not written; the catalog needs neither). The archive name is 1 to 16 letters, digits or underscores (the main model is <name>.MD2). Nothing is written when the conversion, the settings or the script fail, and existing files are only replaced with --force. --sam is a .sam file (it needs an Info.Id) or template. --script is an RSE text source (RSE-SCRIPTS.md); without it the built-in pool script is assembled. A script that runs ADDHEAD on a model without head records draws a warning.

mod: a mod folder.

opentpw-kit mod --out mymod --id community.pool --name "Pool" [--version 1.0.0] [--author Ann] [--description "..."] \
  --id-first 20000 --id-last 20099 \
  --object "archive=objects/pool,theme=jungle,category=rides,id=20001,name=Pool,name.German=Becken,src=mymod/objects/pool"
# or with your own documents (checked, and content.objects is set to objects.json):
opentpw-kit mod --out mymod --manifest manifest.json --objects objects.json

Writes opentpw-mod.json and objects.json (MODS.md) and, for an object spec with src=, a copy of that built folder at archive in the mod. --overrides data/ sets the manifest's content.overrides (the folder of replacement game files, which sprites --mod fills); a mod may have objects, overrides or both, and no objects.json is written without objects. The documents are checked with the game's rules before the folder exists: id and version shapes, the Info.Id range (5000 to 65535, at most 4096 ids), ids inside it and unique, themes, categories, archive paths that stay in the folder, names. The game's own strict loaders remain the authority; the tests load the output with them.

sprites: complete sprite sets, packed from a folder of frames and a set.json.

opentpw-kit sprites --frames art/SPR_BE --mod mymod --folder Generic/Kids          # into the mod's overrides tree
opentpw-kit sprites --frames art/SPR_BE --frames art/SPR_CH --out /tmp/sprites     # or flat into a folder

A set folder holds slot<NN>_d<direction>_f<frame>.png (RGBA; NN is the animation slot 0 to 15, directions and frames count from 0) and set.json:

{ "name": "SPR_BE", "detailFlag": 1, "kidFlag": 0,
  "slots": { "0": { "directions": 5, "framesPerDirection": 1 }, "1": { "directions": 5, "framesPerDirection": 8 } },
  "defaultOrigin": { "originX": -24, "originY": -52 },
  "frames": { "slot01_d0_f0": { "originX": -25, "originY": -53 } },
  "performances": [ { "program": 0, "slot": 4, "intro": 0, "hold": 0 } ] }

pixelsPerUnit (default 128, 1 to 65535) is written to both pixels-per-unit words of every frame; a set drawn at twice the pixel size has 256 (see "Resolution" under Guest sprite sets). name is the set's stem (1 to 7 letters, digits or underscores, such as SPR_BE; --name may supply it when the file does not). detailFlag is ESP byte 0x10C: 1 writes .FPC and .TPC with the same content, as every shipped full-detail set ships both, 0 only the .TPC, as the head sets do (default 1); kidFlag is byte 0x10D (default 0). slots lists every slot the set has, with its directions (the shipped kid sets have 5, the head sets 7; 0 means a slot without directions, as in the balloons and thoughts, whose files are d0 only) and frames per direction; slots keep their numbers and frames are stored slot by slot, direction-major, as the shipped sets are. originX/originY are the offset of the frame's top-left corner from the hotspot (SpriteFrame.OriginX/OriginY; negative when the hotspot lies inside the frame), per frame under frames (the key is the file name without .png) with defaultOrigin for the rest. performances are the entertainer entries (SpriteSetBuilder.SetPerformance). Head sets (Kidsheads, 7 elevation rows) use the same format with one slot. The whole set shares one 255-entry palette (exact up to 255 colours, median cut beyond), as SpriteSetBuilder does (GUESTS.md). Every missing or surplus frame, an undeclared slot, a frame without an origin and every unknown field is an error that names the file; an unrelated .png is ignored with a warning.

With --mod <dir> --folder <F> the files go to <dir>/<overrides>/esprites/<F>/ (--overrides, default data): with the mod's content.overrides ("data/", set by mod --overrides data/) the game then reads them in place of the game's own at the data path /esprites/<F>/<NAME>.ESP and so on (MODS.md). GuestSpriteAtlas reads /esprites/Generic/Kids, Generic/Kidsheads, <Theme>/Costumes, <Theme>/Costumeheads, Generic/Balloons and Generic/Thoughts; the folders of esprites.wad are Generic/{Kids, Kidsheads, Balloons, Thoughts, Mechanics, Handymen, Guards, Researchers, Litter, Particles, SpecialFX}, {Jungle, Hallow, Space, Fantasy}/{Costumes, Entertainers} and {Jungle, Space}/Costumeheads; --folder takes any of them in any case and writes the casing of the archive (another folder is allowed with a warning). The command warns when the mod's manifest does not name the overrides folder. A set that replaces a shipped one needs the same file names; sets that the game does not already list in the folder (new names) are not found by the loaders, which list the game's own directory.

The built-in settings and script#

object --sam template writes a sideshow-like attraction modelled on the keys of the original Puzzle.sam: Info.Id (a placeholder; objects.json replaces it), Info.Name, a 3 × 3 Info.Shape with the entrance 2 in the middle of the last text row, Info.Hoarding, Info.RideTypeStringIndex 22 (as the puzzle), UsageInfo.InitPricePerUse 15, InitCostOfGoods 0, InitChanceOfLoosing 0, the stand and appear positions, ExcitementLevel 35, MinCapacity 1, MaxCapacity 6, RideHandlesSprite 1 (riders are drawn as heads on the head records), Upgrades[0].CostOfUpgrade 1500, CostOfResearch 0 (an object without research cost starts researched, ECONOMY.md), InitCapacity 6 and Research.Group 0. The values are the kit's choices; the category defaults (SideShow.sam, ...) of the game data are layered under them by the catalog.

The built-in script is a placeholder: guests enter, wait and leave, nothing is animated and there are no effects. It is the shape of the original rides that hang heads on a model (for example Bugs TV): wait while the ride is closed; a fill loop with SETTIMER/GETTIMER 10000 that takes each called guest (TEST VAR_LETMEON, HUSH, ADDHEAD, COPY VAR_LETMEON 0, ADD VAR_ONRIDE 1) until the capacity is used or ten seconds pass without a new guest; WAIT 8000 with VAR_RUNNING set; then an unload loop (HOP VAR_LETMEOFF, DELHEAD, wait until the host has taken the guest, ADD VAR_ONRIDE -1, WAIT 300). It declares the twelve standard variables first and VAR_SPACELEFT after them. .stack 20: the header's stack size is also the size of the HUSH/HOP heap that holds the riders' ids (docs/RSE-VM.md); with .stack 0 the HUSH does nothing, HOP pops 0, and the guest is never released. Real swimming comes later, in an extension.

End to end#

ContentKitTests run the whole flow without a GPU and without running the game:

  1. A pool comes from the Blender sample script when Blender is installed (OPENTPW_BLENDER, else /Applications/Blender.app), and always from a hand-built glb of the same shape.

  2. opentpw-kit object and opentpw-kit mod (through ContentKitCli.Run) build a mod folder.

  3. The game's own mod pipeline loads it: ModDiscovery, ModSet.Resolve, ModContentRoots.Use, ObjectCatalog (the object is listed with its objects.json id, name, the template's 3 × 3 shape and its script), ObjectAssets.LoadModel, ConvertMesh (nothing unrenderable), ResolveTexture for every material (the .tga in textures/, decoding to the exported image's pixels exactly), the self-lit and wrap flags, the six head records found by RideHeadSpace, and the assembled script running in RideVM without a fault.

  4. A guest goes through it without game data: the real RideVisitorBridge, GuestSimulation and head space with the built model and script (the rig of the queue tests). The guest queues, boards, a head is hung on a head record, the guest swims for about eight seconds, the head comes down and the ride is counted.

  5. With OPENTPW_GAME_PATH, the M3 gate (M3Gate.Run, a real Jungle level with entrance, paths, queue, shop, toilet and staff, three simulated minutes) takes the built pool as its attraction: it is bought for 1500, built on its 3 × 3 footprint, registered with the guests and queued, its script cycles (6 cycles) and guests board it (42 boardings in the run). The gate only places rides, so this test files the object under rides.

What is missing: a placement as an OriginalObject entity (it builds renderer entities and needs a GPU context, so the real draw of the converted model, its texture orientation and its mirror state in the game are not checked); and a sideshow-category object has no headless park test (the gate places rides only, and a sideshow guest needs the live sideshow terms the runtime derives).

An example with a light: the lamp post#

tools/lights/build-example-mod.sh builds the example mod content/mods/opentpw.example.lamp-lights (python3 and the .NET SDK, no Blender): make_example_lamp.py writes a glTF lamp with a point light node, opentpw-kit object converts it with tools/lights/lamp.sam (which tunes the light with the Lights[n] keys) and tools/lights/lamp.rse (a script that uses the four light opcodes), and the mod's two documents are written by the script (the kit's mod command writes community mods only, and this one is official). See LIGHTS.md.

Content shipped with the game: pools#

The official opentpw.pools extension ships its changing rooms and swim sprites as committed generated files in content/pools (our own art, nothing from the original game). tools/pools/build-content.sh regenerates them (Blender 5.x, the .NET SDK, python3; about 30 minutes, nearly all of it the sprite renders; the kid sets keep only slots 0, 1 and 14, the ones the land renderers draw; env KIT_ARTIFACTS, WORK, FORCE_SPRITES): the cabin model comes from tools/blender/opentpw_changing_room.py through GltfModelConverter and opentpw-kit object with tools/pools/cabin.sam and cabin.rse, the guests from opentpw_guest_sprites.py --scale 2 --part pool (the swimwear sets, content/pools/esprites/Swim) and --part land,heads (the clothes sets and heads that replace the game's while the extension is on, esprites/Generic/Kids and Kidsheads), packed by tools/pools/pack_sprite_sets.py through opentpw-kit sprites. All of it is drawn at 2x (8.25 MB of sprites). The pool extras (ladder, diving board, shower, lounger, lamp, underwater light) are built the same way from tools/blender/opentpw_pool_extras.py with tools/pools/extra-*.sam and extra.rse (step 2b). See POOLS.md and Extras.

What is unverified#

Tests#

Swimmer sprites#

Guests are pre-rendered 2D sprites, not models (GUESTS.md), so a swimming pool needs swimmer sprites that look like the original guests. tools/blender/opentpw_kid.py is a parametric low-poly person; tools/blender/opentpw_swim_sprites.py poses it, renders the frames in sprite size and writes the PNGs. Both are original art made from code (nothing is read from or derived from the game's files; the originals were only looked at to match proportions and picked colours). Run Blender 5.x headless:

B=/Applications/Blender.app/Contents/MacOS/Blender
$B -b --factory-startup --python tools/blender/opentpw_swim_sprites.py -- --out /tmp/swimart --edition TPW
$B -b --factory-startup --python tools/blender/opentpw_swim_sprites.py -- --out /tmp/swimart --edition TPI --binary-alpha

Rendered images are not committed; regenerate them with the commands above (about three minutes per edition).

Rig and presets#

The rig is a stack of pivots (root > lay (stand to lie) > roll > upper (stoop) and legs; head neck (yaw) > nod (pitch); shoulders and hips each an abduction pivot and a swing pivot; elbows, knees, ankles). The kid looks along +Y, the rig origin is the middle of the torso, and apply_pose(kid, pose) sets every pivot from a dict of angles. Limbs are single smooth capsules (a UV sphere whose halves are pulled apart, shallow end caps and analytic normals) with a ball at each joint, so there are no stacked cones and no rings. Proportions are in BODIES (kid: head about 40 % of the height, short limbs, big feet; mum, dad, granny, grandpa: taller, longer limbs, smaller head, the grandpa stooped). One preset per original sprite set picks skin, hair, outfit colour, eyes and a hair style (spiky, pigtails with bobbles, bob, curly, swim cap, short, bun, perm, balding):

EditionSets
TPW kidsBE, BI, CH, FR, KI, SA, SU, TA
TPI kidsBD, GB, GK, KB
TPI adultsFA (dad), MO (mum), GM (granny), GR (grandpa)

Swimwear is the set's main outfit colour: trunks for boys and men (a girl's or woman's swimsuit covers the torso). Hats and the dad's camera are left out; GK and KB wear swim caps in their cap colours (KB's is taller, with brown hair showing at the fringe and the nape).

Surface look (late-90s pre-render, not plastic): every material is purely diffuse (specular 0.04, roughness 0.9; only the eyes are glossy) over a procedural painted albedo: hair has strand bands times clumpy noise, the swimwear distorted fold bands, skin dabs of slightly different value, all with a slow warm/cool hue wander; hands, feet, ears and nose are rosier, plus cheek blush, darker eyebrows and lips. All textures of a figure share one texture space (the roll pivot), so neighbouring body parts agree where they meet (separate per-object spaces showed as rings on the limbs). Ambient occlusion darkens creases, and the grade adds warm shadows. Characters: FA has a round belly, a moustache and stubble; MO a bun and red lipstick; GM a grey curly perm and round glasses; GR white sideburns, a bald top, a white moustache and a slight stoop (standing pose only; swimmers lie flat).

Camera and lighting (calibrated against the original standing frames)#

Orthographic camera, render 6 times larger and box-filter down (premultiplied), a mild unsharp mask (0.2) to keep the pixel crispness of the originals, a grade (contrast 1.2 about 0.45, saturation 1.0, warm shadow tint), then darken the silhouette's outermost pixels by a factor 0.7 (the originals have dark edges). Three suns are parented to the camera, all without shadow maps (they banded the thin limbs): a warm key from above and the upper left (energy 6.0), a cool fill from the right (0.5) and a rim from behind and above (2.0, it only catches edges), plus a world ambient of 0.34. Judged on the palette-quantised frames (below), the per-region pixel statistics of the standing frames against the originals (direction

  1. are: luminance spread 45-80 vs 40-70, 90th percentile 130-250 vs 130-220, local contrast (mean absolute difference of neighbouring pixels inside the figure) 19-33 horizontally vs 19-37 in the originals, saturation 0.2-0.8 vs 0.4-0.6. Our vertical local contrast is about 20 % higher; mean colours differ because ours wear swimwear and the originals clothes (these statistics are from the earlier 27 degree camera).

Directions 0 to 4 put the camera at azimuth -45 * direction (0 looks at the kid's back, 2 sees it facing screen right, 4 facing the camera); the game mirrors the rest.

ConstantTPWTPI
Camera elevation45 degrees, measured (it was 27, set by eye against the FPC)25 degrees, set by eye against the FPC (not measured)
Pixels per unit11.1, measured (it was 11.7)14.4
Calibration reference cell / standing hotspot48 x 56, feet at (24, 53)64 x 80, feet at (32, 70)
Swim frame canvas / hotspot80 x 60, (40, 34)100 x 80, (50, 45)

The guest sets ship their art twice: the .TPC bank the game draws and, for the sets with ESP byte 0x10C, an .FPC bank of the same art seen from a lower camera, which the game never opens (GUESTS.md). The FPC frames are about as wide and taller (a kid stands 40 to 42 px tall in the FPC, 32 to 37 in the TPC). tools/blender/opentpw_kid_elevation.py measures the camera: it renders the standing kid of every set over a sweep of elevations and scales and scores each by the mean intersection over union of our five silhouettes with the original's, placed by their hotspots (the originals come from a local export, never committed). Against the TPC the score peaks at 44 to 48 degrees and pixels per unit 11.0 to 11.2 (IoU 0.77); against the FPC at 15 degrees or lower and 11.7, so the two banks differ in camera, not in scale. The TPW constants were 27 degrees and 11.7 (with a "TPC scale" of 11.7 / 1.25 = 9.36 for the comparison), calibrated by eye against the FPC on the reading that the game draws it; our guests looked filmed from the side next to the originals.

Standing frames at 45 degrees and 11.1 pixels per unit (opentpw_kid_elevation.py at its best), height x width per direction (0 to 4), ours / the original TPC:

TPWd0d1d2d3d4
BE32x28 / 37x2634x21 / 36x2135x17 / 34x2135x21 / 34x2134x28 / 32x26
BI32x28 / 37x2634x21 / 36x2235x17 / 34x2136x21 / 34x2135x28 / 32x26
CH31x28 / 33x2736x21 / 36x2139x18 / 40x1637x21 / 39x2133x28 / 34x25
FR32x28 / 36x2634x21 / 36x2135x17 / 34x1835x21 / 33x2134x28 / 31x26
KI31x28 / 33x2736x21 / 37x2239x18 / 40x1637x21 / 39x2133x28 / 34x27
SA31x28 / 33x2533x21 / 34x1933x18 / 34x1834x21 / 33x2033x28 / 30x25
SU31x28 / 33x2736x21 / 37x2239x17 / 40x1637x21 / 39x2133x28 / 34x27
TA31x28 / 32x2533x21 / 33x2035x18 / 34x1735x21 / 34x2034x28 / 32x26

Heights are within 3 pixels except the back view (direction 0, 1 to 5 short); ours are 1 to 3 pixels wider from the front and back, and from the side up to 4 narrower (BE, BI) or 2 wider (CH, KI). The heads keep their own scale (HEAD_PPU, 11.7 for TPW): rendered at the bodies' 11.1 they come out 6 % smaller than the original head sets, which they matched at 11.7. tools/blender/opentpw_kid_calibrate.py still renders the standing kid in the original's cell for every set and, given a reference sheet of the original standing frames (viewed locally only), writes a side-by-side comparison (original left, ours right). The TPI standing heights below (direction 4, in pixels, ours and the original's) are from the earlier calibration, at the old camera:

TPIBDGBGKKBFAMOGMGR
ours3939374050484137
original4041384350484238

All within 4 pixels for TPI (the TPI kids come out a little short), most within 2. The proportions follow the originals more closely since October 17, 2026:

Slots, directions and frame names#

SlotAnimationFrames per direction
Afront crawl (face down, alternating arm circles, flutter kick, head turns to breathe, body roll)8
Bbreaststroke (glide, out-sweep, pull, hands to chest, frog kick)8
Ctreading water / idle (upright, sculling arms, bicycling legs under water)4

Five directions as in the kid sprites (0 swims away from the camera, 2 faces screen right, 4 faces the camera, 1 and 3 are the diagonals; 5 to 7 are mirrored by the game). The sprite index of a frame is direction * frames + frame. Files: <out>/<edition>/<SET>/<slot>_d<direction>_f<frame>.png, RGBA.

Water line and hotspot#

The water surface is the plane z = 0. Every material tints what is below it (multiply by a blue, mix 34 % water blue) and renders it at 74 % opacity, so the part of the sprite under the water takes on the pool's colour (a light blue tint, so submerged legs still read as a shape). Swimmers have wet hair (swim=True): darker (x0.72), caps and curls closer to the head, spikes cut to stubs, pigtails hanging, buns smaller; the standing calibration keeps the dry hair. The swimmer's body is raised so the back and shoulders are above the surface, and the limbs are lengthened by a cartoon factor (arms 1.3, legs 1.12, swim=True in build_kid) with exaggerated strokes so arms leaving the water and kicks read at 1x. A light foam ring (an inner and an outer, fainter ring) lies on the surface around the torso, and droplets (seven per hand or foot) are placed on the frames where it crosses the surface or moves fast near it. In the crawl the head turns to the side of the recovering arm and the body rolls that shoulder up (roll 44 degrees, recovery arm arc up to 76 degrees out). --verify checks this on every set (roll and head turn on all 8 crawl frames) and renders arm/shoulder masks from directions 0 and 1 to count visible arm pixels: at 1x the arms are visible (6 px or more above the water) in 8 of 8 frames for every set in both directions, except SA (6 of 8; her hair hides part of the near arm).

The frames of a set are quantised to one shared 255-colour palette (weighted median cut over RGBA, the same family as SpriteSetBuilder; the palette is not byte-identical to its result) before they are written, and the sheets and GIFs show the quantised frames; the unquantised frames are in <SET>/truecolor/. An ordered dither (--dither 0.05) adds a faint grain in the flat regions, a little closer to the originals' grain; the difference is small, so it is off by default. --binary-alpha makes every pixel fully opaque or fully transparent (alpha threshold 0.4) for palette sprite sets, which cannot hold partial transparency; the water tint stays, and the foam ring becomes opaque.

The hotspot (sprite origin) of every swim frame is the swim_origin pixel: the centre of the torso at the water line, so placing the sprite at a guest's position puts the body on the surface there. The frames are not trimmed. Packing them into ESP/TPC banks goes through the sprite-set writer, which is separate from this generator.

tools/blender/opentpw_swim_compare.py builds a before/after sheet of two renders (for reviewing a change to the generator): per set a 1x and a 4x band with old | new for the crawl from two directions and treading water.

Guest sprite sets#

For the swimming-pool mod every guest is drawn in our own style, not only the swimmers. The mod's overrides folder replaces any game file by its data-relative path, WAD members included (MODS.md), and GuestSpriteAtlas reads the guest sets as /esprites/Generic/<Folder>/<NAME>.ESP plus its .TPC, the bank the game draws (an .FPC beside it is never opened), so a replacement set ships at the original paths:

data/esprites/Generic/Kids/SPR_BE.ESP        .TPC        (TPW kids; TPI: SPR_BD, SPR_GB, SPR_GK, SPR_KB)
data/esprites/Generic/Parents/SPR_FA.ESP     .TPC        (TPI: SPR_FA, SPR_MO)
data/esprites/Generic/Grandparents/SPR_GM.ESP .TPC       (TPI: SPR_GM, SPR_GR)
data/esprites/Generic/Kidsheads/SPR_BE.ESP   .TPC        (also Parentsheads, Grandparentsheads)

The path is the WAD member path below esprites with the archive's name dropped, compared without case (the TPI members Kidsheads/Spr_bd and Spr_gb have lower-case names). Directory listings stay the game's, which is how LoadSets finds the sets: an override can replace the members of an existing set but not add a new set, so a replacement keeps the original set names, and an ESP replaces the whole animation table (that is where our extra slots live).

Generating the sets#

B=/Applications/Blender.app/Contents/MacOS/Blender
$B -b --factory-startup --python tools/blender/opentpw_guest_sprites.py -- --out /tmp/swimart/guests --edition TPW
$B -b --factory-startup --python tools/blender/opentpw_guest_sprites.py -- --out /tmp/swimart/guests --edition TPI
# options: --sets BE,CH   --part land,swim,heads   --slots walk,run   --outfit clothes|swim   --no-quantise   --dither 0.05

Per set a folder <out>/<edition>/<Folder>/<SET>/ with slot<NN>_d<d>_f<f>.png (RGBA, trimmed to the frame's content, the whole set quantised to one 255-colour palette, median cut as SpriteSetBuilder does) and a set.json for the packer (the content-kit sprites command packs it with SpriteSetBuilder; nothing here writes ESP or bank files):

{ "name": "SPR_BE", "set": "BE", "edition": "TPW", "folder": "Generic/Kids", "fullDetail": true, "kidFlag": 0, "colours": 255,
  "slots": [ { "slot": 1, "name": "walk", "source": "land", "directions": 5, "framesPerDirection": 8,
               "frames": [ [ { "file": "slot01_d0_f0.png", "originX": -13, "originY": -39, "width": 22, "height": 40 }, "..." ], "..." ] } ] }

name is the set's member name; fullDetail is the ESP byte 0x10C (true: the set ships an .FPC too, written with the same content as the .TPC, as the shipped full-detail sets do, though the game draws the .TPC either way; false for the heads); kidFlag is ESP byte 0x10D (1 for the girls); frames are listed direction-major, as the bank stores them. Heads have source heads, one slot 0 of 7 directions (elevation rows) by 8 frames (azimuths).

Resolution#

--scale N renders every frame at N times the pixel size: canvas, hotspot offsets and pixels per Blender unit are N times larger (setup_scene(..., scale=N)), the supersampling drops from 6 to 4 at 2x (the frame is rendered 8 times its pixel size), and set.json gets "pixelsPerUnit": 128 * N. The packer (opentpw-kit sprites, pixelsPerUnit of its set.json) writes that into every frame's two pixels-per-unit words, and the game scales a quad by 128 / the word (GUESTS.md), so a 2x frame is drawn at the world size of the 1x frame it replaces with twice the detail. Hotspot offsets are in the set's own pixels (a 1x offset of -39 is -78 at 2x), and LAND_HOTSPOT_DROP counts 1x pixels (doubled at 2x; 0 since October 18, 2026).

Quantisation at 2x (one 255-colour palette per set, as at 1x): measured on all 175 frames of TA, the mean largest-channel error of the quantised frames against the unquantised ones is 2.9 of 255 and 2.6 % of the pixels are off by more than 16, with no visible banding beyond what the unquantised render already has. A light ordered dither (--dither 0.03 or 0.06) raises the error to 4.0 or 5.7 and shows only as grain, so none is used. Sizes: a TPW kid set in clothes is 0.12 to 0.14 MB as shipped (55 frames, slots 0, 1 and 14; with every slot, 175 frames, it was 0.46 MB at the earlier camera), its heads 0.12 to 0.14 MB (56), a swimwear set 0.75 to 0.78 MB (295), all .TPC only; the 24 shipped sets are 8.25 MB. tools/blender/opentpw_guest_hires_compare.py --compare draws 1x against 2x (reports/guests-hires-compare.png) and --sheet a contact sheet of any generated set.

Swimwear slots#

--part pool renders opentpw_pool_poses.POOL_SLOTS into <out>/<edition>/Pool/<SET>/: the swimwear table of the pools mod (the PoolSwimSlots constants), five directions each. Dry slots use swimwear and dry hair; the water slots (8 to 13) the wet kid, with the water's tint and translucency below the water line, foam rings and droplets.

SlotMeaningFramesHotspot
0stand on the deck1feet on the floor
1walk on the deck8feet
2run (unused, empty)
3climb a ladder, facing it, hands reaching for rungs, knees coming up4torso centre
4dive or jump: crouch, leap, arc, head-first entry (upside down)4torso centre
5lying on the back, head away from the heading (lounger)2torso centre
6standing under a shower, hands in the hair, falling drops4feet
7sliding on the back, feet first, arms up then crossed2torso centre
8, 9, 10crawl, breaststroke, treading water (as before)8, 8, 4torso at the water line
11splash-down: the body sinks from the shins to the shoulders, a crown of drops, growing rings4torso at the water line
12sitting in the water (spa), knees up, an arm on the rim, then waving2torso at the water line
13floating in an inflatable ring (own colour per kid), paddling and bobbing4torso at the water line
14swinging on a rope, hands overhead: legs forward, down, trailing, down4torso centre
15spare, empty

Slots whose hotspot is the torso centre may point up or down the frame (the dive ends upside down), so the generator renders them on a larger canvas (96 x 96 px at 1x for TPW). The engine places the torso centre on the path of the ladder, dive, slide or rope; the lying hotspot is the centre of the body on the lounger.

Hotspot rule#

originX/originY follow the reader (SpriteFrame.OriginX/OriginY): the offset of the frame's top-left pixel from the hotspot, the quad spanning originX to originX + width (and likewise vertically) in 1/128 units. The hotspot of a standing, walking, running or gesturing guest is on the floor between the feet; ours is the world origin pixel of the render (LAND_HOTSPOT_DROP 0). From the TPC's camera the originals' soles end 3 to 5 pixels below the hotspot when standing, and ours 2 to 5 (a mean of 3.9 against 4.0 to 4.2). Until October 18, 2026 the hotspot was one pixel lower, to match the FPC, whose soles end 1 to 2 pixels below it. A swimmer's hotspot is the centre of the torso at the water line (slots 8 to 10), a head's the centre of the skull. All of a set's frames of one slot share one hotspot, so the guest does not jump between frames. Frame content of the shipped TPW kid sets against the originals' TPC frames (ours, the 2x frames halved / original, in pixels; top/bottom are originY and originY + height):

SetSlotWidthHeightTopBottom
BE017 to 24 / 21 to 2632 to 36 / 32 to 37-31 to -30 / -34 to -292 to 5 / 3 to 5
BE117 to 27 / 18 to 3231 to 36 / 29 to 40-32 to -26 / -34 to -272 to 9 / 2 to 7
BE1417 to 30 / 19 to 2532 to 36 / 33 to 37-31 to -30 / -34 to -292 to 6 / 3 to 5
TA019 to 24 / 17 to 2631 to 35 / 32 to 34-30 to -29 / -29 to -292 to 5 / 3 to 5
TA118 to 27 / 16 to 3131 to 36 / 30 to 35-32 to -26 / -29 to -272 to 9 / 2 to 8
TA1418 to 30 / 16 to 3431 to 36 / 27 to 35-31 to -29 / -31 to -242 to 6 / 3 to 5

The TPI sets as measured before (at 25 degrees, the hotspot one pixel lower, against the originals' FPC frames; TPI's Game.exe draws the TPC too, so they are not calibrated against the bank it draws yet):

SetSlotWidthHeightTopBottom
BD027 to 30 / 21 to 3246 to 49 / 47 to 50-45 to -45 / -49 to -491 to 4 / -2 to 1
BD127 to 34 / 19 to 3844 to 49 / 45 to 50-46 to -42 / -48 to -460 to 7 / -2 to 3
BD1226 to 30 / 21 to 3842 to 50 / 45 to 50-50 to -42 / -49 to -47-3 to 4 / -3 to 1
FA032 to 38 / 27 to 3561 to 64 / 60 to 64-59 to -59 / -63 to -612 to 5 / -1 to 1
FA132 to 42 / 28 to 4657 to 65 / 56 to 63-60 to -54 / -63 to -58-1 to 10 / -2 to 1
FA1232 to 38 / 29 to 4959 to 64 / 58 to 65-64 to -57 / -63 to -59-2 to 5 / -1 to 2
GM028 to 32 / 30 to 3652 to 56 / 46 to 55-54 to -49 / -54 to -511 to 4 / -5 to 1
GM129 to 36 / 27 to 3647 to 58 / 50 to 56-54 to -43 / -55 to -52-1 to 8 / -3 to 1
GM1226 to 32 / 26 to 4252 to 56 / 47 to 61-55 to -49 / -59 to -49-3 to 4 / -2 to 2

Slots#

The original slots keep their numbers, frame counts and directions (5 directions: 0 away from the camera, 2 facing screen right, 4 facing the camera; the game mirrors 5 to 7). The meaning of each slot was identified by looking at the original frames:

SlotMeaningFrames per directionSets
0stand1all
1walk8all
2run8TPW kids, TPI kids
4gesture A: turn and point, spread the arms, bow4all
6gesture B: a hand to the chin (thinking), tilt the head, nod4all
11stumble, hunching over a hand on the stomach (sick)4TPW kids
12cheer: arms up, a hop, down4all
14wait with the hands on the hips2TPW kids
15TPI idle: one arm points out and sweeps4TPI kids and adults
8new swim: front crawl8all
9new swim: breaststroke8all
10new swim: treading water4all

The TPI adults have no run slot, as in the originals. Slots 8 to 10 are free in every original table (TPW kids use 0, 1, 2, 4, 6, 11, 12, 14; TPI kids 0, 1, 2, 4, 6, 12, 15; TPI adults 0, 1, 4, 6, 12, 15), the pose generators are tools/blender/opentpw_guest_anims.py (land) and the swim poses of opentpw_swim_sprites.py. The motions were recreated from the originals' frames (stride width and arm swing of the walk and run, the arm arcs of the gestures, the hunch of the stumble, the raised arms of the cheer); the timing is a plain even sampling of each loop and the poses are not frame-for-frame copies.

Outfits#

build_kid(preset, outfit="clothes") builds the land outfit of CLOTHES (jacket, dress, shirt, cardigan or suit; sleeves; shorts, trousers, skirt or dungarees; socks; shoes; the TPI caps, the dad's safari hat and camera), after the originals' standing sprites; outfit="swim" the swimwear. The generator uses the clothes for the land slots and the swimwear for the swim slots, and --outfit swim (or the preset switch in build_kid) draws swimwear on land too, for a mod that wants it everywhere.

Head sets#

Generic/Kidsheads, Parentsheads and Grandparentsheads hold one slot 0 of 7 elevation rows by 8 azimuths, direction-major (frame = 8 * row + column), drawn on riders of ADDHEAD rides (GUESTS.md). The camera sits at row * 30 degrees from the head's up pole and column * 45 degrees from its front, column 2 seeing the head's left side (face to the left in the picture), which is how the original frames are arranged; at the poles the picture's up follows the azimuth. Dry hair, hats on. A head is rendered at 1 / 0.685 of the body's pixel scale (the game draws a head sprite at 0.685 of the body's scale) times 0.9, so the frames are 25 to 42 px wide like the originals' (25 to 40). The shipped TPW sets store 55 or 56 frames (one set 64); ours store 56.

Not reproduced well#

Third-review fixes (measured against the original FPC frames)#

MeasureBeforeAfterOriginal
TPI camera elevation34 degrees25matches widths and heights best
TPW camera elevation32 degrees2725-30 by eye (45 since October 18, 2026, measured against the TPC)
Walk foot spread, direction 2, contact frame (px; BE / BD / FA)22 / 26 / 3928 / 34 / 4028 / 33 / 38
Walk foot spread at the passing frame (px; BE / BD / FA)14 / 15 / 2012 / 14 / 1811 / 15 / 20
Run foot spread at contact (px; BE / BD)25 / 3028 / 3533 / 41
Head height over total height, direction 4 (BE / BD / FA)0.39 / 0.38 / 0.290.35 / 0.33 / 0.260.32 / 0.33 / 0.24

Walk and run now start at the contact pose (legs furthest apart, as the originals' frame 0), pass with the feet together a quarter of the loop later and push off at the next contact; the body is highest at the passing frame, and the hip swing and arm swing scale with a per-body stride (kids 1.0, mum 0.85, dad 0.72, granny 0.6, grandpa 0.62). Kids have longer legs (0.46 + 0.42) and a head scale of 0.84; the adults' heads are 0.85 to 0.95. FA has a smaller hat brim and a bigger nose so his face shows in profile; GR stoops 34 degrees, has darker skin so the bald top does not read as a white ball, and the white hair sits at the sides and back. The TPI head sets use a hotspot 6 px lower (the shipped TPI heads put it about 9 px below the head centre), and FA's head is drawn 1.3 times larger. The head ratio is measured at the narrowest row between 25 % and 55 % of the frame height, so it is a rough number.

Source: docs/CONTENT-KIT.md in the project repository.