Sprite Production Field Notes

sprite ai

Diagnose byte-swapped terrain heights at a PGM handoff

A sprite-based terrain map can show a ridge in the wrong place even when its depth texture is valid 16-bit PNG. If the exporter consumes a binary PGM from a custom terrain tool, check the sample order at that boundary. A serializer can write the wrong value without changing either the image dimensions or its bit depth.

Make a disposable P5 PGM with maximum value 65535 and sample values 0x0001, 0x0100, 0x1234, and 0xFFFF. In the binary raster, read each two-byte sample with the most significant byte first. The third sample should be stored as 12 34 in hexadecimal. Build a negative copy with each pair reversed. Its first two values exchange places and its third becomes 0x3412, while full scale stays the same.

The technical guide and test fixture records an OptiPNG conversion preserving all four integers in an independent 16-bit PGM fixture. For your pipeline, compare the original numeric map, the raw PGM samples, and the decoded PNG integers. If the mismatch is already present in the PGM, fix the source serializer before tuning the game’s terrain thresholds.

Keep the byte-swapped copy in the validation suite. The asymmetric values prove the test can identify a sample-order bug that a zero-to-white test would miss.

Prepared by the FrameSprite Workflow Team with AI assistance. Examples are illustrative unless attributed to a linked fixture.