Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Monthly updates, grouped into one pull request per ecosystem.
# Actions are pinned to commit SHAs: Dependabot bumps the SHA and the version comment together.
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: monthly
groups:
actions:
patterns: ["*"]
commit-message:
prefix: ci
- package-ecosystem: npm
directory: /
schedule:
interval: monthly
groups:
npm:
patterns: ["*"]
commit-message:
prefix: deps
22 changes: 22 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: CI

on:
push:
branches: [main]
pull_request:

permissions:
contents: read

jobs:
smoke:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: 22
cache: npm
- run: npm ci
- run: npx playwright install --with-deps chromium
- run: npm test
34 changes: 34 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Advanced CodeQL setup: the game's code is inline in index.html, so GitHub's default setup sees no
# JavaScript and only scans the workflows. The JavaScript extractor reads scripts inside HTML files.
name: CodeQL

on:
push:
branches: [main]
pull_request:
branches: [main]
schedule:
- cron: "17 4 * * 1"

permissions:
contents: read

jobs:
analyze:
runs-on: ubuntu-latest
permissions:
security-events: write
actions: read
strategy:
fail-fast: false
matrix:
language: [actions, javascript-typescript]
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
- uses: github/codeql-action/init@4bfa242aa49c5f7c6770b98670d354a7dfac05f8 # v3.39.1
with:
languages: ${{ matrix.language }}
build-mode: none
- uses: github/codeql-action/analyze@4bfa242aa49c5f7c6770b98670d354a7dfac05f8 # v3.39.1
with:
category: /language:${{ matrix.language }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules/
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Changelog

All notable changes to The Locked World. The game is served from `main` at https://solidgeeks.github.io/lockedworld/: every change merged there is live, so entries are dated rather than versioned.

## 2026-10-25 — Solid standard

### Added
- Smoke test (`npm test`): the game loads, and each of the 10 levels starts and runs without a JavaScript error. CI runs it on every push and pull request.
- CodeQL now scans the game's code (inline in `index.html`), not only the workflows.
- README in English, with the level names as they appear in the game; AGPL-3.0 license, `SECURITY.md`, first-merge card for new contributors.

### Fixed
- Brand colour: Volt is `#C8FF2E`, as in the logo kit (was `#c8f520`).
- The GitHub link points at github.com/SolidGeeks.

## 2026-10-25 — first release

### Added
- Ten levels, each with its own mechanic and a teammate to win: fog and rescue, wave arena, escort, stealth, defence and boss, newcomers to protect, license ammo, packet routing, vertical scrolling, chase.
- Keyboard and mouse controls, two-thumb touch controls, sound synthesized with Web Audio, progress saved in the browser.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,16 @@ One `index.html` file, no build step, no dependencies: Canvas 2D, sound synthesi

To try it locally: open `index.html` in a browser, or run `python3 -m http.server` in this folder and go to http://localhost:8000.

To run the tests (Node.js 22 or later; the game itself needs nothing, Playwright is only for the tests):

```bash
npm install
npx playwright install chromium # once
npm test # the game loads, and each of the 10 levels starts and runs without an error
```

Changes are listed in [CHANGELOG.md](CHANGELOG.md).

## Contributing

Contributions follow the [Solid standard](https://github.com/SolidGeeks/.github/blob/main/CONTRIBUTING.md): sign off every commit with `git commit -s` (DCO), no CLA. The code is licensed [AGPL-3.0-or-later](LICENSE). To report a vulnerability, see [SECURITY.md](SECURITY.md).
45 changes: 45 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "lockedworld",
"version": "1.0.0",
"private": true,
"description": "The Locked World: a ten-level top-down shooter that runs in the browser.",
"license": "AGPL-3.0-or-later",
"repository": "github:SolidGeeks/lockedworld",
"type": "module",
"scripts": {
"test": "node --test tests/smoke.test.mjs"
},
"devDependencies": {
"playwright": "^1.49.0"
}
}
56 changes: 56 additions & 0 deletions tests/smoke.test.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
// Smoke test: the game loads, and each of the 10 levels starts and runs for a few seconds without a JavaScript error.
// Run with: npm test (needs a browser once: npx playwright install chromium)
import { test, before, after } from 'node:test';
import assert from 'node:assert/strict';
import { readFileSync } from 'node:fs';
import { join, dirname } from 'node:path';
import { fileURLToPath, pathToFileURL } from 'node:url';
import { chromium } from 'playwright';

const root = join(dirname(fileURLToPath(import.meta.url)), '..');
const page_url = pathToFileURL(join(root, 'index.html')).href;
// The game runs inside an IIFE. Serve it with one extra line that exposes its state to the test; index.html is not changed.
const html = readFileSync(join(root, 'index.html'), 'utf8');
const end = html.lastIndexOf('})();');
assert.ok(end > 0, 'the game script ends with })();');
const served = html.slice(0, end) + 'window.__LW = { game, LEVELS, startLevel };\n' + html.slice(end);

let browser, page;
const errors = [];

before(async () => {
browser = await chromium.launch();
page = await browser.newPage({ viewport: { width: 1280, height: 800 } });
page.on('pageerror', e => errors.push(e.message));
await page.route(page_url, r => r.fulfill({ body: served, contentType: 'text/html; charset=utf-8' }));
await page.goto(page_url);
await page.waitForFunction(() => window.__LW);
});
after(async () => { await browser?.close(); });

test('the game loads on its title screen, without errors', async () => {
assert.equal(await page.evaluate(() => window.__LW.game.state), 'title');
assert.equal(await page.evaluate(() => window.__LW.LEVELS.length), 10);
assert.match(await page.title(), /The Locked World/);
assert.deepEqual(errors, []);
});

for (let i = 0; i < 10; i++) {
test(`level ${i + 1} starts and runs`, async () => {
errors.length = 0;
const name = await page.evaluate(n => { window.__LW.startLevel(n); return window.__LW.LEVELS[n].name; }, i);
// Play a little: move and hold fire, so the level's update and drawing code actually run
await page.mouse.move(900, 300);
await page.mouse.down();
await page.keyboard.down('d');
await page.waitForTimeout(2500);
await page.keyboard.up('d');
await page.mouse.up();
const s = await page.evaluate(() => ({ state: window.__LW.game.state, idx: window.__LW.game.idx, lt: window.__LW.game.lt }));
assert.deepEqual(errors, [], `${name}: JavaScript error`);
assert.equal(s.idx, i, `${name}: wrong level`);
assert.ok(['intro', 'play', 'clear', 'dead'].includes(s.state), `${name}: unexpected state ${s.state}`);
assert.ok(s.lt > 0, `${name}: the level clock does not advance`);
});
}
Loading