Tunnel Flap
First-Principles DOM-Based 2D Physics Game Engine

↳Cyclic 8-node DOM pool: nodes exiting the left edge reposition to the right with randomized gap geometry
What was this and who was it for?
A technical deep dive exploring browser rendering mechanics, garbage collection thresholds, and low-level object lifecycle management without framework abstractions.
What was broken, frustrating, or missing?
Naive DOM games continually create and remove elements in an infinite scroll, triggering repetitive garbage collection pauses that cause perceptible frame drops and stutter.
Design & Platform Boundaries
- [1]Strictly no `<canvas>` or WebGL rendering contexts allowed; rendering must use standard DOM tree elements.
- [2]Strictly no external game libraries (Phaser, Pixi) or UI frameworks (React).
- [3]Memory profile must remain flat throughout extended continuous play sessions.
Architectural & UX Strategy
Built a fixed object pool of eight DOM obstacle nodes recycled continuously along the horizontal axis, paired with a delta-time physics step and mathematical AABB bounding-box collision detection.
Execution Highlights
What was compromised & what was gained?
- /Accepted CSS transform rendering limitations compared to Canvas batch draws, restricting maximum concurrent particle count.
- /Manually managed coordinate systems across varied display resolutions.
Verifiable Outcome
Demonstrated that careful memory architecture and object pooling can deliver fluid, responsive game physics directly within standard HTML/CSS DOM trees.
"Frameworks are convenient, but understanding the browser's paint lifecycle, garbage collector, and layout pipeline from first principles is what makes high-performance frontend engineering possible."