feat: Adding audio player + music to play
This commit is contained in:
@@ -22,18 +22,23 @@ Without Docker (Go 1.23+):
|
||||
go run ./server # PORT=3000 go run ./server to pick a port
|
||||
```
|
||||
|
||||
There is nothing to configure: no database, no environment variables except the optional `PORT`. Saves live in the player's browser (`localStorage`), with three manual slots and export/import as text.
|
||||
There is nothing to configure: no database, and no environment variables except the optional `PORT` and `MUSIC_DIR`. Saves live in the player's browser (`localStorage`), with three manual slots and export/import as text.
|
||||
|
||||
## Music
|
||||
|
||||
The cassette player on the desk plays the `.mp3` files of [music/](music/) in random order (keys: previous, play, pause, stop, next). Drop files in that folder and reload the page: no rebuild, because Docker mounts the folder read-only and the server lists it live. File names become the titles (`03_Evening_Report.mp3` shows as "Evening Report"). `placeholder.mp3` is an empty file that is ignored. Without Docker the server reads `./music`, or the folder in `MUSIC_DIR`. Each sound effect and the music have their own slider under **Menu → Settings → Sound mixer**.
|
||||
|
||||
## Stack
|
||||
|
||||
- **Server:** Go, standard library only. It serves the files under `web/` (embedded in the binary) and `/healthz`. No game logic runs on the server.
|
||||
- **Game:** vanilla JavaScript ES modules and CSS. No framework, no bundler, no npm, no runtime dependency. Charts are hand-drawn SVG, sounds are synthesised with the Web Audio API, fonts are bundled (OFL).
|
||||
- **Server:** Go, standard library only. It serves the files under `web/` (embedded in the binary), the music folder and `/healthz`. No game logic runs on the server.
|
||||
- **Game:** vanilla JavaScript ES modules and CSS. No framework, no bundler, no npm, no runtime dependency. Charts are hand-drawn SVG, sound effects are synthesised with the Web Audio API (no audio files), fonts are bundled (OFL).
|
||||
- **Image:** multi-stage build into `gcr.io/distroless/static` (a few MB).
|
||||
|
||||
## Folders
|
||||
|
||||
```
|
||||
server/ Go entry point (main.go) and the content tests (*_test.go)
|
||||
server/ Go entry point (main.go: static files, music folder, health check) and the tests (*_test.go)
|
||||
music/ your .mp3 files for the cassette player (mounted into the container)
|
||||
web/
|
||||
embed.go go:embed of everything below
|
||||
index.html the page
|
||||
@@ -45,7 +50,7 @@ web/
|
||||
engine/ the game rules: pure functions, no DOM, no network (state, economy, sectors,
|
||||
indicators, cards, gameover, score, world, projection, validate...)
|
||||
ui/ DOM panels: dashboard, decision (the tray), calendar (dial clock), ledger, newspaper,
|
||||
telegram, endgame, menu, shelf (phone), audio, markdown
|
||||
telegram, endgame, menu, shelf (phone), walkman, audio, music, markdown
|
||||
save/ save codec (CG1:<crc>:<base64>) with migrations, and storage with fallbacks
|
||||
i18n/ interface strings, en.json and fr.json
|
||||
data/
|
||||
|
||||
Reference in New Issue
Block a user