create-gametau 0.5.0-alpha.1 → 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 +64 -61
- package/package.json +1 -1
- package/templates/base/package.json +2 -2
- package/templates/base/src/index.ts +5 -2
- package/templates/base/src/services/backend.ts +22 -0
- package/templates/base/src-tauri/commands/Cargo.toml +1 -1
- package/templates/base/src-tauri/wasm/Cargo.toml +1 -1
- package/templates/pixi/package.json +2 -2
- package/templates/three/package.json +2 -2
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
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
- `
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
- `--
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
- `src-tauri/
|
|
42
|
-
- `src-tauri/
|
|
43
|
-
- `src
|
|
44
|
-
- `src
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
- `src/services/
|
|
53
|
-
- `src/services/
|
|
54
|
-
- `src/services/
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
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
|
@@ -11,12 +11,12 @@
|
|
|
11
11
|
"preview": "vite preview"
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"webtau": "^0.5.0
|
|
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
|
|
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
|
-
//
|
|
29
|
-
if (
|
|
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
|
+
}
|
|
@@ -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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
21
|
+
"webtau-vite": "^0.5.0",
|
|
22
22
|
"@tauri-apps/cli": "^2.0.0",
|
|
23
23
|
"@tauri-apps/api": "^2.0.0"
|
|
24
24
|
}
|