Games made with NanoForge. Each one is a project of its own, laid out as
nf new writes it, and opens in the editor (nf editor <folder>).
| Folder | What |
|---|---|
basics/ |
One engine feature each: the smallest game that shows it. |
demos/ |
Small games around one idea (the pong family): local, networked, 3D. |
games/ |
Complete games. |
shared/ |
Components and systems several examples use, copied into each of them. |
| Example | Shows |
|---|---|
basics/input-keyboard |
Keyboard input: two squares moved with the arrows and WASD. |
basics/input-mouse |
Mouse position, clicks and drag. |
basics/input-gamepad |
A controller's stick, buttons and rumble. |
basics/sprite-2d |
Images drawn from the assets folder. |
basics/sound |
Sound effects. |
basics/music |
Music tracks. |
basics/scenes |
Two scenes and their scene vars. |
basics/network |
A client, a game server and a shared protocol library. |
basics/graphics-3d |
A lit, spinning cube in 3D. |
demos/pong |
Pong for two players on one keyboard, with scenes. |
demos/pong-network |
Pong over the network, run by a game server. |
demos/pong-3d |
Pong in 3D, peer to peer, with the same server code. |
games/breakout |
Breakout: menu, three levels, pause and end screens. |
games/flappy-bird |
Flappy Bird. |
games/tic-tac-toe |
Tic-tac-toe for two players. |
games/raid-survival |
A co-op multiplayer zombie survival game. |
cd basics/input-keyboard
pnpm install
pnpm dev # or pnpm build && pnpm start
pnpm editor # open it in the NanoForge editorNode 26 and pnpm 12. The examples depend on the latest NanoForge packages.
- One item per file: each file under
components/holds one component, each file undersystems/one system, each file underscenes/one scene (nested folders included). Types, interfaces and enums that describe the item may sit next to it; any other export is a second item. Items carry the editor's TSDoc tags (@component,@system,@scene,@side). - Shared code is copied, never imported: an example must work on its own once copied out of
this repository. A file at
src/<path>whose<path>exists inshared/<group>/must be an exact copy of it.pnpm checkfails on a copy that drifted;pnpm fixcopies the shared version over it. Change the file inshared/, then runpnpm fix. - The shared files are temporary:
docs/shared-components.mdlists them and the library package that should replace each one.
pnpm install
pnpm lint # prettier + one item per file + shared copies
node --test scripts/check.test.ts # self-test of the checkCI also type-checks and builds every example (.github/workflows/tests.yml).
