Skip to content

VANILLAJS v3.3.0 β€” THE MEMORY FORGE πŸ‘½βš™οΈ

Choose a tag to compare

@EmergentMonk EmergentMonk released this 22 Nov 16:35
Immutable release. Only release title and notes can be modified.
a2bc2db

RENDER-PACKING-001 β€” Less Allocation. More Reuse. Same Correctness.

Stop rebuilding what you can reuse.

VANILLAJS v3.3.0 introduces a new experimental, low-allocation geometry system designed to reduce JavaScript memory churn during dynamic rendering.

Building on v3.2.0 β€” SEDIMENT & SIGNAL, this release adds reusable Float32 geometry streams, bounded buffer ownership, exact rendering-data verification and reproducible CPU benchmarks.

The objective is straightforward: reduce unnecessary memory allocation while preserving the engine's numerical correctness, rendering contracts and offline-first architecture.

No new frameworks. No cloud dependencies. No replacement rendering engine.

Correctness outranks speed.

What's new

RENDER-PACKING-001 β€” Bounded Geometry Streams

The new render-packing module introduces BoxVertexStream, a reusable geometry writer for native JavaScript and WebGL applications.

Previously, constructing a large number of dynamic boxes involved repeatedly allocating temporary corner arrays, colour arrays and JavaScript vertex arrays before converting the result to Float32 data for GPU upload.

The new approach lets applications prepare their geometry in one preallocated, bounded Float32Array.

Features include:

  • Reusable typed-array storage with no capacity growth during rendering.
  • Configurable capacity from 1 to 4,096 boxes.
  • Direct scalar geometry writing through appendXYZRGB().
  • Compatibility with the existing XYZ/RGB vertex layout.
  • Exact Float32 output parity with the existing box geometry builder for admitted inputs.
  • Strict validation of finite coordinates, dimensions and colours.
  • Explicit capacity errors rather than silent geometry truncation.
  • Reuse across frames through reset().
  • Direct integration with the existing WebGL renderer's typed-array upload path.

The module is entirely optional and written in native JavaScript without third-party runtime dependencies.

Memory efficiency

For a workload containing 512 dynamic boxes:

Property Value
Box capacity 512
Vertices per box 36
Total vertices 18,432
Total triangles 6,144
Vertex data 110,592 Float32 values
Retained buffer 432 KiB

Rather than rebuilding the vertex payload from temporary JavaScript arrays every frame, the new stream reuses its preallocated storage.

A small typed-array view is still created for each upload. The browser remains responsible for JavaScript garbage collection and GPU memory management.

This release reduces allocation opportunities; it does not claim to replace or directly control browser garbage collection.

Exact geometry preservation

The implementation retains the existing renderer's:

  • Triangle and vertex ordering.
  • Face shading coefficients.
  • Coordinate conventions.
  • Float32 output representation.
  • Signed-zero behaviour under the tested domain.
  • Existing WebGL buffer ownership and upload semantics.

An independently implemented historical geometry reference is used to compare emitted output against the new writer.

The existing render-webgl implementation remains unchanged.

Verification and benchmarking

New regression tests

tests/render-packing.test.js introduces verification covering:

  • Exact Float32 byte comparison against historical geometry.
  • Stable vertex and face ordering.
  • Multiple dynamic box configurations.
  • Reset and backing-storage reuse.
  • Prevention of drawing stale vertex tails.
  • Invalid and non-finite geometry rejection.
  • Explicit capacity enforcement.
  • Preservation of previously accepted content following rejected operations.

These tests establish the geometry writer's correctness contract. They do not constitute a physical GPU performance benchmark.

Reproducible workload

A new benchmark utility is included:

node scripts/render-packing-workload.mjs

The workload compares the previous JavaScript-array assembly method against the reusable Float32 stream.

It exercises:

  • 64-box scenes.
  • 256-box scenes.
  • 512-box scenes.
  • 80 frames per measurement.
  • Two warm-up pairs.
  • Seven alternating measurement pairs.

Results include raw observations, median CPU geometry assembly times, output parity and retained-buffer sizes.

Timing results are observational rather than CI performance thresholds.

Important: These measurements concern CPU geometry preparation. They do not establish browser GC pause reductions, physical GPU throughput or an increase in game FPS.

Those remain targets for future instrumented benchmarking.

Engine integration and compatibility

The new API is registered as the 84th experimental VANILLAJS module.

Updated documentation includes:

  • MODULES.json
  • BUILD_A_GAME.md
  • docs/API.md
  • docs/RENDER_PACKING_001.md

The documentation catalogue audit has also been updated to recognise 84 modules and include the new rendering guide.

Existing game engines, gameplay modules, renderers, AI systems, collision routines and replay interfaces remain unchanged.

Applications must explicitly opt into the new module.

No existing game is silently upgraded

Boomer-Shooter, Games2 and other QSOL-IMC games can adopt the new geometry system in future independently reviewed updates.

The existing Boomer-Shooter integration remains pinned to VANILLAJS v3.2.0.

A later integration can use the new writer for visual projectiles and particle geometry while independently preserving authoritative collision, damage and replay behaviour.

GitHub Actions and CI

PR #151 also corrected an initial catalogue-audit failure caused by registering a new module without updating the expected module count.

The audit now correctly recognises:

  • 84 modules
  • 52 recipes
  • 2 research experiments

At the latest verification, the merged commit had 18 of 21 post-merge workflows passing, with no failures reported. Flight Lab/Pages, RACING-001 Chromium and Lab Endurance were still running.

The release should be tagged after the remaining post-merge checks pass and the owner accepts the release.

Known limitations

  • The new writer currently supports axis-aligned, coloured box geometry.
  • It does not provide WebGL instancing, arbitrary mesh formats or physically based materials.
  • It does not change VANILLAJS Combat3D's 64-projectile limit.
  • The stream's fixed capacity must be selected before construction.
  • Returned typed-array views share their backing storage and must not be treated as immutable snapshots.
  • Physical GPU performance improvements have not been established.
  • Browser allocation rates, GC frequency and GC pause durations have not yet been independently quantified.
  • Reduced CPU allocation is not a guarantee of higher FPS.

What's next

The Memory Forge establishes a reusable foundation for a broader engine memory-efficiency programme.

Candidate follow-up work includes:

  1. Allocation profiling: measure JavaScript allocation rates, garbage-collection pauses and frame-time distributions.
  2. Projectile and effect pooling: investigate bounded reusable storage for high-density combat visuals.
  3. Simulation snapshot profiling: identify unnecessary state-copying overhead without compromising authoritative replay.
  4. Dynamic geometry batching: reduce repeated uploads and draw preparation where equality can be demonstrated.
  5. Native GPU acceptance: compare complete workloads on identified graphics hardware before promoting any performance claims.
  6. Downstream adoption: integrate reviewed improvements into Boomer-Shooter's proposed STORM PROTOCOL bullet-hell mode and other VANILLAJS-powered games.

Each improvement will require independent verification, reproducible evidence and owner review.

Release provenance

Repository: https://github.com/QSOLKCB/VANILLAJS

Previous release: v3.2.0 β€” SEDIMENT & SIGNAL

New release: v3.3.0 β€” THE MEMORY FORGE

Merged PR: #151

Release candidate commit:

a2bc2dbbb2e2a28fb8857eb7916f1bb374d3c85c

Full changes:

v3.2.0...a2bc2db

Licence: Apache-2.0


QSOL-IMC β€” THIS IS NOT A PRODUCT. THIS IS INDEPENDENCE.

VANILLAJS v3.3.0 β€” THE MEMORY FORGE

Less allocation. More reuse. Same correctness. πŸ‘½βš™οΈ