Code as an Asset: The Technical Path to a Real-Time 3D World in About 1MB
This article examines how a playable, realistic first-person shooter scene can ship as a single local web page of roughly 1.36MB with no external asset packs. It breaks down the file composition, contrasts the traditional binary asset pipeline with runtime generation, and maps the code assets behind a 1MB-scale scene: the rendering foundation, scene manifests, parameterized prop libraries, canvas and noise materials, procedural animation, lighting presets, audio synthesis, and physics. It also covers performance budgeting, engineering guardrails for long-running automated generation tasks, and where this approach fits best.
1. The Signal: What a 1.36MB Playable 3D Scene Actually Means
A recent technical demo has drawn attention: an AI coding tool, running a long autonomous task without human intervention, generated a realistic first-person shooter scene. The output was a local page that opens directly in a browser, about 1.36MB in size, with no dependency on any external asset pack. The presenter shared an approximate file breakdown (percentages are rounded):
- Rendering foundation and math libraries: ~696KB, 50.0%
- Scene placement manifest (harbor industrial theme): ~136KB, 9.7%
- Parameterized prop library (containers, forklifts, generators, 36 categories): ~113KB, 8.1%
- UI, physics, and main loop: ~93KB, 6.5%
- Materials and industrial decals: ~75KB, 5.3%
- Weapons, hands, and actions: ~57KB, 4.1%
- Lighting and post-processing pipeline: ~54KB, 3.9%
- Mechanical enemies and skeletons: ~54KB, 3.9%
- Audio and music synthesis: ~54KB, 3.9%
- Combat particles and destruction effects: ~53KB, 3.8%
The point worth noting is not that it is “small.” It is that the resource structure has shifted: there are no mesh files and no texture files. Geometry, materials, animation, and sound are all derived by code at runtime. That is the core meaning of “code as an asset.”
2. Two Paradigms: Binary Asset Pipelines vs. Runtime Generation
Traditional 3D content production centers on producing binary assets offline and loading them at runtime: modeling tools export meshes and textures, and the engine handles import, baking, and packaging. The advantages are control, reusability, and smooth art collaboration; the costs are package bloat, heavy load and memory pressure, and a long iteration loop.
The runtime generation route replaces “assets” with “programs that generate assets”: the scene is a manifest, props are parameterized molds, materials are noise and print functions, and sound is waveform synthesis. The payoff is a significant drop in size and load time, plus a low cost for parameterized changes; the tradeoff is greater sensitivity to program correctness and runtime performance, and debugging shifts from “editing resources” to “editing algorithms.”
The two routes are not replacements for each other. Realistic character expressions, high-precision scanned assets, and complex cloth and hair still suit offline production; industrial scenes, hard-surface props, and procedural cities and terrain are naturally suited to parameterization.
3. Layer by Layer: What “Code Assets” Make Up a 1MB Scene
3.1 Rendering Foundation (About Half the Size)
This layer is usually the static footprint of a general-purpose rendering and math library, a fixed cost. In practice, compress it through on-demand trimming and by packaging only the shaders and features actually used. When budgeting, treat it as an “entry fee” rather than something that can be compressed indefinitely.
3.2 Scene Manifest and Layout
The scene is no longer a pile of model references but a structured description: position, orientation, scale, group membership, and generation parameters. Example (illustrative structure):
{"scene": "harbor","seed": 20261111,"modules": [{"type": "crane", "pos": [12, 0, -8], "params": {"height": 18, "rust": 0.35}},{"type": "containerStack", "pos": [-4, 0, 6], "params": {"rows": 3, "cols": 4}}],"lighting": {"preset": "dawn", "fogDensity": 0.02}}
A fixed random seed is key to reproducibility: the same manifest should generate the same world on any device, which makes debugging, regression testing, and version comparison easier.
3.3 Parameterized Prop Library
Treat the “36 props” as 36 generator functions with parameter ranges, reusing geometry through composition and instancing. Instanced rendering, geometry merging, and shared materials can substantially reduce draw calls and memory usage.
3.4 Materials and Decals: Canvas and Noise Instead of Images
Nameplates, rust, gravel, and bullet holes can be drawn to a canvas or texture atlas at runtime, then reused with a small number of textures. The key is to control texture size and generation frequency: cache the static parts, and constrain dynamic parts (such as bullet holes) to a fixed ring buffer.
3.5 Animation and Feel
Weapons and quadruped units use “part assembly plus procedural gait,” with actions like reloading and inspection driven by state machines and time curves. Compared with skeletal animation assets, its size is almost negligible, but parameters need careful tuning to avoid a mechanical feel.
3.6 Lighting and Post-Processing
Dawn skies, soft shadows, wet-ground specular reflections, and color grading can be built as preset pipelines. Reflections and shadows are the easiest parts to overrun the budget, so use tiered quality strategies (switching resolution and update frequency by device capability).
3.7 Audio Synthesis
Gunshots, sea wind, and music are synthesized from mathematical waveforms and envelopes, avoiding audio files. Note that synthesized audio requires a tradeoff between CPU cost and auditory naturalness; a common approach is “synthesized base plus a few short samples.”
3.8 Physics, Collision, and the Main Loop
Collision boxes are often far simpler than the visible geometry, a deliberate tradeoff that prioritizes physics stability and performance. The main loop handles missions, enemy behavior, state transitions, and resource lifecycles.
4. Performance Budget: Turning the “Size Advantage” into Stable Frame Rates
Small size does not mean low overhead. Runtime generation moves the cost from “download and storage” to “real-time computation on the CPU and GPU.” It helps to maintain an explicit budget table, for example (illustrative):
- Draw calls: < 300/frame
- Triangles: < 800K/frame
- Texture memory: < 128MB
- Generation phase time: first frame < 1.5s, with frame-spread generation to avoid stutter
- Physics rigid bodies: < 150 active
Engineering measures include frame-spread generation and incremental loading, geometry and material caching, instancing, distance-based culling, dynamic resolution, and moving repeated computation into shaders. If a team deploys build pipelines on a container platform, distributes artifacts through object storage, and uses monitoring and alerting to track online frame rate and error rate, “generation quality” can also be brought into an observability system.
5. Engineering Long-Running Automated Generation Tasks
The demo’s pattern of “a one-sentence requirement, hours of continuous running, and considerable compute” needs guardrails before it can be reused in production:
- Verifiable goals: turn “realistic” and “AAA visuals” into measurable metrics (frame rate, triangle count, load time, no errors).
- Staged commits: first produce a runnable skeleton, then add scenes, props, and effects layer by layer, with each layer rollback-able.
- Determinism: fix random seeds and version numbers to guarantee reproducibility.
- Cost ceilings: set compute and time thresholds, and degrade rather than abort when exceeded.
- Automated regression: after each generation, run an automated inspection pass (startup, interaction, memory, exception logs).
6. Fit and Adoption Advice
Well suited to: industrial/sci-fi hard-surface scenes, teaching and demos, prototype validation, web-based interactive content that needs a tiny package, and procedural levels that need many variants.
Not suited to: high-precision character performance, film-grade scanned assets, heavily art-customized pipelines, and production lines with extremely high predictability requirements (determinism testing must be in place first).
For adoption, start with “one prop + one scene manifest + one rendering pipeline,” establish the budget table and inspection scripts first, then expand the prop library and gameplay layer. Managing “assets” as code means introducing code review, unit testing, version control, and canary releases, which is where the real engineering barrier of this paradigm lies.
