跪拜 Guibai
← All articles
Three.js · Game Development · AI Programming

The 1.4-MB FPS That Generates Everything: A Teardown of Saltline and an AI-Built Clone

By 浪浪山_大橙子 ·
Read original on juejin.cn ↗ Google Translate ↗ Alt translation

Storing the rules for a scene instead of the scene itself can shrink a full game to a single HTML file, which changes what's practical for browser distribution and instant loading. The AI-assisted rebuild also shows that a small team can iterate quickly, but the line between "inspired by" and "copy" gets blurry when most of the code is generated by a model.

Summary

The entire game fits in 1.4 MB because it stores generation rules, not asset data. Models are built from geometric parameters, textures come from layered noise and rust algorithms, and every gunshot and rain pattern is synthesized audio. At startup, the browser expands those rules into meshes, textures, and sound buffers, then runs a full Three.js FPS with PCSS-style soft shadows, HDR tone mapping, and weather that reacts to shelter.

The 18-point teardown covers how the scene stays believable: wet ground transitions from damp to puddle with matching roughness and reflection changes, triplanar mapping removes the need for hand-made UVs, and contact shadows are computed separately from volumetric light and merged by depth. Even the mechanical dogs use paw-contact inverse kinematics, and enemies use A* with line-of-sight checks and last-known positions.

The author's own clone, Mist Harbor, started at 7.53 MiB with scanned textures, then dropped to 0.814 MiB after switching to procedural materials. The comparison highlights what procedural generation costs: smaller files but a heavier runtime load and a visual gap that no amount of code organization can close. The article ends by openly crediting the original Saltline work and inviting players to compare both games directly.

Takeaways
— The received HTML is 1,425,707 bytes (about 1.36 MiB) and includes Three.js plus all game logic.
— Procedural generation replaces result data with rules: geometry from parameters, textures from algorithms, audio from synthesis.
— GPU offscreen baking produces color, ORM, and height maps, then derives normals and caches them for reuse.
— Soft shadows follow the PCSS idea: search occlusion depth, estimate penumbra from distance, then filter.
— Wet ground uses a dry-to-puddle continuum that varies roughness, color, normals, and reflection intensity.
— Rain visibility and sound change under shelters, so weather is tied to scene geometry.
— Mist Harbor 0.2 used scanned textures at 7,893,868 bytes; 1.0 switched to procedural materials and dropped to 853,360 bytes.
— The original Saltline implementation is credited to Felix Rieseberg's Claude Fable 5.2 experiment.
Conclusions

Procedural generation shifts the cost from disk to runtime; the first-frame load still has to build every mesh, texture, and audio buffer, so a small package doesn't mean a light process.

The comparison between scanned and procedural materials shows a real trade-off: scanned textures deliver surface detail fast but bloat the file and don't fix proportion or layout issues, so the choice depends on whether distribution size or art-director control matters more.

Attribution in AI-assisted development is a practical issue, not a legal one: the author had to correct the record that the received file was a localized Saltline build, and that borrowing gameplay and visual direction counts as dependence even when the code was rewritten.

Concepts & terms
PCSS
Percentage-closer soft shadows: a shadow technique that estimates the penumbra size based on the distance between the occluder and the receiving surface, giving sharp contact shadows and softer edges further away.
Triplanar mapping
A texture-projection method that samples a texture three times along the world axes and blends based on surface normal, eliminating the need for manual UV unwrapping on complex procedural geometry.
Inverse kinematics (IK)
A method to compute joint rotations from a desired end-effector position; here it lets a mechanical dog's paw stay planted on the ground while the body continues moving forward.
Source: juejin.cn ↗ Google Translate ↗ Backup ↗