canvas-physics-from-scratch
Lightweight 2D rigid-body physics engine built from scratch with circles, AABBs, impulse resolution, slingshot mechanics, and comparison against Matter.js.
- 1
- TypeScript
- MIT
- 3 d ago
m2-md
Built from m2-md's public GitHub profile. Not on Take My Repo yet, so there are no posts or updates here.
Lightweight 2D rigid-body physics engine built from scratch with circles, AABBs, impulse resolution, slingshot mechanics, and comparison against Matter.js.
Broad-phase 2D collision detection: comparing naive O(n²) pairwise checks against spatial hash grid and quadtree spatial partitioning algorithms.
Dirty rectangle rendering optimization for HTML5 Canvas: computing minimal bounding box redraw regions to avoid clearing and rendering the entire canvas frame.
Eliminating garbage collection pauses in HTML5 Canvas games: generic Pool<T>, in-place vector arithmetic, preallocated particle arrays, and pooled vs unpooled benchmarks.
Deterministic fixed timestep physics simulation decoupled from variable display refresh rates using state accumulator and alpha render interpolation in TypeScript.
Solving blurry canvas rendering on Retina/HiDPI displays: backing store buffer scaling, CSS pixel alignment, and measuring the quadratic dpr² fill-rate performance tax.
Complete MSDF and MTSDF font atlas generation from scratch: corner angle detection, edge coloring, signed distance rasterization, shelf packing, and WebGL2 median() shaders.
Screen-space refraction in WebGL2: simulated index of refraction (IOR), chromatic dispersion, and Fresnel reflections compared against CSS backdrop-filter and SVG feDisplacementMap.
Measuring actual GPU VRAM usage of compressed textures: block alignment, mipchain overhead, cubemap multiplier, KTX2 transcoding targets, and compressedTexImage2D probes.
Zero-dependency drop-in debug overlay for HTML5 canvas games: real-time frame time graph, metric ring buffers, spatial hitbox visualization, and self-cost measurement.
Real-time 2D Navier-Stokes fluid simulation in WebGL2 and GLSL ES 3.00: ping-pong Framebuffer Objects, reverse advection, Jacobi pressure solver, and vorticity.
Timestamped input buffer, command queue, coyote jump forgiveness, and fighting game sequence recognizer (Hadouken parser) testable headless in Vitest.
Interactive particle typography: rasterizing canvas text, sampling alpha contours, Morton order pairing, and morphing 250,000 particles via single-uniform WebGL2 instancing.
Verlet integration physics simulation with distance and angle constraints: draggable ropes, cloth grids, and articulated ragdoll skeletons.
Single-page Vite demo illustrating network latency hiding: client-side prediction, a pending input queue, and server reconciliation with synthetic latency and jitter.
Infinite chunked procedural heightmap terrain in Three.js r185: seeded value noise + fBm, chunk coordinate grid arithmetic, and analytic heightfield normal continuity.
Empirical benchmark of four Three.js rendering strategies populating 1,200 level props: naive individual meshes, InstancedMesh, BatchedMesh, and mergeGeometries.
Custom cell-and-portal occlusion culling engine for Three.js: portal frustum clipping with Sutherland-Hodgman polygon clipping and Potentially Visible Set (PVS) caching.
Zero-asset procedural pattern puzzle game built purely with HTML5 Canvas, Web Audio API procedural sound synthesis, and local storage persistence.
2D side-scroller engine on HTML5 Canvas: smooth lerping camera, multi-layer parallax, coyote time, jump buffering, moving platforms, and buoyancy physics.
Black-box input capture and deterministic replay harness for canvas games: compact RLE recording format, state checksum hashing, and desync regression testing.
Juicy falling catch game built from scratch on HTML5 Canvas: sine swaying physics, dynamic juice, screenshake, particles, 10 campaign stages, and realistic spider mechanics.
High-performance cyberpunk falling game and juicy juice effects built from scratch on HTML5 Canvas: accumulator spawner, cyber tether tractor beams, and 25 protocols.