@netforge/template-collector 0.0.0-stage → 0.2.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/AGENTS.md ADDED
@@ -0,0 +1,73 @@
1
+ # Extending MOSSBOUND
2
+
3
+ MOSSBOUND is the monster collector template of the Net Forge game engine. The template already has walking and collision, encounters, turn order, damage, the element cycle, snaring, team swaps, XP and levels, the camp, the warden fight, dusk, netcode, rendering, touch controls, earn and the store. You change the game by changing declarations. Read `llms.txt` for every field, and `llms-full.txt` for the complete worked example.
4
+
5
+ ## The one file to edit
6
+
7
+ - `src/game.ts` is the whole game. Change declarations in place.
8
+ - `src/names.json`, next to it, holds the title and every label players read. Creatures go in `"weapons"` (`{ name, line }`), the warden in `"enemies"`, plus upgrades, earn rules and store items. Moves are shown from their ids (`leaf_lash` reads "Leaf Lash").
9
+ - Everything else (`src/manifest.ts`, `src/store.ts`, `client/`, `test/`, `scripts/`) is template machinery. Do not edit it.
10
+
11
+ ## Imports
12
+
13
+ `src/game.ts` imports only from `@netforge/engine`. The shipped game uses:
14
+
15
+ ```ts
16
+ import { creature, earn, game, marsh, move, store, upgrade } from "@netforge/engine";
17
+ ```
18
+
19
+ ## Declarations
20
+
21
+ - `game({ template: "collector", style, places, players: { prefab, max } })`.
22
+ - `marsh({ size, camp, starters, starterLevel, water, blocked, grass, warden, dusk, snares })`, exactly one. Rects are `[x, y, width, height]` in 2 m tiles.
23
+ - `creature(id, { model, element, hp, atk, def, spd, moves, catchRate?, boss?, size? })`, 1 to 24 of them. Base stats are at level 1 and grow 12% a level.
24
+ - `move(id, { element, power, accuracy?, effect?, amount? })`, at most 48. Effects are `"drain"`, `"heal"` and `"guard"`.
25
+ - `upgrade(id, { stat, step, maxLevel })` with stat `might`, `maxHealth`, `armor`, `amount` or `regen` only.
26
+ - `earn.rule(id, { when, n, pay, oncePer: "run" })`. Events: `creature.caught`, `creature.defeated`, `creature.levelup`, `level.five`, `level.ten`, `warden.defeated` and `run.won`.
27
+ - `earn.stake({ min, max, multiple })`, exactly one, on one top-level line.
28
+ - `store.sku(id, { coins, grants? })`.
29
+
30
+ ## Rules the build enforces
31
+
32
+ - Ids are lower_snake_case.
33
+ - Every game declares at least one `earn.rule` and exactly one `earn.stake`. `"stake"` is reserved.
34
+ - Every creature's moves are declared moves, 1 to 4 each.
35
+ - Starters and grass pools name declared creatures that are not bosses. The warden names a creature with `boss: true`.
36
+ - The camp and the warden stand inside the marsh on tiles that are not blocked. Grass and blocked rects stay inside the marsh. Leave a walkable way from camp to every grass zone and to the warden.
37
+ - Elements are `root`, `tide`, `spark` and `stone`, a cycle where each beats the next.
38
+ - No `weapon(...)` in a collector game.
39
+ - Asset ids are library ids such as `"style.lowpoly.frog"`, never URLs or paths, and must exist in the asset library. Keep `game({ style })` as the creator picked it.
40
+ - Four playtest keepers must win battles, catch creatures and fire an earn rule in 4 minutes, and must not lose their whole team more than twice each.
41
+ - Keep the SKUs the client is wired to at their prices: `thornbark`, `mossmail`, `spare_snares`, `fen_tonic`, `skin_lichen`, `skin_amber` and `lucky_reed`.
42
+
43
+ ## Validate
44
+
45
+ - With the MCP server (`npx -y @netforge/mcp`), call `netforge_validate_game` on `src/game.ts`. It returns one actionable line per problem.
46
+ - In this package, run the tests with vitest: `test/harness.test.ts` and `test/store.test.ts`.
47
+
48
+ ## Playtest
49
+
50
+ - With the MCP server, call `netforge_run_playtest`.
51
+ - In code, import the game module and run the headless harness:
52
+
53
+ ```ts
54
+ import { engine } from "@netforge/engine";
55
+ import "./src/game.js";
56
+
57
+ const report = await engine.test.run({ ticks: 30 * 240, bots: 4, seed: 1 });
58
+ console.log(report.kills, report.deaths, report.earned, report.rules?.checks);
59
+ ```
60
+
61
+ The report has battles won plus catches (kills), team wipes (deaths), earn by rule, softlock, ms per tick and the genre's checks under `rules.checks`.
62
+
63
+ ## Play locally
64
+
65
+ In a folder with `netnet.json` (`{"template":"collector"}`) and `src/game.ts`, with `@netforge/kit-play` and `@netforge/engine` installed, run `npx kit-play`. It opens http://127.0.0.1:4663 with play money. The MCP tool `netforge_play_locally` gives the same steps.
66
+
67
+ ## Do not
68
+
69
+ - Do not write renderers, netcode, physics or battle AI. The template has them.
70
+ - Do not reference assets by URL or file path.
71
+ - Do not import anything other than `@netforge/engine` in `src/game.ts`.
72
+ - Do not edit `client/`, `src/manifest.ts` or `src/store.ts`.
73
+ - Do not rename or reprice the SKUs the client is wired to.
package/CLAUDE.md ADDED
@@ -0,0 +1,11 @@
1
+ # CLAUDE.md
2
+
3
+ This package is MOSSBOUND, a Net Forge game template. Read AGENTS.md before changing this game. It lists the declarations this genre has, the rules the build enforces, and how to validate, playtest and play the game locally.
4
+
5
+ The five hard rules:
6
+
7
+ 1. Edit only src/game.ts (and src/names.json for the labels players read).
8
+ 2. Import only from @netforge/engine.
9
+ 3. Ids are lower_snake_case.
10
+ 4. Declare at least one earn.rule and exactly one earn.stake.
11
+ 5. Never write renderers, netcode, physics or bot AI, and never reference assets by URL or file path (use library ids such as "style.lowpoly.frog").
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 NetNet Capital Management
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/NOTICE ADDED
@@ -0,0 +1,29 @@
1
+ @netforge/template-collector (MOSSBOUND)
2
+ Copyright (c) 2026 NetNet Capital Management
3
+
4
+ An original game. No names, characters, maps, models, sounds or code from
5
+ any other game or franchise.
6
+
7
+ Art and sound
8
+ - Models come from the per-style asset library
9
+ (@netforge/asset-library): CC0 1.0 models by Kenney and
10
+ Quaternius (animals, monsters, Nature Kit), each pack listed with its
11
+ source URL and licence verification in that package's NOTICE and
12
+ manifest/packs.json. The files are fetched and built, never committed
13
+ here; the build copies only the models this game uses.
14
+ - Fallback shapes (@netforge/tabletop stage.ts) are generated from three.js
15
+ primitives; all textures are drawn on a canvas at load; sounds are the
16
+ library's CC0 samples with WebAudio synth fallbacks.
17
+
18
+ Dependencies (unmodified, via npm)
19
+ - three.js 0.186.1 (https://github.com/mrdoob/three.js), MIT.
20
+ - @netforge/engine and @netforge/engine-sim (this repository);
21
+ see their NOTICE files (bitECS MPL-2.0, Rapier Apache-2.0, Colyseus MIT,
22
+ zod MIT).
23
+
24
+ Patterns (ideas only)
25
+ - The creature-collecting RPG genre's general mechanics (meeting creatures
26
+ in tall grass, turn-based battles, a small team, catching, levels).
27
+ Mechanics, not expression: the creatures, names, elements, items, map
28
+ and text are original, and no creature, design, type chart or item was
29
+ copied from any game.
package/README.md CHANGED
@@ -1,3 +1,82 @@
1
- # Temporary Holding Version
1
+ # @netforge/template-collector
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ A monster collector game template for Net Forge: a shared marsh for up to 8 keepers who catch creatures, battle turn by turn and bring down one warden together (MOSSBOUND).
4
+
5
+ Fen spirits live in the tall grass of a flooded marsh. Each keeper picks a starter at camp, walks the reeds, meets wild spirits in the grass and battles them with a team of three, snaring the ones worth keeping in a reed lantern. At the far end of the marsh the Fenwarden waits. Every keeper wears down the same warden, and it must fall before dusk.
6
+
7
+ ## Install
8
+
9
+ ```sh
10
+ npm install @netforge/template-collector
11
+ ```
12
+
13
+ You rarely import this package directly. kit play (`@netforge/kit-play`) and the Net Forge MCP server use it to build and run a game whose `src/game.ts` you write.
14
+
15
+ ## Play it locally
16
+
17
+ ```sh
18
+ mkdir -p my-game/src && cd my-game
19
+ npm init -y && npm install @netforge/kit-play @netforge/engine @netforge/template-collector
20
+ cp node_modules/@netforge/template-collector/src/game.ts src/
21
+ echo '{"template":"collector"}' > netnet.json
22
+ npx kit-play # opens http://127.0.0.1:4663
23
+ ```
24
+
25
+ Open the link in more tabs for more keepers. Coins are play money. Real-token earning, stakes and claims run only on the hosted Net Forge server.
26
+
27
+ ## Change the game
28
+
29
+ Edit `src/game.ts` and run `npx kit-play` again. For example, make the warden tougher and give keepers more time and snares in `marsh({ ... })`:
30
+
31
+ ```ts
32
+ warden: { creature: "fenwarden", at: [27, 10], level: 10, hp: 900 },
33
+ dusk: 720,
34
+ snares: 8,
35
+ ```
36
+
37
+ Or add a creature and a move, then put the creature in a grass pool and its label in `src/names.json` under `weapons`:
38
+
39
+ ```ts
40
+ creature("thistlehog", { model: "style.lowpoly.fox", element: "root", hp: 50, atk: 52, def: 48, spd: 46, moves: ["leaf_lash", "thorn_curl"], catchRate: 0.7 });
41
+ move("thorn_curl", { element: "root", power: 0, effect: "guard" });
42
+ ```
43
+
44
+ ## How it plays on the server
45
+
46
+ - A board genre on the engine's rules runtime (`@netforge/engine/rules`) at 30 Hz, drawn with `@netforge/tabletop`.
47
+ - Your keeper walks with a stick (WASD, arrows or the left thumb) and is predicted with the same tile collision the room runs. Every roll (encounters, accuracy, damage spread, snares, the foe's move) comes from the room's PRNG, so a run replays exactly from its inputs.
48
+ - Battles are private: your team, your foe and the battle log reach only you. Others see the creature beside you.
49
+ - The warden's health is one pool for the whole marsh. When it falls, everyone who hurt it is paid. Dusk ends the run.
50
+ - Earn: the first catch, three catches, the warden and a creature at level 5. The room server is the referee.
51
+
52
+ ## Files
53
+
54
+ | Path | What |
55
+ |---|---|
56
+ | `src/game.ts` | The game, as declarations only. This is the file you edit. |
57
+ | `src/manifest.ts` | Loads the game; `collectorAdapter()` for the room host and the client. |
58
+ | `src/store.ts` | Coin prices the client is wired to. |
59
+ | `client/` | The marsh, keepers, companions, the battle panel and the starter pick. |
60
+ | `test/` | Playtest bots through `engine.test.run`, and the store test. |
61
+ | `llms.txt`, `llms-full.txt` | How to change the game, for agents. |
62
+
63
+ ## For AI agents
64
+
65
+ Read `AGENTS.md` and `llms.txt` before editing. The Net Forge MCP server gives a coding agent the templates, the API and a playtest loop:
66
+
67
+ ```sh
68
+ npx -y @netforge/mcp
69
+ ```
70
+
71
+ The package is `@netforge/mcp` and its bin is `netforge-mcp`. Its tools are `netforge_list_templates`, `netforge_create_game`, `netforge_explain_api`, `netforge_search_docs`, `netforge_validate_game`, `netforge_run_playtest` and `netforge_play_locally`.
72
+
73
+ To set up a coding agent in a game project, run `npx netforge setup agent`. It writes AGENTS.md, CLAUDE.md, Cursor rules and `.mcp.json` into the project. In Claude Code you can also add the server directly with `claude mcp add netforge -- npx -y @netforge/mcp`.
74
+
75
+ ## Docs
76
+
77
+ - https://forge.netnet.capital/docs/templates/collector
78
+ - `llms.txt` and `llms-full.txt` in this package. The full file includes the complete `src/game.ts` and the validate and playtest steps.
79
+
80
+ ## License
81
+
82
+ MIT. See LICENSE and NOTICE.
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Library models the scene draws on its own (not named in game.ts): the
3
+ * camp, the reeds, the rocks and trees of the marsh, the warden's mound.
4
+ * The build copies these into ./library, in every art style.
5
+ */
6
+ export const TENT_MODEL = "style.lowpoly.tent";
7
+ export const FIRE_MODEL = "style.lowpoly.campfire";
8
+ export const REED_MODEL = "style.lowpoly.bush";
9
+ export const ROCK_MODEL = "style.lowpoly.rock_tall";
10
+ export const TREE_MODELS = ["style.lowpoly.tree_pine", "style.lowpoly.tree_dark", "style.lowpoly.tree_fat"] as const;
11
+ export const MOUND_MODEL = "style.lowpoly.column_broken";
12
+ export const SMALL_DECOR = ["style.lowpoly.mushroom_red", "style.lowpoly.flower_red", "style.lowpoly.stump", "style.lowpoly.log"] as const;
13
+ export const SCENE_MODELS: readonly string[] = [TENT_MODEL, FIRE_MODEL, REED_MODEL, ROCK_MODEL, ...TREE_MODELS, MOUND_MODEL, ...SMALL_DECOR];
@@ -0,0 +1,11 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover, user-scalable=no" />
6
+ <title>Mossbound</title>
7
+ </head>
8
+ <body>
9
+ <script type="module" src="./main.ts"></script>
10
+ </body>
11
+ </html>