Skip to content

DopamineJS

A game-feel engine for HTML5 games. Particles, sound, screen shake, XP and achievements: the layer that separates a game that works from a game that feels good.

npm install dopaminejscopy

The problem

You can build a game that is mechanically correct and completely joyless.

The difference is the feedback layer, the thing game developers call juice: the particle burst on a hit, the little screen shake, the sound that lands on the beat, the number that pops up and floats away, the level-up. It is what makes an action feel like it mattered.

Nobody ships that layer. You build it by hand, every time, by gluing together a particle system, a Web Audio wrapper and a progression system that you also wrote.

DopamineJS is that layer, packaged.

What it does

javascript
import { Game } from 'dopaminejs';
import { WebGLParticlePlugin } from 'dopaminejs-plugins';
import { themeEngine } from 'dopaminejs-themes';

const game = new Game();
game.kernel.plugins.use(WebGLParticlePlugin);
themeEngine.setTheme('dark-cyberpunk');
game.start();
  • Plugin architecture built on a kernel, an event bus, and a system registry.
  • Batteries included: Canvas particles, Web Audio, basic physics.
  • A reward system: XP, levels, achievements.
  • Official plugins for Howler audio, WebGL particles (ten thousand of them), a battle pass, and leaderboard sync.
  • Five themes, driven by CSS variables.

Try it

Dopa-Dopa is a chicken escaping farmers. It is a real game, playable in the browser, and it exists to prove the engine end to end: component game objects, scene management, a fixed-timestep loop, WebGL particle bursts on jump and death, the retro theme, and the reward system. It is MIT, so it also works as a template for your own.

The plugin API and theme system on GitHub →

Brewed in the baryo ☕ · Released under the MIT License.