@adatechnology/game-stories 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/LICENSE +21 -0
- package/README.md +88 -2
- package/dist/index.d.ts +1511 -0
- package/dist/index.global.js +4477 -0
- package/dist/index.global.js.map +1 -0
- package/dist/index.js +1557 -0
- package/dist/index.js.map +1 -0
- package/package.json +55 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Anderson Fernandes
|
|
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/README.md
CHANGED
|
@@ -1,3 +1,89 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @adatechnology/game-stories
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Stories as data for games, pure and seeded: stories of beats with roles, conditions, text pieces and changes; the casting that decides who plays each
|
|
4
|
+
role; the chronicle; the character sheet that keeps everything a person lived; and the life simulation that runs between the stories (people get hurt,
|
|
5
|
+
fall in love, have children, fight, betray, trade, are raided and arrive). No three.js, no game content: the game gives the people, the stories and the
|
|
6
|
+
places, and reads the chronicle and the sheets.
|
|
7
|
+
|
|
8
|
+
It is a literal port of two team deliveries:
|
|
9
|
+
|
|
10
|
+
- **Os Vivos do Vale** (`site/pages/sobreviventes/os-vivos-do-vale.html`): `life()`, `simulate()` and the event engine (`EV`, `ACTS`, `fill`), made
|
|
11
|
+
generic. The valley's people and its 47 events are not here: they are the zombiada slice (`specs/001-migracao-entregas-dos-times/game-slice/stories/`).
|
|
12
|
+
- **Personagens** (`site/pages/zumbis-personagens/personagens.html`): the sheet (point buy, derived values, skills and milestones, memory and opinion).
|
|
13
|
+
The ruleset itself (attributes, skills, professions, traits, formulas) and the name pools are content in `@adatechnology/game-characters-people`.
|
|
14
|
+
|
|
15
|
+
The golden `game-stories-life.json` (7 full lives line by line, 40 more by hash, 96 sets of player actions without the life simulation and 48 sheets,
|
|
16
|
+
all recorded by running the team code in `node:vm` with `tools/characters-catalog`) is replayed by the tests.
|
|
17
|
+
|
|
18
|
+
- **The normal world comes first.** `life.numbers.infection` is `false` by default: an outing can hurt or kill, nobody is bitten and nobody turns.
|
|
19
|
+
`infection: true` turns on the team's bitten band and the turn after two days.
|
|
20
|
+
- **Everything is a number with its source** (`LIFE_DEFAULTS`, `SHEET_DEFAULTS`) and every text is a table (`LIFE_TEXT`, `pt-BR` word for word and
|
|
21
|
+
`en`); a game patches what it wants through `life.numbers` and `life.text`.
|
|
22
|
+
- **Stories cross** by role: a role with the same id in two stories is one person, and a beat reads the states, flags, actions and what each person
|
|
23
|
+
remembers.
|
|
24
|
+
- **Casting (P9)**: a role is a pinned person, or someone who fits its needs, or a person made from the name pools. It draws from its own stream, so the
|
|
25
|
+
life simulation keeps the team's sequence.
|
|
26
|
+
|
|
27
|
+
## Install
|
|
28
|
+
|
|
29
|
+
```sh
|
|
30
|
+
pnpm add @adatechnology/game-stories
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Browser without a bundler (the global is `GameStories`):
|
|
34
|
+
|
|
35
|
+
```html
|
|
36
|
+
<script src="https://unpkg.com/@adatechnology/game-stories/dist/index.global.js"></script>
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Usage
|
|
40
|
+
|
|
41
|
+
```ts
|
|
42
|
+
import { createStoryWorld, createSheet } from '@adatechnology/game-stories'
|
|
43
|
+
|
|
44
|
+
const world = createStoryWorld({ people, stories, life: { groups, relations, couples }, fill: 80, seed: 7, locale: 'pt-BR' })
|
|
45
|
+
world.act('fix_well') // a player action: the stories read it from today on
|
|
46
|
+
world.runTo(30)
|
|
47
|
+
world.chronicle.entries // every line, by day
|
|
48
|
+
world.states // the state of every person: ok, hurt, dead, missing, party, hostile, moved, left...
|
|
49
|
+
const sheet = world.sheet(world.cast('keeper')) // the same world, the same sheet
|
|
50
|
+
sheet.history // the stories and events the person lived
|
|
51
|
+
sheet.derived() // max health, stamina, load, running speed... from the ruleset
|
|
52
|
+
|
|
53
|
+
const mine = createSheet({ profession: 'nurse', attributes: { agility: 6 }, traits: ['athlete'] })
|
|
54
|
+
mine.pool() // points left of the 14
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
A story:
|
|
58
|
+
|
|
59
|
+
```ts
|
|
60
|
+
{
|
|
61
|
+
id: 'well',
|
|
62
|
+
roles: [{ id: 'keeper', needs: { base: 'farm' }, create: true }],
|
|
63
|
+
beats: [
|
|
64
|
+
{ id: 'well_dry', day: 10, roles: ['keeper'], variants: [{ text: [{ name: 'keeper' }, ' finds the well dry.'], flags: { well_dry: 1 } }] },
|
|
65
|
+
{
|
|
66
|
+
id: 'well_after', day: 14, roles: ['keeper', 'newcomer'],
|
|
67
|
+
variants: [
|
|
68
|
+
{ when: { all: [{ action: 'fix_well' }, { living: 'newcomer' }] }, text: [{ name: 'newcomer' }, ' fixes the pump.'] },
|
|
69
|
+
{ text: [{ name: 'keeper' }, ' carries water from the river.'], changes: [{ role: 'keeper', state: 'hurt' }] },
|
|
70
|
+
],
|
|
71
|
+
},
|
|
72
|
+
],
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Test area
|
|
77
|
+
|
|
78
|
+
`createStoriesTestModule()` (`stories_area`, only the generic contracts) puts the seed, the day, the life simulation, the infection layer, the player
|
|
79
|
+
actions and a person's sheet on the bench, with six scenarios (determinism, casting, the normal world, the sheet keeps what was lived, the point buy and
|
|
80
|
+
two stories crossing). It runs the kit's example content (two small stories on a farm and a town, marked `example`) until a game loads its own
|
|
81
|
+
(`module.load(content)`). `examples/stories-test-area` loads it into the shared test room (`sala-historias.html`, with a button for a JSON file such as the
|
|
82
|
+
zombiada slice), and `examples/interactables-test-area` carries it too.
|
|
83
|
+
|
|
84
|
+
## Em português
|
|
85
|
+
|
|
86
|
+
Histórias como dados, determinísticas por semente: histórias de momentos com papéis, condições, pedaços de texto e mudanças; a escalação de quem faz
|
|
87
|
+
cada papel; a crônica; a ficha que guarda tudo o que a pessoa viveu; e a vida sorteada entre as histórias. Porte literal de Os Vivos do Vale (`life()`,
|
|
88
|
+
`simulate()`, eventos) e da ficha de Personagens. O mundo normal vem primeiro (sem mordida por padrão). O conteúdo do vale (as 45 pessoas e os 47
|
|
89
|
+
eventos) fica no repositório do jogo; o kit traz só um exemplo marcado `example`.
|