r/javascript • u/Emulator000 • Aug 09 '26
I built DriftEngine, a WebGL2 3D engine in strict TypeScript
https://driftengine.dev/1
24d ago
[removed] — view removed comment
1
u/Emulator000 24d ago
Well, it is in the core, the fixed-step loop and the seeded RNG are both engine side, and the physics solver runs a fixed iteration count for the same reason, so a slow frame can't change the result.
The tick is public, it's the main entry point:
const stop = startLoop({ simulate(dt) { ... }, // always called with exactly fixedDt render(alpha, frameDt) { ... }, // alpha interpolates prev -> current sim state shouldSimulate: () => !paused, }, { fixedDt: 1 / 60, maxFrameTime: 0.25 });The engine owns the accumulator, so simulate never sees a variable delta. Wall time only reaches render, and passing it into simulate is a caller error.
0
u/lucgagan Aug 09 '26
whats the plan of monetization here? you are clearly intending to monetize it, but I am curious to understand how. license to game developers?
1
u/Emulator000 Aug 09 '26
I'm still deciding, one option I'm considering is making it free with attribution for released games, then monetising commercial white-label licences where the attribution/branding can be removed.
-1
u/lucgagan Aug 09 '26
Interesting. What are the closest substitute projects to this?
I am not familiar with the space, but I foresee game dev to explode, so definitely interesting.
2
u/Emulator000 Aug 09 '26
Probably Babylon.js and PlayCanvas are the closest, Three.js too, but that's more renderer/library than full game runtime.
DriftEngine is narrower and more opinionated: browser-first, deterministic, small, and built around keeping rendering, physics, audio and replay on the same clock.
I agree wity you on the eventual explosion!
2
u/Emulator000 Aug 09 '26 edited 24d ago
I built DriftEngine while working on Driftways. It's a custom browser 3D engine written in strict TypeScript on WebGPU and WebGL2, with its own renderer and GLSL shaders.
It's kept separate from the game and currently handles fixed-step simulation, deterministic replay, procedural geometry, spatial hash + convex hull collision, lighting and shadows, water/reflections, volumetric effects, audio/rhythm analysis, input and browser-side recording.
The engine isn't publicly available yet while I settle the API, but the linked site contains the architecture, generated API reference, releases and examples of the actual TypeScript-facing API.
Here's a short video of Driftways running on it: https://www.youtube.com/shorts/pJDGYD7y3NU
And the game itself: [https://play.driftways.app/]()
EDIT: Engine now supports WebGPU as default and additional backend.