2026-06-12 08:19:40 -05:00
# Throne of the Bone King
2026-06-06 09:27:30 -05:00
2026-06-12 08:19:40 -05:00
React Native game shell for the Bone Lord Bob universe. The current app shares one React Native UI layer across browser, Electron, and future native mobile targets.
2026-06-06 09:27:30 -05:00
2026-06-12 08:19:40 -05:00
The project is in early development. The main working surface is a landscape-first menu and toolkit scaffold with persisted settings, route persistence, background music, policy/credits pages, and a browser-only Toolkit backed by a local Socket.IO server.
2026-06-06 09:27:30 -05:00
2026-06-12 08:19:40 -05:00
## Current Targets
2026-06-06 09:27:30 -05:00
2026-06-12 08:19:40 -05:00
- Browser: Vite + React Native Web at `http://127.0.0.1:5173`
- Electron: Vite renderer plus compiled Electron main/preload files
- Native mobile: React Native 0.85.3 source is present, but `android/` and `ios/` are not currently in this checkout
- Toolkit: browser-only support surface gated by the Browser resolution setting and an active socket connection
2026-06-06 09:27:30 -05:00
2026-06-12 08:19:40 -05:00
## Requirements
2026-06-06 09:27:30 -05:00
2026-06-12 08:19:40 -05:00
- Node `>=22.12.0`
- npm
- Native mobile toolchains only when `android/` or `ios/` are restored or generated
2026-06-06 09:27:30 -05:00
2026-06-12 08:19:40 -05:00
## Install
2026-06-06 09:46:38 -05:00
2026-06-12 08:19:40 -05:00
``` bash
npm install
```
2026-06-06 09:27:30 -05:00
2026-06-12 08:19:40 -05:00
## Development
2026-06-06 09:27:30 -05:00
2026-06-12 08:19:40 -05:00
``` bash
npm run web
```
2026-06-06 09:27:30 -05:00
2026-06-12 08:19:40 -05:00
Starts the Vite browser app on `http://127.0.0.1:5173` .
2026-06-06 09:46:38 -05:00
2026-06-12 08:19:40 -05:00
``` bash
npm run dev:toolkit
2026-06-06 09:27:30 -05:00
```
2026-06-12 08:19:40 -05:00
Starts the local Toolkit socket server on `http://127.0.0.1:5174` .
2026-06-06 09:46:38 -05:00
2026-06-12 08:19:40 -05:00
``` bash
npm run dev:all
```
2026-06-06 09:46:38 -05:00
2026-06-12 08:19:40 -05:00
Starts both the Vite app and Toolkit socket server.
2026-06-06 09:46:38 -05:00
2026-06-12 08:19:40 -05:00
``` bash
npm run dev:clear
2026-06-06 09:27:30 -05:00
```
2026-06-06 09:46:38 -05:00
2026-06-12 08:19:40 -05:00
Attempts to stop the related local dev processes if a previous run hangs.
## Build Commands
2026-06-06 09:46:38 -05:00
2026-06-12 08:19:40 -05:00
``` bash
npm run web:build
npm run web:preview
npm run electron:build
npm run electron:dev
npm run electron:package
2026-06-06 09:46:38 -05:00
```
2026-06-12 08:19:40 -05:00
`electron:build` builds the web renderer into `dist/renderer/` and compiles Electron process files into `dist/electron/` .
2026-06-06 09:46:38 -05:00
2026-06-12 08:19:40 -05:00
## Validation
2026-06-06 09:46:38 -05:00
2026-06-12 08:19:40 -05:00
``` bash
npm run lint
npm run test -- --runInBand
npm run web:build
npm run electron:build
2026-06-06 09:46:38 -05:00
```
2026-06-12 08:19:40 -05:00
Husky runs `npm run validate:commit` on commit. That command runs lint, Jest, and the Electron build path.
## App Structure
``` text
App.tsx # Safe area, status bar, viewport, navigator root
src/navigation/ # Route metadata and lightweight app-state navigator
src/screens/ # Home, Settings, Policies, Toolkit, generic pages
src/components/ # Shared React Native UI primitives
src/state/ # Zustand stores and persistence adapters
src/settings/ # Resolution and audio setting definitions
src/hooks/ # Background music and socket connection hooks
src/socket/ # Browser client for Toolkit socket content sync
socket/ # Local Socket.IO Toolkit server
src/data/ # Canonical editable JSON content such as credits
src/assets/ # Images, fonts, music, and SCSS entrypoints
electron/ # Electron main and preload source
```
## State and Persistence
2026-06-06 09:46:38 -05:00
2026-06-12 08:19:40 -05:00
The app uses Zustand. Route state, game settings, and Toolkit content state are separate stores.
2026-06-06 09:46:38 -05:00
2026-06-12 08:19:40 -05:00
- Native persistence adapter: `src/state/persistStorage.ts`
- Web/Electron persistence adapter: `src/state/persistStorage.web.ts`
- Shared persist helper: `src/state/createPersistOptions.ts`
- Game settings persist key: `blb-game-settings`
- Navigation persist key: `blb-navigation`
2026-06-06 09:46:38 -05:00
2026-06-12 08:19:40 -05:00
Game settings currently include:
2026-06-06 09:46:38 -05:00
2026-06-12 08:19:40 -05:00
- resolution: `browser` , `iphoneMini` , `iphoneDefault` , `androidDefault` , `phoneLarge`
- autosave
- audio mute
- master, music, ambience, speech, and SFX volume
2026-06-06 09:46:38 -05:00
2026-06-12 08:19:40 -05:00
## Toolkit
2026-06-06 09:46:38 -05:00
2026-06-12 08:19:40 -05:00
Toolkit access is intentionally limited:
2026-06-06 09:46:38 -05:00
2026-06-12 08:19:40 -05:00
- resolution must be set to `Browser`
- socket status must be connected
- socket server runs with `npm run dev:toolkit`
2026-06-06 09:46:38 -05:00
2026-06-12 08:19:40 -05:00
The Toolkit currently contains read-only planning panels for volatile gameplay systems, plus a dedicated Credits tab. Credits content is sourced from `src/data/credits.json` and synchronized through socket events for read, save, change broadcast, and refresh recovery.
2026-06-06 09:46:38 -05:00
2026-06-12 08:19:40 -05:00
Socket health check:
``` bash
curl http://127.0.0.1:5174/health
```
2026-06-06 09:46:38 -05:00
2026-06-12 08:19:40 -05:00
## Assets
2026-06-06 09:46:38 -05:00
2026-06-12 08:19:40 -05:00
Image assets live in `src/assets/images/` . Fonts live in `src/assets/fonts/` . Music lives in `src/assets/music/` . Browser SCSS entrypoints live in `src/assets/scss/` .
2026-06-06 09:46:38 -05:00
2026-06-12 08:19:40 -05:00
The browser favicon is `src/assets/images/favicon.svg` .
2026-06-06 09:46:38 -05:00
2026-06-12 08:19:40 -05:00
## Native Mobile Notes
2026-06-06 09:46:38 -05:00
2026-06-12 08:19:40 -05:00
The shared UI is React Native and should remain native-compatible. Do not introduce DOM APIs into shared `src/` code. Browser-only APIs belong in `.web.ts` files or `src/web/` .
2026-06-06 09:46:38 -05:00
2026-06-12 08:19:40 -05:00
When native folders are restored, native dependency setup such as CocoaPods should be handled in the platform folders at that time.