Move away from browser as a main plataform
This commit is contained in:
@@ -16,7 +16,8 @@ Always ask before making even the simplest models, unless it's coming from ports
|
||||
## Layout
|
||||
|
||||
- `server/`: the game server, world, saves and server-side game logic
|
||||
- `client/`: the browser client: rendering, meshing and lighting workers, UI
|
||||
- `client/`: the client: rendering, meshing and lighting workers, UI. `client/native/` runs it in the desktop app
|
||||
- `desktop/`: the desktop app: its window, sound, singleplayer and client updates (see "Desktop first")
|
||||
- `common/`: code shared by both, including world generation, the protocol and the modding API (`common/mod_api/`)
|
||||
- `mods/`: mods, with JSON data (blocks, items, recipes, worldgen, tags), textures and TypeScript scripts
|
||||
- `docs/`: modding docs and `docs/modding_plan.md`
|
||||
@@ -33,6 +34,8 @@ deno test -A tests/door_test.ts # one test file, prefer this while working
|
||||
deno task check-mods # validate and typecheck every mod in mods/
|
||||
deno task build # pack mods and build the client, then keeps rebuilding on changes
|
||||
deno task server # start a server with the mods from the last build
|
||||
deno task desktop # run the desktop app with what the last build made
|
||||
deno task compile [linux] [windows] # build the desktop app's executables into dist/
|
||||
deno fmt # format (tabs, 120 columns), applies to JSON too
|
||||
deno task import KIND IN --output OUT # convert a java mod's resources, see tools/importer.ts
|
||||
```
|
||||
@@ -50,6 +53,24 @@ engine, since other mods would hit the same wall. See "The Engine and the Base G
|
||||
When changing the modding API, update the docs that cover it: `MODS.md` and `docs/modding/`, which follows the layout of
|
||||
`ports/neoforge-docs`.
|
||||
|
||||
## Desktop first
|
||||
|
||||
The desktop app is the main target and the browser a secondary one, so build and try new features in the desktop app
|
||||
first. The app (`desktop/`) is an SDL3 window that the client draws into with Deno's WebGPU, running in a Deno worker
|
||||
(`client/native/`), with sound through OpenAL Soft and a singleplayer server of its own.
|
||||
|
||||
- The client keeps using web APIs: WebGPU, Web Audio, fetch, WebSocket. Where Deno doesn't have one, polyfill the part
|
||||
the game uses, like `client/native/web_audio.ts` does over OpenAL, instead of writing engine code only the desktop app
|
||||
can run.
|
||||
- What has to differ between the two goes through `Platform` (`client/platform.ts`), which `client/browser_platform.ts`
|
||||
and `client/native/main.ts` implement, rather than checks for the DOM in shared code.
|
||||
- Keep the browser working, but a browser limitation doesn't block a feature: it can be missing or simpler there.
|
||||
- The client worker runs servers' mods, so it only gets the network and reading its own files, and gives up FFI once the
|
||||
window's surface exists. Don't widen its permissions.
|
||||
- The Windows build ships SDL3 and OpenAL Soft from `desktop/windows/`: unmodified files from their tagged releases,
|
||||
with their licenses and where they came from in `credits.txt` there, which the app shows in its credits. Update it
|
||||
along with the DLLs.
|
||||
|
||||
## Conventions
|
||||
|
||||
- Classes are PascalCase, everything else is snake_case: functions, variables, fields, files and ids.
|
||||
|
||||
Reference in New Issue
Block a user