frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

Open in hackernews

Show HN: Organic cell simulation with infinite zoom (100k cells, raw WebGL)

https://philomatics.com/cell-game-source/
3•cloogshicer•4h ago
Made this little cell simulation with an infinite zoom mechanic in raw WebGL. Renders up to 100k cells on my laptop (M1 MBA).

It's a single HTML file, not minified, without dependencies, so you can just inspect the source code. It's just raw JS and WebGL shaders. No assets, everything is procedurally generated.

For each cell, I draw a single quad using instanced rendering. To create a nice organic wobble, I use SDF (Signed Distance Fields) to draw a circle (or another base shape), which is then distorted by adjusting the radius using multiple overlapping sine waves. I explain this visually here. [1]

To get the cells to stretch dynamically based on their velocity, I use a technique called Domain Warping. Basically in the fragment shader, the fragmentPosition is adjusted inwards/outwards depending on the current velocity, which squashes/stretches the entire coordinate system of the quad in either direction. Gives it a very organic look. I explain this in more detail here. [2]

Physics are also custom, on the CPU using position-based dynamics (PBD). This is currently the weak point of the engine, and with lots of cells, it's CPU constrained. I might move this to the GPU later or switch to a different approach. Not sure yet.

The infinite zoom mechanic works by dynamically rendering only the two currently visible layers. Physics are currently simulated all the time for all layers, although I could potentially also pause layers that are not currently visible.

All of this uses data-oriented design (DOD) techniques to keep most of the data structures in flat typed arrays for fast iteration and to minimize allocations in the main game loop.

I'm planning to build this engine out into a full incremental game with some light automation elements (think a microscopic Factorio, but much shorter). If you're interested in following the dev process, I post highly technical deep-dives on YouTube [3], or you can enter your email here [4] to get source code updates (super low volume).

Let me know what you think! Happy to answer any questions.

[1] https://youtu.be/VChlSt6gVSo?t=380 [2] https://youtu.be/VChlSt6gVSo?t=516 [3] https://youtube.com/@philomatics [4] https://philomatics.com/cell-game

Comments

vunderba•31m ago
> To get the cells to stretch dynamically based on their velocity, I use a technique called Domain Warping. Basically in the fragment shader, the fragmentPosition is adjusted inwards/outwards depending on the current velocity, which squashes/stretches the entire coordinate system of the quad in either direction. Gives it a very organic look. I explain this in more detail here. [2]

Nice job! One question. I don’t know a ton about shaders, but my understanding was that they’re purely a visual thing. So if you’re stretching and physically altering the cells/structure/topology, will you be able to use that in gameplay as well?

In other words, can those changes still affect physics, collision detection, and other interactive elements of the game?

Show HN: CheapSecurity – Lightweight, Self-Hosted CCTV for Linux SBCs

https://github.com/gmrandazzo/CheapSecurity
3•zeldone•19m ago•0 comments

Show HN: Cookbook AI – turn scattered recipe files into a print-ready cookbook

https://cookbookai.io/index.html
2•bookletaitcv1re•14m ago•0 comments

Show HN: A client side PDF and article reader backed by Google Drive

https://pdf-reader-peach.vercel.app/
2•northfield27•19m ago•0 comments

Show HN: Reverse Minesweeper

https://sunflowersgame.com/
22•pompomsheep•3h ago•12 comments

Show HN: I mapped every US golf course

https://golfcoursebrowser.com/
184•rickmf•13h ago•112 comments

Show HN: Managing on-premise servers without Kubernetes

https://github.com/ricardoborges/Nautilus
10•r2ob•2h ago•0 comments

Show HN: I built an app for learning and playing Bridge

https://bridge.brannon.online
3•braxxox•1h ago•0 comments

Show HN: A browser-based video editor that renders videos directly with FFmpeg

https://github.com/thiagoalbrecht/weave
3•thiagoas•2h ago•1 comments

Show HN: Brolly, a plain-text weather forecast site

https://brolly.sh/forecast/RWFP2qW8
218•jsax•22h ago•78 comments

Show HN: I made some transistor animations

https://brandonli.net/semisim/animations
203•stunningllama•1d ago•26 comments

Show HN: QueryTuner – SQL diagnostics across 5 DBs, no database connection

https://www.querytuner.com/
4•autoshiftops•4h ago•0 comments

Show HN: SQLiteWatch – profile SQLite on Linux without code changes

https://github.com/Alurith/sqlitewatch
2•imalessandro•2h ago•0 comments

Show HN: CDXE – Cyber Defence Exercise Environment

https://kryptogram.se/cdxe/
3•kryptogram•2h ago•0 comments

Show HN: CrispVoice – Studio voice enhancement that never uploads your voice

https://github.com/Francium-Tech/CrispVoice
5•bragboy•2h ago•0 comments

Show HN: Temporal Context Map

https://ab.neudice.eu/
3•zebike•3h ago•0 comments

Show HN: Wmux – A workspace multiplexer for AI agents

https://github.com/openwong2kim/wmux
6•wong2kim•5h ago•0 comments

Show HN: Virtual time engine to record HTML to 60fps MP4, no drops

https://zlvox.com/tools/html-to-video
2•mrdisloyal•3h ago•0 comments

Show HN: Crossle – A daily puzzle game where you find 3 intersecting words

https://crossle.resistancelabs.tech
3•samurai4869•3h ago•0 comments

Show HN: I wrote this slowly, a needlessly patient text editor

https://i-wrote-this-slowly.fly.dev/
4•pkoird•3h ago•0 comments

Show HN: Lemmings in HTML in Canvas

https://github.com/VorticonCmdr/lemmings
2•VorticonCmdr•3h ago•2 comments

Show HN: Writemark, a dependency free web component for inline Markdown editing

49•_boffin_•19h ago•19 comments

Show HN: Organic cell simulation with infinite zoom (100k cells, raw WebGL)

https://philomatics.com/cell-game-source/
3•cloogshicer•4h ago•1 comments

Show HN: Registrly – cross-referenced UK company and Global LEI lookup

https://registrly.com
3•solodynamo•4h ago•1 comments

Show HN: SpinWin – A macOS menu bar app to visually rotate or spin any window

https://github.com/alokdhir/spinwin
36•dbm5•22h ago•13 comments

Show HN: Peek – Open social media links without distraction

https://github.com/RtiM0/peek
2•otato_potato•5h ago•0 comments

Show HN: Reproducibility Benchmark a Risk Quantitative Model

https://github.com/Fluxara-GOD/fluxara1-audit-verification-pack
11•mingshi_tz•7h ago•0 comments

Show HN: Echo – Fable-level results at 1/3 the cost using open-weight models

472•adam_rida•2d ago•222 comments

Show HN: Manifest – a cheap fingerprint endpoint for detecting page changes

https://omfang.io/
2•Maxnordstrom•5h ago•0 comments

Show HN: Inflect TTS v2+ONNX, 9M/4M text-to-speech models running in the browser

https://inflect-tts.geronimo-labs.com
5•g58892881•9h ago•2 comments

Show HN: A platformer video game using visual representations of functions

https://function-platformer.vercel.app/
2•dbagr•6h ago•0 comments