Gamedoy docs

A minimalistic fantasy console, kinda like a gameboy, for the web.

Named after Cowdoy

Demo →


Gamedoy is a fun little fantasy console for the web to make little games in a gameboy-like container. One of the projects I'm using it for is a captive portal at work which brings up a game to play when you join the wifi.


Setup a HTML document like kinda this:

<!DOCTYPE html>
<title>🎮 Gamedoy</title>
<meta charset="utf8" />
<meta name="viewport" content="width=device-width" />
<gamedoy-console id="app"></gamedoy-console>
<script type="module" src="./script.js"></script>

With a script next to it like this:

import { Gamedoy, bootScene } from ''
import * as helloWorld from './my-scene.js'

async function main() {
// Setup Gamedoy and grab the custom element
const gamedoy = Gamedoy.setup({ el: '#app' })




Next, let's create a our scene, my-scene.js:

export function setup({ disposables, setDisplay, finish, controls }) {
// Create a canvas to draw to
const canvas = create2dCanvas(400, 400)

// Add the screen and listen for "A" presses
// store the disposable to remove again after the scene finishes
controls.onKeyUp('A', () => finish())

// Draw some text
canvas.ctx.font = '42px Pixeboy'
canvas.ctx.textAlign = 'center'
canvas.ctx.fillStyle = 'white'
canvas.ctx.fillText('Hello, world!', 200, 150)

Then serve your HTML over HTTP and visit it in your web browser.

# e.g. using
npx serve .