What is Goodluck?

Goodluck is a template for creating small browser games which fit in a few kilobytes. It's designed for extreme hackability.

A template

Goodluck is a bit unusual in that it's not a typical library; you don't import code from it to use in your project. Instead, Goodluck is a repository template — generate a new repository from it, remove the code you don't need, and hack away. This comes in handy when optimizing code for size (see below), or when you just need to hardcode something one day before the deadline.

Entity-Component-System

Goodluck implements the ECS architecture.

The ECS architecture is all about composition over inheritance. Components can be added, removed, and re-added dynamically during the entity's lifetime. You can mix and match different behaviors without worrying about pulling in too much logic from a superclass. As the project grows, the behaviors continue to be well isolated from each other. The ease of adding new behaviors to existing entities makes it easy and pleasant to experiment with new gameplay ideas.

Few abstractions

The key insight of Goodluck is that abstractions, generalizations, and parametrization are responsible for a lot of cruft in the code. And so, one of the design principles is to write simple, unsurprising code. Systems are just functions with a for loop which iterates over all entities in the scene. The code is not designed for extension in the future. The goal is to ship a game rather than build a generic engine. This "simple" JavaScript has the benefit of usually being very fast in terms of the execution speed, which can make a difference in performance-sensitive apps, like games.


Goodluck and ECS are by no means perfect. It's helpful to understand their limitations and challenges they come with.

Why not ECS?

Why not Goodluck?