void is a 2D game and app engine for web browsers featuring:
- all game code in Go Wasm.
- fast loading.
- few dependencies.
- selective update for lo energy idle.
- compilation to a single standalone HTML file.
- text, nine-patch, and button primitives for basic UI.
all system packages start with "v" such as vents for "void ents".
see the agent file.
src/void/: game engine.src/cmd/: command line utils for building void apps.src/demo/: engine demonstration.
ents are a single data and behavior instance. hooks operate on an ents of a kind efficiently.
ents with an update hook return whether they have been updated and so request a new frame. this is important lo energy apps.
see the agent skill.
- Aseprite
- cwebp
debug make with V=1 make --jobs=1.
make debug builds with DEBUG=1 make.
an example of a playwright test that takes a screenshot and verifies no console logs:
import { expect, test } from '@playwright/test'
const logs: string[] = []
test.beforeEach(async ({ page }) => {
logs.length = 0;
await page.addInitScript(() => {
addEventListener('error', (ev) =>
console.error(`[window.error] ${ev.error instanceof Error ? ev.error. message : ev.error}`)
)
addEventListener('unhandledrejection', (ev) =>
console.error(`[window.unhandledrejection] ${ev.reason instanceof Error ? ev.reason.message : ev.reason}`)
)
})
page.on('console', onConsole)
page.on('pageerror', onPageError)
})
test.afterEach(async ({ page }) => {
page.off('console', onConsole)
page.off('pageerror', onPageError)
expect(logs, logs.join('\n')).toStrictEqual([])
})
test('test', async ({page}) => {
await page.goto('http://localhost:1234/')
await page.locator('canvas').click({position: {x: 123, y: 456}})
await expect(page.locator('canvas')).toBeVisible()
await expect(page).toHaveScreenshot('load.png', {maxDiffPixelRatio: .01})
})
function onConsole(msg: { type(): string; text(): string }) {
if (msg.type() === 'debug') return
logs.push(`[console.${msg.type()}] ${msg.text()}`)
}
function onPageError(err: unknown) {
logs.push(`[pageerror] ${String(err instanceof Error ? err.stack || err. message : err)}`)
}© oidoid.
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. If not, see https://www.gnu.org/licenses/.
╭>°╮┬┌─╮╭─╮┬┌─╮
╰──╯┴└─╯╰─╯┴└─╯