Skip to content

Building, tests & screenshots ​

Layout ​

fxmanifest.lua               globs only: a new game is one file in shared/games and one folder in web/src/games
shared/lib/                  00 namespace + game registry · 01 xorshift32 rng · 02 util + answer sanitisers
                             03 engine (resolve / build / judge / grade) · 04 locale · 05 ox_lib compat · 06 lifecycle bus
shared/config/*.lua          Config: core, games, phone
shared/games/<id>.lua        one file per game: params, difficulties, make, verify, limits, demo
shared/np_admin_settings.lua np_admin Resource settings (also the schema np_admin reads while np_minigames is stopped)
bridge/np_admin.lua          np_admin lib, vendored byte-identical
bridge/framework/server/     identifier + name: esx > qbx > qb > standalone (np_character on standalone)
bridge/inventory/server/     opts.item: np_inventory > ox > qb > esx / qbx / qb > none
integrations/*.lua           one adapter per np_* sibling (np_phone, np_phone_app, np_hud, np_menu, np_character)
server/core/                 init · rpc · sessions · team · stats · admin · arcade · api · items · profiles
client/core/                 state · nui · rpc · play · api · arcade · fx
web/                         Vite + React + zustand NUI (index.html) and the phone app (phone.html)
web/design/                  Nimbus UI tokens and CSS, never edited
sql/np_minigames.sql
tests/                       plain-Lua harness and suites, fixtures and docs generators

Everything under shared/lib and shared/games is plain Lua without natives: the server runs it for authoritative sessions, the client for local ones, and the test harness runs it too.

Build ​

sh
cd web
npm ci
npm run build          # FiveM guard check + tsc --noEmit + vite build → web/dist/index.html, web/dist/phone.html
npm test               # vitest: Lua ⇄ TypeScript parity and the game logic
npm run dev            # browser gallery
npm run screenshots    # headless Chrome → web/screenshots/*.png

npm run build first runs scripts/check-fivem-guard.mjs: in FiveM a blurred surface renders as a black box over the game, so the HTML marks itself as running in FiveM before the first paint and the CSS turns backdrop-filter off there. The guard fails the build when that rule is missing.

npm run dev runs the UI without FiveM, with fixtures from the Lua game files. URL parameters pick a view:

Parameter Values
game a game id; with d=<difficulty> (easy … expert) and still for a still frame
arcade the practice arcade (shot for screenshots)
list every game id
locale de
material liquid

npm run screenshots renders every game at medium and expert, the arcade (also in German and with Liquid Glass) and the phone app at 1920 × 1080 into web/screenshots/. The screenshots on these pages come from there.

Tests ​

sh
bash tests/run.sh             # luac -p on every Lua file, the games / server / client / compat suites,
                              # then the NUI fixtures and the generated GAMES.md
VERBOSE=1 bash tests/run.sh   # with resource log lines
cd web && npm test            # Lua ⇄ TypeScript parity
  • games: every game × 4 difficulties × 8 seeds; the demo answer wins, junk answers are handled, the limits hold.
  • server / client: sessions, timing checks, cancel paths, team games, chains, the arcade, hooks.
  • compat: profiles and receipts, items on every inventory bridge, progress, the sibling adapters.
  • parity: the TypeScript judges give the same verdict as the Lua ones on the generated fixtures.

The param tables on the games pages are generated by tests/gen_docs.lua from the game files.

Adding a game ​

  1. Write shared/games/<id>.lua with NpMini.defineGame{ … }: params with ranges and scales, four difficulties, make, verify, limits and a winning demo.
  2. Write web/src/games/<id>/index.tsx exporting defineGame({ id, Component, layout, strings, judge }), with the pure logic in logic.ts and the styles in <id>.css.
  3. Add Config.Games.<id> in shared/config/10_games.lua.
  4. Run bash tests/run.sh, then cd web && npm test and bash scripts/screenshots.sh <id>.

The manifest and the registries pick the new files up through globs.