@sharpee/sharpee 1.0.8 → 1.1.1
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 +36 -39
- package/package.json +21 -21
package/README.md
CHANGED
|
@@ -7,10 +7,22 @@ A modern TypeScript interactive fiction engine for creating text adventures and
|
|
|
7
7
|
|
|
8
8
|
## Installation
|
|
9
9
|
|
|
10
|
+
Add the runtime library to a project that embeds the engine:
|
|
11
|
+
|
|
10
12
|
```bash
|
|
11
13
|
npm install @sharpee/sharpee
|
|
12
14
|
```
|
|
13
15
|
|
|
16
|
+
To scaffold and build a story from the command line, install the devkit globally —
|
|
17
|
+
it provides the `sharpee` CLI:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm install -g @sharpee/devkit
|
|
21
|
+
# then
|
|
22
|
+
sharpee init my-story
|
|
23
|
+
sharpee build
|
|
24
|
+
```
|
|
25
|
+
|
|
14
26
|
## Features
|
|
15
27
|
|
|
16
28
|
- **Event-Driven Architecture** - Immutable events for all state changes
|
|
@@ -24,59 +36,44 @@ npm install @sharpee/sharpee
|
|
|
24
36
|
```typescript
|
|
25
37
|
import {
|
|
26
38
|
GameEngine,
|
|
27
|
-
WorldModel,
|
|
28
39
|
EnglishParser,
|
|
29
|
-
EnglishLanguageProvider
|
|
30
|
-
TextService
|
|
40
|
+
EnglishLanguageProvider
|
|
31
41
|
} from '@sharpee/sharpee';
|
|
32
42
|
|
|
33
|
-
//
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
const room = world.createEntity('room', {
|
|
44
|
-
id: 'start-room',
|
|
45
|
-
name: 'Starting Room',
|
|
46
|
-
description: 'You are in a small room with stone walls.'
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
// Set as starting location
|
|
50
|
-
world.setStartingLocation(room);
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
// Initialize the engine
|
|
55
|
-
const engine = new GameEngine({
|
|
56
|
-
story,
|
|
57
|
-
parser: new EnglishParser(),
|
|
58
|
-
languageProvider: new EnglishLanguageProvider(),
|
|
59
|
-
textService: new TextService()
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
// Start the game
|
|
63
|
-
const startEvents = engine.start();
|
|
43
|
+
// Set up language + parser
|
|
44
|
+
const language = new EnglishLanguageProvider();
|
|
45
|
+
const parser = new EnglishParser(language);
|
|
46
|
+
|
|
47
|
+
// Build the engine (world and player typically come from your story setup)
|
|
48
|
+
const engine = new GameEngine({ world, player, parser, language });
|
|
49
|
+
|
|
50
|
+
// Register the story, then start
|
|
51
|
+
engine.setStory(story);
|
|
52
|
+
engine.start();
|
|
64
53
|
|
|
65
54
|
// Process player commands
|
|
66
|
-
const
|
|
55
|
+
const result = await engine.executeTurn('look');
|
|
67
56
|
```
|
|
68
57
|
|
|
58
|
+
> Rendering is no longer a separate text service (ADR-174). The engine's prose
|
|
59
|
+
> pipeline produces `ITextBlock[]` that are carried to the UI by channels
|
|
60
|
+
> (ADR-163); use `renderToString` to flatten blocks for a plain-text host.
|
|
61
|
+
|
|
69
62
|
## What's Included
|
|
70
63
|
|
|
71
|
-
This package re-exports the
|
|
64
|
+
This umbrella package re-exports the **story runtime baseline** — the imports a
|
|
65
|
+
story author needs (ADR-178). It deliberately does **not** re-export every
|
|
66
|
+
symbol from every sub-package; for advanced use, import the specific sub-package
|
|
67
|
+
directly (e.g. `@sharpee/world-model`, `@sharpee/stdlib`).
|
|
72
68
|
|
|
73
69
|
| Export | Description |
|
|
74
70
|
|--------|-------------|
|
|
75
71
|
| `GameEngine` | Main game runtime |
|
|
76
|
-
| `WorldModel`, `IFEntity` | Entity and world management |
|
|
72
|
+
| `WorldModel`, `IFEntity`, `TraitType` | Entity and world management (types) |
|
|
77
73
|
| `EnglishParser` | Natural language command parser |
|
|
78
|
-
| `EnglishLanguageProvider` | English
|
|
79
|
-
| `
|
|
74
|
+
| `EnglishLanguageProvider` | English language provider |
|
|
75
|
+
| `renderToString`, `renderStatusLine` | Flatten prose blocks for a text host |
|
|
76
|
+
| `ITextBlock`, `IDecoration` | Prose-pipeline output types (ADR-096) |
|
|
80
77
|
| `QueryManager` | Player input queries (yes/no, menus) |
|
|
81
78
|
|
|
82
79
|
## Standard Actions
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sharpee/sharpee",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "Sharpee - Interactive Fiction Engine for TypeScript",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"types": "./index.d.ts",
|
|
@@ -12,26 +12,26 @@
|
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@sharpee/channel-service": "^1.
|
|
16
|
-
"@sharpee/core": "^1.
|
|
17
|
-
"@sharpee/engine": "^1.
|
|
18
|
-
"@sharpee/event-processor": "^1.
|
|
19
|
-
"@sharpee/ext-testing": "^1.
|
|
20
|
-
"@sharpee/if-domain": "^1.
|
|
21
|
-
"@sharpee/if-services": "^1.
|
|
22
|
-
"@sharpee/lang-en-us": "^1.
|
|
23
|
-
"@sharpee/media": "^1.
|
|
24
|
-
"@sharpee/parser-en-us": "^1.
|
|
25
|
-
"@sharpee/platform-browser": "^1.
|
|
26
|
-
"@sharpee/plugin-npc": "^1.
|
|
27
|
-
"@sharpee/plugin-scheduler": "^1.
|
|
28
|
-
"@sharpee/plugin-state-machine": "^1.
|
|
29
|
-
"@sharpee/plugins": "^1.
|
|
30
|
-
"@sharpee/character": "^1.
|
|
31
|
-
"@sharpee/story-runtime-baseline": "^1.
|
|
32
|
-
"@sharpee/stdlib": "^1.
|
|
33
|
-
"@sharpee/text-blocks": "^1.
|
|
34
|
-
"@sharpee/world-model": "^1.
|
|
15
|
+
"@sharpee/channel-service": "^1.1.1",
|
|
16
|
+
"@sharpee/core": "^1.1.1",
|
|
17
|
+
"@sharpee/engine": "^1.1.1",
|
|
18
|
+
"@sharpee/event-processor": "^1.1.1",
|
|
19
|
+
"@sharpee/ext-testing": "^1.1.1",
|
|
20
|
+
"@sharpee/if-domain": "^1.1.1",
|
|
21
|
+
"@sharpee/if-services": "^1.1.1",
|
|
22
|
+
"@sharpee/lang-en-us": "^1.1.1",
|
|
23
|
+
"@sharpee/media": "^1.1.1",
|
|
24
|
+
"@sharpee/parser-en-us": "^1.1.1",
|
|
25
|
+
"@sharpee/platform-browser": "^1.1.1",
|
|
26
|
+
"@sharpee/plugin-npc": "^1.1.1",
|
|
27
|
+
"@sharpee/plugin-scheduler": "^1.1.1",
|
|
28
|
+
"@sharpee/plugin-state-machine": "^1.1.1",
|
|
29
|
+
"@sharpee/plugins": "^1.1.1",
|
|
30
|
+
"@sharpee/character": "^1.1.1",
|
|
31
|
+
"@sharpee/story-runtime-baseline": "^1.1.1",
|
|
32
|
+
"@sharpee/stdlib": "^1.1.1",
|
|
33
|
+
"@sharpee/text-blocks": "^1.1.1",
|
|
34
|
+
"@sharpee/world-model": "^1.1.1"
|
|
35
35
|
},
|
|
36
36
|
"keywords": [
|
|
37
37
|
"interactive-fiction",
|