Skip to content

feat: genre starters for asobi init --template#40

Merged
Taure merged 1 commit into
mainfrom
feat/init-genre-templates
Jul 18, 2026
Merged

feat: genre starters for asobi init --template#40
Taure merged 1 commit into
mainfrom
feat/init-genre-templates

Conversation

@Taure

@Taure Taure commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

What

Adds local genre starters to asobi init --template alongside the existing engine demos:

--template Result
arena Real-time movement + server-owned combat (shoot the nearest enemy in range)
chat A real-time chat room; messages are relayed by the server so the author can't be forged
turn-based Two players alternate claiming cells on a 3x3 board; out-of-turn / duplicate moves rejected server-side
world A persistent shared world (game_type = "world", the world-bridge callbacks)
(none) / basic The existing minimal movement starter
defold / godot / unity / backend Unchanged - still fetch the full demo repo

Each genre scaffolds a runnable lua/match.lua shaped for that style of game, so a first-timer picks a genre and gets working, genre-appropriate server Lua - offline and instantly.

How

  • Templates are embedded files (go:embed) under internal/scaffold/templates/<genre>/, not Go string consts, so the Lua stays real and luac-checkable.
  • scaffold.Init(dir, genre) walks the genre's embedded tree; Genres() / IsGenre() back the help and error messages.
  • cmdInit routes a genre name to the local scaffold and an engine name to the remote fetch; an unknown name errors listing both sets.
  • init next-steps now lead with asobi dev (run locally, no login) before the deploy sequence.

Every genre's callback surface is grounded in the real asobi_lua bridges: match modes define init/join/leave/handle_input/tick/get_state; the world mode uses spawn_position/zone_tick/handle_input(entities)/post_tick. All five match.lua files pass luac -p.

Tests

go build, go vet, gofmt -l, and go test ./... all green. New tests cover the default scaffold, overwrite refusal, unknown-genre error, and a table test asserting every genre scaffolds a lua/match.lua with its bridge's required callbacks plus a README that runs and deploys.

Extend `asobi init --template` with local genre starters
(arena, chat, turn-based, world) alongside the existing engine
demos. A genre scaffolds a runnable lua/match.lua shaped for that
style of game - real-time movement + combat, a chat room,
server-enforced turn order, or a persistent world - so a first-timer
picks a genre and gets working, genre-appropriate server Lua offline
and instantly.

Templates are embedded files (go:embed) rather than Go string consts,
so the Lua stays real and luac-checkable. The default `asobi init`
still scaffolds the basic starter; init now leads its next-steps with
`asobi dev` to run locally before deploying.
@Taure
Taure merged commit ae6665c into main Jul 18, 2026
1 check passed
@Taure
Taure deleted the feat/init-genre-templates branch July 18, 2026 08:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant