create-gametau 0.5.0-alpha.2 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,61 +1,64 @@
1
- # create-gametau
2
-
3
- Scaffold a Rust game project for the stable Web (WASM) + Tauri desktop path from one codebase.
4
-
5
- Electrobun is available as an experimental opt-in track and is documented separately: `docs/ELECTROBUN-EXPERIMENTAL.md`.
6
-
7
- ## Quick Start
8
-
9
- ```bash
10
- bunx create-gametau my-game
11
- cd my-game
12
- bun install
13
- bun run dev
14
- ```
15
-
16
- For a step-by-step scaffold-to-playable tutorial (browser and Tauri), see:
17
- [`docs/GETTING-STARTED.md`](../../docs/GETTING-STARTED.md)
18
-
19
- For the experimental Electrobun trial flow, see:
20
- [`docs/ELECTROBUN-EXPERIMENTAL.md`](../../docs/ELECTROBUN-EXPERIMENTAL.md)
21
-
22
- ## Templates
23
-
24
- - `three` (default) - Three.js rendering starter
25
- - `pixi` - PixiJS rendering starter
26
- - `vanilla` - Canvas 2D starter
27
-
28
- ```bash
29
- bunx create-gametau my-game --template pixi
30
- bunx create-gametau my-game --template vanilla
31
- ```
32
-
33
- ## CLI Options
34
-
35
- - `--template`, `-t` - Choose scaffold template (`three`, `pixi`, `vanilla`)
36
- - `--help`, `-h` - Show help output
37
- - `--version`, `-v` - Print CLI version
38
-
39
- ## What gets scaffolded
40
-
41
- - `src-tauri/core` - pure Rust game logic
42
- - `src-tauri/commands` - shared command definitions for desktop + web
43
- - `src-tauri/app` - Tauri desktop shell (stable default desktop runtime)
44
- - `src-tauri/wasm` - WASM entry crate
45
- - `src` - frontend app wired to `webtau` and `webtau-vite`
46
- - `src/services` - production-ready service seams for backend invoke calls, persistence/settings, mission session snapshots, and event-driven comms
47
-
48
- ## Service Layer Contract
49
-
50
- The scaffolded base template now ships a small service architecture instead of a single command wrapper:
51
-
52
- - `src/services/backend.ts` - typed `invoke()` wrappers for gameplay commands
53
- - `src/services/settings.ts` - runtime settings persistence via `webtau/path` + `webtau/fs`
54
- - `src/services/session.ts` - mission/session snapshot persistence via `webtau/path` + `webtau/fs`
55
- - `src/services/comms.ts` - typed alert/comms channel over `webtau/event`
56
- - `src/services/contracts.ts` - interfaces/types for settings, session snapshots, and alerts
57
-
58
- This keeps the generated project lightweight while giving contributors clear extension points for production features.
59
-
60
- For full docs and package details, see the main repository:
61
- <https://github.com/devallibus/gametau>
1
+ # create-gametau
2
+
3
+ Scaffold a Rust game project for the stable Web (WASM) + Tauri desktop path from one codebase.
4
+
5
+ Electrobun is available as an experimental opt-in track see [active milestones](https://github.com/devallibus/gametau/milestones).
6
+
7
+ > Repository note: `docs/` is intentionally local-only and not published in remote history.
8
+
9
+ ## Quick Start
10
+
11
+ ```bash
12
+ bunx create-gametau my-game
13
+ cd my-game
14
+ bun install
15
+ bun run dev
16
+ ```
17
+
18
+ For project status and rollout context, see [active milestones](https://github.com/devallibus/gametau/milestones).
19
+
20
+ ## Templates
21
+
22
+ - `three` (default) - Three.js rendering starter
23
+ - `pixi` - PixiJS rendering starter
24
+ - `vanilla` - Canvas 2D starter
25
+
26
+ ```bash
27
+ bunx create-gametau my-game --template pixi
28
+ bunx create-gametau my-game --template vanilla
29
+ ```
30
+
31
+ ## CLI Options
32
+
33
+ - `--template`, `-t` - Choose scaffold template (`three`, `pixi`, `vanilla`)
34
+ - `--help`, `-h` - Show help output
35
+ - `--version`, `-v` - Print CLI version
36
+
37
+ ## What gets scaffolded
38
+
39
+ - `src-tauri/core` - pure Rust game logic
40
+ - `src-tauri/commands` - shared command definitions for desktop + web
41
+ - `src-tauri/app` - Tauri desktop shell (stable default desktop runtime)
42
+ - `src-tauri/wasm` - WASM entry crate
43
+ - `src` - frontend app wired to `webtau` and `webtau-vite`
44
+ - `src/services` - production-ready service seams for backend invoke calls, persistence/settings, mission session snapshots, and event-driven comms
45
+
46
+ ## Service Layer Contract
47
+
48
+ The scaffolded base template now ships a small service architecture instead of a single command wrapper:
49
+
50
+ - `src/services/backend.ts` - typed `invoke()` wrappers for gameplay commands plus long-running task lifecycle seams (`startWorldProcessing`, `pollWorldTask`, `cancelWorldTask`)
51
+ - `src/services/settings.ts` - runtime settings persistence via `webtau/path` + `webtau/fs`
52
+ - `src/services/session.ts` - mission/session snapshot persistence via `webtau/path` + `webtau/fs`
53
+ - `src/services/comms.ts` - typed alert/comms channel over `webtau/event`
54
+ - `src/services/contracts.ts` - interfaces/types for settings, session snapshots, and alerts
55
+
56
+ Runtime bootstrap is explicit in scaffolded `src/index.ts`:
57
+
58
+ - Tauri path: `bootstrapTauri()` from `webtau/adapters/tauri`
59
+ - Web path: `configure({ loadWasm })` from `webtau`
60
+
61
+ This keeps the generated project lightweight while giving contributors clear extension points for production features.
62
+
63
+ For full docs and package details, see the main repository:
64
+ <https://github.com/devallibus/gametau>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-gametau",
3
- "version": "0.5.0-alpha.2",
3
+ "version": "0.5.0",
4
4
  "description": "Scaffold a Tauri game that deploys to web + desktop",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -11,12 +11,12 @@
11
11
  "preview": "vite preview"
12
12
  },
13
13
  "dependencies": {
14
- "webtau": "^0.5.0-alpha.2"
14
+ "webtau": "^0.5.0"
15
15
  },
16
16
  "devDependencies": {
17
17
  "typescript": "^5.8.0",
18
18
  "vite": "^6.0.0",
19
- "webtau-vite": "^0.5.0-alpha.2",
19
+ "webtau-vite": "^0.5.0",
20
20
  "@tauri-apps/cli": "^2.0.0",
21
21
  "@tauri-apps/api": "^2.0.0"
22
22
  }
@@ -1,4 +1,5 @@
1
1
  import { configure, isTauri } from "webtau";
2
+ import { bootstrapTauri } from "webtau/adapters/tauri";
2
3
  import { startGameLoop } from "./game/loop";
3
4
  import { createSnapshotQueue } from "./game/snapshot-queue";
4
5
  import { initScene, updateScene } from "./game/scene";
@@ -25,8 +26,10 @@ function updateHud(view: WorldView, settings: RuntimeSettings): void {
25
26
  }
26
27
 
27
28
  async function main() {
28
- // Configure webtau for web mode (no-op in Tauri)
29
- if (!isTauri()) {
29
+ // Bootstrap runtime: Tauri (desktop) or WASM (web).
30
+ if (isTauri()) {
31
+ await bootstrapTauri();
32
+ } else {
30
33
  configure({
31
34
  loadWasm: async () => {
32
35
  const wasm = await import("./wasm/{{PROJECT_NAME}}_wasm");
@@ -1,4 +1,6 @@
1
1
  import { invoke } from "webtau";
2
+ import { startTask, pollTask, cancelTask } from "webtau/task";
3
+ import type { TaskState } from "webtau/task";
2
4
 
3
5
  export interface WorldView {
4
6
  score: number;
@@ -9,6 +11,10 @@ export interface TickResult {
9
11
  score_delta: number;
10
12
  }
11
13
 
14
+ export interface ProcessResult {
15
+ processed: number;
16
+ }
17
+
12
18
  export async function getWorldView(): Promise<WorldView> {
13
19
  return invoke<WorldView>("get_world_view");
14
20
  }
@@ -16,3 +22,19 @@ export async function getWorldView(): Promise<WorldView> {
16
22
  export async function tickWorld(): Promise<TickResult> {
17
23
  return invoke<TickResult>("tick_world");
18
24
  }
25
+
26
+ // ── Long-running task seam ──────────────────────────────────────────────────
27
+ // Reference flow proving non-blocking start/poll/cancel behavior for heavy
28
+ // backend operations across web (WASM) and desktop (Tauri) runtimes.
29
+
30
+ export async function startWorldProcessing(args: { batchSize: number }): Promise<string> {
31
+ return startTask<ProcessResult>("process_world_batch", args);
32
+ }
33
+
34
+ export async function pollWorldTask(taskId: string): Promise<TaskState<ProcessResult>> {
35
+ return pollTask<ProcessResult>(taskId);
36
+ }
37
+
38
+ export async function cancelWorldTask(taskId: string): Promise<void> {
39
+ return cancelTask(taskId);
40
+ }
@@ -5,7 +5,7 @@ edition.workspace = true
5
5
 
6
6
  [dependencies]
7
7
  {{PROJECT_NAME}}-core = { path = "../core" }
8
- webtau = "0.5.0-alpha.2"
8
+ webtau = "0.5.0"
9
9
 
10
10
  [target.'cfg(not(target_arch = "wasm32"))'.dependencies]
11
11
  tauri = { version = "2", features = [] }
@@ -11,7 +11,7 @@ wasm-bindgen = "0.2"
11
11
  serde = { version = "1", features = ["derive"] }
12
12
  serde-wasm-bindgen = "0.6"
13
13
  getrandom = { version = "0.2", features = ["js"] }
14
- webtau = "0.4.0"
14
+ webtau = "0.5.0"
15
15
  {{PROJECT_NAME}}-core = { path = "../core" }
16
16
  {{PROJECT_NAME}}-commands = { path = "../commands" }
17
17
 
@@ -12,12 +12,12 @@
12
12
  },
13
13
  "dependencies": {
14
14
  "pixi.js": "^8.0.0",
15
- "webtau": "^0.4.0"
15
+ "webtau": "^0.5.0"
16
16
  },
17
17
  "devDependencies": {
18
18
  "typescript": "^5.8.0",
19
19
  "vite": "^6.0.0",
20
- "webtau-vite": "^0.4.0",
20
+ "webtau-vite": "^0.5.0",
21
21
  "@tauri-apps/cli": "^2.0.0",
22
22
  "@tauri-apps/api": "^2.0.0"
23
23
  }
@@ -12,13 +12,13 @@
12
12
  },
13
13
  "dependencies": {
14
14
  "three": "^0.172.0",
15
- "webtau": "^0.4.0"
15
+ "webtau": "^0.5.0"
16
16
  },
17
17
  "devDependencies": {
18
18
  "@types/three": "^0.172.0",
19
19
  "typescript": "^5.8.0",
20
20
  "vite": "^6.0.0",
21
- "webtau-vite": "^0.4.0",
21
+ "webtau-vite": "^0.5.0",
22
22
  "@tauri-apps/cli": "^2.0.0",
23
23
  "@tauri-apps/api": "^2.0.0"
24
24
  }