@ai-rpg-engine/campaign-memory 2.1.7 → 2.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/LICENSE +21 -0
- package/README.es.md +45 -45
- package/README.fr.md +45 -45
- package/README.hi.md +45 -45
- package/README.it.md +45 -45
- package/README.ja.md +45 -45
- package/README.md +104 -104
- package/README.pt-BR.md +45 -45
- package/README.zh.md +45 -45
- package/dist/finale.js +2 -2
- package/dist/finale.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/journal.d.ts +29 -5
- package/dist/journal.d.ts.map +1 -1
- package/dist/journal.js +80 -14
- package/dist/journal.js.map +1 -1
- package/dist/memory-bank.d.ts +17 -2
- package/dist/memory-bank.d.ts.map +1 -1
- package/dist/memory-bank.js +85 -5
- package/dist/memory-bank.js.map +1 -1
- package/dist/types.d.ts +24 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +9 -0
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 MCP Tool Shop
|
|
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.es.md
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
<a href="README.ja.md">日本語</a> | <a href="README.zh.md">中文</a> | <a href="README.md">English</a> | <a href="README.fr.md">Français</a> | <a href="README.hi.md">हिन्दी</a> | <a href="README.it.md">Italiano</a> | <a href="README.pt-BR.md">Português (BR)</a>
|
|
3
3
|
</p>
|
|
4
4
|
|
|
5
|
-
<p align="center">
|
|
6
|
-
<img src="https://raw.githubusercontent.com/mcp-tool-shop-org/brand/main/logos/ai-rpg-engine/readme.png" width="400" alt="AI RPG Engine">
|
|
7
|
-
</p>
|
|
5
|
+
<p align="center">
|
|
6
|
+
<img src="https://raw.githubusercontent.com/mcp-tool-shop-org/brand/main/logos/ai-rpg-engine/readme.png" width="400" alt="AI RPG Engine">
|
|
7
|
+
</p>
|
|
8
8
|
|
|
9
9
|
# @ai-rpg-engine/campaign-memory
|
|
10
10
|
|
|
@@ -15,9 +15,9 @@ Memoria persistente de los personajes no jugables (PNJs), relaciones multidimens
|
|
|
15
15
|
|
|
16
16
|
## Instalación
|
|
17
17
|
|
|
18
|
-
```bash
|
|
19
|
-
npm install @ai-rpg-engine/campaign-memory
|
|
20
|
-
```
|
|
18
|
+
```bash
|
|
19
|
+
npm install @ai-rpg-engine/campaign-memory
|
|
20
|
+
```
|
|
21
21
|
|
|
22
22
|
## ¿Qué hace?
|
|
23
23
|
|
|
@@ -27,48 +27,48 @@ Los PNJs recuerdan lo que ha sucedido. No solo "hostil: verdadero", sino que reg
|
|
|
27
27
|
|
|
28
28
|
### Diario de campaña
|
|
29
29
|
|
|
30
|
-
```typescript
|
|
31
|
-
import { CampaignJournal } from '@ai-rpg-engine/campaign-memory';
|
|
32
|
-
|
|
33
|
-
const journal = new CampaignJournal();
|
|
34
|
-
|
|
35
|
-
// Record a significant event
|
|
36
|
-
const record = journal.record({
|
|
37
|
-
tick: 42,
|
|
38
|
-
category: 'kill',
|
|
39
|
-
actorId: 'player',
|
|
40
|
-
targetId: 'merchant_1',
|
|
41
|
-
zoneId: 'market',
|
|
42
|
-
description: 'Player killed the merchant during a robbery',
|
|
43
|
-
significance: 0.9,
|
|
44
|
-
witnesses: ['guard_1', 'bystander_2'],
|
|
45
|
-
data: { weapon: 'dagger' },
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
// Query the journal
|
|
49
|
-
const playerActions = journal.query({ actorId: 'player', category: 'kill' });
|
|
50
|
-
const merchantHistory = journal.getInvolving('merchant_1');
|
|
51
|
-
```
|
|
30
|
+
```typescript
|
|
31
|
+
import { CampaignJournal } from '@ai-rpg-engine/campaign-memory';
|
|
32
|
+
|
|
33
|
+
const journal = new CampaignJournal();
|
|
34
|
+
|
|
35
|
+
// Record a significant event
|
|
36
|
+
const record = journal.record({
|
|
37
|
+
tick: 42,
|
|
38
|
+
category: 'kill',
|
|
39
|
+
actorId: 'player',
|
|
40
|
+
targetId: 'merchant_1',
|
|
41
|
+
zoneId: 'market',
|
|
42
|
+
description: 'Player killed the merchant during a robbery',
|
|
43
|
+
significance: 0.9,
|
|
44
|
+
witnesses: ['guard_1', 'bystander_2'],
|
|
45
|
+
data: { weapon: 'dagger' },
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
// Query the journal
|
|
49
|
+
const playerActions = journal.query({ actorId: 'player', category: 'kill' });
|
|
50
|
+
const merchantHistory = journal.getInvolving('merchant_1');
|
|
51
|
+
```
|
|
52
52
|
|
|
53
53
|
### Banco de memoria de los PNJs
|
|
54
54
|
|
|
55
|
-
```typescript
|
|
56
|
-
import { NpcMemoryBank, applyRelationshipEffect } from '@ai-rpg-engine/campaign-memory';
|
|
57
|
-
|
|
58
|
-
const guardMemory = new NpcMemoryBank('guard_1');
|
|
59
|
-
|
|
60
|
-
// Guard witnesses the player killing a merchant
|
|
61
|
-
guardMemory.remember(record, 0.9, -0.8); // high salience, very negative
|
|
62
|
-
applyRelationshipEffect(guardMemory, record, 'witness');
|
|
63
|
-
|
|
64
|
-
// Check how the guard feels about the player
|
|
65
|
-
const rel = guardMemory.getRelationship('player');
|
|
66
|
-
// { trust: -0.15, fear: 0.25, admiration: -0.05, familiarity: 0 }
|
|
67
|
-
|
|
68
|
-
// Later, memories fade
|
|
69
|
-
guardMemory.consolidate(currentTick);
|
|
70
|
-
const memories = guardMemory.recall({ aboutEntity: 'player', minSalience: 0.5 });
|
|
71
|
-
```
|
|
55
|
+
```typescript
|
|
56
|
+
import { NpcMemoryBank, applyRelationshipEffect } from '@ai-rpg-engine/campaign-memory';
|
|
57
|
+
|
|
58
|
+
const guardMemory = new NpcMemoryBank('guard_1');
|
|
59
|
+
|
|
60
|
+
// Guard witnesses the player killing a merchant
|
|
61
|
+
guardMemory.remember(record, 0.9, -0.8); // high salience, very negative
|
|
62
|
+
applyRelationshipEffect(guardMemory, record, 'witness');
|
|
63
|
+
|
|
64
|
+
// Check how the guard feels about the player
|
|
65
|
+
const rel = guardMemory.getRelationship('player');
|
|
66
|
+
// { trust: -0.15, fear: 0.25, admiration: -0.05, familiarity: 0 }
|
|
67
|
+
|
|
68
|
+
// Later, memories fade
|
|
69
|
+
guardMemory.consolidate(currentTick);
|
|
70
|
+
const memories = guardMemory.recall({ aboutEntity: 'player', minSalience: 0.5 });
|
|
71
|
+
```
|
|
72
72
|
|
|
73
73
|
### Ejes de relación
|
|
74
74
|
|
package/README.fr.md
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
<a href="README.ja.md">日本語</a> | <a href="README.zh.md">中文</a> | <a href="README.es.md">Español</a> | <a href="README.md">English</a> | <a href="README.hi.md">हिन्दी</a> | <a href="README.it.md">Italiano</a> | <a href="README.pt-BR.md">Português (BR)</a>
|
|
3
3
|
</p>
|
|
4
4
|
|
|
5
|
-
<p align="center">
|
|
6
|
-
<img src="https://raw.githubusercontent.com/mcp-tool-shop-org/brand/main/logos/ai-rpg-engine/readme.png" width="400" alt="AI RPG Engine">
|
|
7
|
-
</p>
|
|
5
|
+
<p align="center">
|
|
6
|
+
<img src="https://raw.githubusercontent.com/mcp-tool-shop-org/brand/main/logos/ai-rpg-engine/readme.png" width="400" alt="AI RPG Engine">
|
|
7
|
+
</p>
|
|
8
8
|
|
|
9
9
|
# @ai-rpg-engine/campaign-memory
|
|
10
10
|
|
|
@@ -15,9 +15,9 @@ Mémoire persistante des PNJ, relations multi-axes et journal de campagne pour [
|
|
|
15
15
|
|
|
16
16
|
## Installation
|
|
17
17
|
|
|
18
|
-
```bash
|
|
19
|
-
npm install @ai-rpg-engine/campaign-memory
|
|
20
|
-
```
|
|
18
|
+
```bash
|
|
19
|
+
npm install @ai-rpg-engine/campaign-memory
|
|
20
|
+
```
|
|
21
21
|
|
|
22
22
|
## Fonctionnalités
|
|
23
23
|
|
|
@@ -27,48 +27,48 @@ Les PNJ se souviennent de ce qui s'est passé. Il ne s'agit pas seulement de "ho
|
|
|
27
27
|
|
|
28
28
|
### Journal de campagne
|
|
29
29
|
|
|
30
|
-
```typescript
|
|
31
|
-
import { CampaignJournal } from '@ai-rpg-engine/campaign-memory';
|
|
32
|
-
|
|
33
|
-
const journal = new CampaignJournal();
|
|
34
|
-
|
|
35
|
-
// Record a significant event
|
|
36
|
-
const record = journal.record({
|
|
37
|
-
tick: 42,
|
|
38
|
-
category: 'kill',
|
|
39
|
-
actorId: 'player',
|
|
40
|
-
targetId: 'merchant_1',
|
|
41
|
-
zoneId: 'market',
|
|
42
|
-
description: 'Player killed the merchant during a robbery',
|
|
43
|
-
significance: 0.9,
|
|
44
|
-
witnesses: ['guard_1', 'bystander_2'],
|
|
45
|
-
data: { weapon: 'dagger' },
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
// Query the journal
|
|
49
|
-
const playerActions = journal.query({ actorId: 'player', category: 'kill' });
|
|
50
|
-
const merchantHistory = journal.getInvolving('merchant_1');
|
|
51
|
-
```
|
|
30
|
+
```typescript
|
|
31
|
+
import { CampaignJournal } from '@ai-rpg-engine/campaign-memory';
|
|
32
|
+
|
|
33
|
+
const journal = new CampaignJournal();
|
|
34
|
+
|
|
35
|
+
// Record a significant event
|
|
36
|
+
const record = journal.record({
|
|
37
|
+
tick: 42,
|
|
38
|
+
category: 'kill',
|
|
39
|
+
actorId: 'player',
|
|
40
|
+
targetId: 'merchant_1',
|
|
41
|
+
zoneId: 'market',
|
|
42
|
+
description: 'Player killed the merchant during a robbery',
|
|
43
|
+
significance: 0.9,
|
|
44
|
+
witnesses: ['guard_1', 'bystander_2'],
|
|
45
|
+
data: { weapon: 'dagger' },
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
// Query the journal
|
|
49
|
+
const playerActions = journal.query({ actorId: 'player', category: 'kill' });
|
|
50
|
+
const merchantHistory = journal.getInvolving('merchant_1');
|
|
51
|
+
```
|
|
52
52
|
|
|
53
53
|
### Banque de mémoire des PNJ
|
|
54
54
|
|
|
55
|
-
```typescript
|
|
56
|
-
import { NpcMemoryBank, applyRelationshipEffect } from '@ai-rpg-engine/campaign-memory';
|
|
57
|
-
|
|
58
|
-
const guardMemory = new NpcMemoryBank('guard_1');
|
|
59
|
-
|
|
60
|
-
// Guard witnesses the player killing a merchant
|
|
61
|
-
guardMemory.remember(record, 0.9, -0.8); // high salience, very negative
|
|
62
|
-
applyRelationshipEffect(guardMemory, record, 'witness');
|
|
63
|
-
|
|
64
|
-
// Check how the guard feels about the player
|
|
65
|
-
const rel = guardMemory.getRelationship('player');
|
|
66
|
-
// { trust: -0.15, fear: 0.25, admiration: -0.05, familiarity: 0 }
|
|
67
|
-
|
|
68
|
-
// Later, memories fade
|
|
69
|
-
guardMemory.consolidate(currentTick);
|
|
70
|
-
const memories = guardMemory.recall({ aboutEntity: 'player', minSalience: 0.5 });
|
|
71
|
-
```
|
|
55
|
+
```typescript
|
|
56
|
+
import { NpcMemoryBank, applyRelationshipEffect } from '@ai-rpg-engine/campaign-memory';
|
|
57
|
+
|
|
58
|
+
const guardMemory = new NpcMemoryBank('guard_1');
|
|
59
|
+
|
|
60
|
+
// Guard witnesses the player killing a merchant
|
|
61
|
+
guardMemory.remember(record, 0.9, -0.8); // high salience, very negative
|
|
62
|
+
applyRelationshipEffect(guardMemory, record, 'witness');
|
|
63
|
+
|
|
64
|
+
// Check how the guard feels about the player
|
|
65
|
+
const rel = guardMemory.getRelationship('player');
|
|
66
|
+
// { trust: -0.15, fear: 0.25, admiration: -0.05, familiarity: 0 }
|
|
67
|
+
|
|
68
|
+
// Later, memories fade
|
|
69
|
+
guardMemory.consolidate(currentTick);
|
|
70
|
+
const memories = guardMemory.recall({ aboutEntity: 'player', minSalience: 0.5 });
|
|
71
|
+
```
|
|
72
72
|
|
|
73
73
|
### Axes de relations
|
|
74
74
|
|
package/README.hi.md
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
<a href="README.ja.md">日本語</a> | <a href="README.zh.md">中文</a> | <a href="README.es.md">Español</a> | <a href="README.fr.md">Français</a> | <a href="README.md">English</a> | <a href="README.it.md">Italiano</a> | <a href="README.pt-BR.md">Português (BR)</a>
|
|
3
3
|
</p>
|
|
4
4
|
|
|
5
|
-
<p align="center">
|
|
6
|
-
<img src="https://raw.githubusercontent.com/mcp-tool-shop-org/brand/main/logos/ai-rpg-engine/readme.png" width="400" alt="AI RPG Engine">
|
|
7
|
-
</p>
|
|
5
|
+
<p align="center">
|
|
6
|
+
<img src="https://raw.githubusercontent.com/mcp-tool-shop-org/brand/main/logos/ai-rpg-engine/readme.png" width="400" alt="AI RPG Engine">
|
|
7
|
+
</p>
|
|
8
8
|
|
|
9
9
|
# @ai-rpg-engine/campaign-memory
|
|
10
10
|
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
|
|
16
16
|
## इंस्टॉलेशन
|
|
17
17
|
|
|
18
|
-
```bash
|
|
19
|
-
npm install @ai-rpg-engine/campaign-memory
|
|
20
|
-
```
|
|
18
|
+
```bash
|
|
19
|
+
npm install @ai-rpg-engine/campaign-memory
|
|
20
|
+
```
|
|
21
21
|
|
|
22
22
|
## यह क्या करता है
|
|
23
23
|
|
|
@@ -27,48 +27,48 @@ npm install @ai-rpg-engine/campaign-memory
|
|
|
27
27
|
|
|
28
28
|
### अभियान जर्नल
|
|
29
29
|
|
|
30
|
-
```typescript
|
|
31
|
-
import { CampaignJournal } from '@ai-rpg-engine/campaign-memory';
|
|
32
|
-
|
|
33
|
-
const journal = new CampaignJournal();
|
|
34
|
-
|
|
35
|
-
// Record a significant event
|
|
36
|
-
const record = journal.record({
|
|
37
|
-
tick: 42,
|
|
38
|
-
category: 'kill',
|
|
39
|
-
actorId: 'player',
|
|
40
|
-
targetId: 'merchant_1',
|
|
41
|
-
zoneId: 'market',
|
|
42
|
-
description: 'Player killed the merchant during a robbery',
|
|
43
|
-
significance: 0.9,
|
|
44
|
-
witnesses: ['guard_1', 'bystander_2'],
|
|
45
|
-
data: { weapon: 'dagger' },
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
// Query the journal
|
|
49
|
-
const playerActions = journal.query({ actorId: 'player', category: 'kill' });
|
|
50
|
-
const merchantHistory = journal.getInvolving('merchant_1');
|
|
51
|
-
```
|
|
30
|
+
```typescript
|
|
31
|
+
import { CampaignJournal } from '@ai-rpg-engine/campaign-memory';
|
|
32
|
+
|
|
33
|
+
const journal = new CampaignJournal();
|
|
34
|
+
|
|
35
|
+
// Record a significant event
|
|
36
|
+
const record = journal.record({
|
|
37
|
+
tick: 42,
|
|
38
|
+
category: 'kill',
|
|
39
|
+
actorId: 'player',
|
|
40
|
+
targetId: 'merchant_1',
|
|
41
|
+
zoneId: 'market',
|
|
42
|
+
description: 'Player killed the merchant during a robbery',
|
|
43
|
+
significance: 0.9,
|
|
44
|
+
witnesses: ['guard_1', 'bystander_2'],
|
|
45
|
+
data: { weapon: 'dagger' },
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
// Query the journal
|
|
49
|
+
const playerActions = journal.query({ actorId: 'player', category: 'kill' });
|
|
50
|
+
const merchantHistory = journal.getInvolving('merchant_1');
|
|
51
|
+
```
|
|
52
52
|
|
|
53
53
|
### एनपीसी मेमोरी बैंक
|
|
54
54
|
|
|
55
|
-
```typescript
|
|
56
|
-
import { NpcMemoryBank, applyRelationshipEffect } from '@ai-rpg-engine/campaign-memory';
|
|
57
|
-
|
|
58
|
-
const guardMemory = new NpcMemoryBank('guard_1');
|
|
59
|
-
|
|
60
|
-
// Guard witnesses the player killing a merchant
|
|
61
|
-
guardMemory.remember(record, 0.9, -0.8); // high salience, very negative
|
|
62
|
-
applyRelationshipEffect(guardMemory, record, 'witness');
|
|
63
|
-
|
|
64
|
-
// Check how the guard feels about the player
|
|
65
|
-
const rel = guardMemory.getRelationship('player');
|
|
66
|
-
// { trust: -0.15, fear: 0.25, admiration: -0.05, familiarity: 0 }
|
|
67
|
-
|
|
68
|
-
// Later, memories fade
|
|
69
|
-
guardMemory.consolidate(currentTick);
|
|
70
|
-
const memories = guardMemory.recall({ aboutEntity: 'player', minSalience: 0.5 });
|
|
71
|
-
```
|
|
55
|
+
```typescript
|
|
56
|
+
import { NpcMemoryBank, applyRelationshipEffect } from '@ai-rpg-engine/campaign-memory';
|
|
57
|
+
|
|
58
|
+
const guardMemory = new NpcMemoryBank('guard_1');
|
|
59
|
+
|
|
60
|
+
// Guard witnesses the player killing a merchant
|
|
61
|
+
guardMemory.remember(record, 0.9, -0.8); // high salience, very negative
|
|
62
|
+
applyRelationshipEffect(guardMemory, record, 'witness');
|
|
63
|
+
|
|
64
|
+
// Check how the guard feels about the player
|
|
65
|
+
const rel = guardMemory.getRelationship('player');
|
|
66
|
+
// { trust: -0.15, fear: 0.25, admiration: -0.05, familiarity: 0 }
|
|
67
|
+
|
|
68
|
+
// Later, memories fade
|
|
69
|
+
guardMemory.consolidate(currentTick);
|
|
70
|
+
const memories = guardMemory.recall({ aboutEntity: 'player', minSalience: 0.5 });
|
|
71
|
+
```
|
|
72
72
|
|
|
73
73
|
### संबंधों के आयाम
|
|
74
74
|
|
package/README.it.md
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
<a href="README.ja.md">日本語</a> | <a href="README.zh.md">中文</a> | <a href="README.es.md">Español</a> | <a href="README.fr.md">Français</a> | <a href="README.hi.md">हिन्दी</a> | <a href="README.md">English</a> | <a href="README.pt-BR.md">Português (BR)</a>
|
|
3
3
|
</p>
|
|
4
4
|
|
|
5
|
-
<p align="center">
|
|
6
|
-
<img src="https://raw.githubusercontent.com/mcp-tool-shop-org/brand/main/logos/ai-rpg-engine/readme.png" width="400" alt="AI RPG Engine">
|
|
7
|
-
</p>
|
|
5
|
+
<p align="center">
|
|
6
|
+
<img src="https://raw.githubusercontent.com/mcp-tool-shop-org/brand/main/logos/ai-rpg-engine/readme.png" width="400" alt="AI RPG Engine">
|
|
7
|
+
</p>
|
|
8
8
|
|
|
9
9
|
# @ai-rpg-engine/campaign-memory
|
|
10
10
|
|
|
@@ -15,9 +15,9 @@ Memoria persistente dei personaggi non giocanti (PNG), relazioni multidimensiona
|
|
|
15
15
|
|
|
16
16
|
## Installazione
|
|
17
17
|
|
|
18
|
-
```bash
|
|
19
|
-
npm install @ai-rpg-engine/campaign-memory
|
|
20
|
-
```
|
|
18
|
+
```bash
|
|
19
|
+
npm install @ai-rpg-engine/campaign-memory
|
|
20
|
+
```
|
|
21
21
|
|
|
22
22
|
## Funzionalità
|
|
23
23
|
|
|
@@ -27,48 +27,48 @@ I PNG ricordano ciò che è successo. Non solo "ostile: true" — tracciano fidu
|
|
|
27
27
|
|
|
28
28
|
### Diario di campagna
|
|
29
29
|
|
|
30
|
-
```typescript
|
|
31
|
-
import { CampaignJournal } from '@ai-rpg-engine/campaign-memory';
|
|
32
|
-
|
|
33
|
-
const journal = new CampaignJournal();
|
|
34
|
-
|
|
35
|
-
// Record a significant event
|
|
36
|
-
const record = journal.record({
|
|
37
|
-
tick: 42,
|
|
38
|
-
category: 'kill',
|
|
39
|
-
actorId: 'player',
|
|
40
|
-
targetId: 'merchant_1',
|
|
41
|
-
zoneId: 'market',
|
|
42
|
-
description: 'Player killed the merchant during a robbery',
|
|
43
|
-
significance: 0.9,
|
|
44
|
-
witnesses: ['guard_1', 'bystander_2'],
|
|
45
|
-
data: { weapon: 'dagger' },
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
// Query the journal
|
|
49
|
-
const playerActions = journal.query({ actorId: 'player', category: 'kill' });
|
|
50
|
-
const merchantHistory = journal.getInvolving('merchant_1');
|
|
51
|
-
```
|
|
30
|
+
```typescript
|
|
31
|
+
import { CampaignJournal } from '@ai-rpg-engine/campaign-memory';
|
|
32
|
+
|
|
33
|
+
const journal = new CampaignJournal();
|
|
34
|
+
|
|
35
|
+
// Record a significant event
|
|
36
|
+
const record = journal.record({
|
|
37
|
+
tick: 42,
|
|
38
|
+
category: 'kill',
|
|
39
|
+
actorId: 'player',
|
|
40
|
+
targetId: 'merchant_1',
|
|
41
|
+
zoneId: 'market',
|
|
42
|
+
description: 'Player killed the merchant during a robbery',
|
|
43
|
+
significance: 0.9,
|
|
44
|
+
witnesses: ['guard_1', 'bystander_2'],
|
|
45
|
+
data: { weapon: 'dagger' },
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
// Query the journal
|
|
49
|
+
const playerActions = journal.query({ actorId: 'player', category: 'kill' });
|
|
50
|
+
const merchantHistory = journal.getInvolving('merchant_1');
|
|
51
|
+
```
|
|
52
52
|
|
|
53
53
|
### Banca di memoria dei PNG
|
|
54
54
|
|
|
55
|
-
```typescript
|
|
56
|
-
import { NpcMemoryBank, applyRelationshipEffect } from '@ai-rpg-engine/campaign-memory';
|
|
57
|
-
|
|
58
|
-
const guardMemory = new NpcMemoryBank('guard_1');
|
|
59
|
-
|
|
60
|
-
// Guard witnesses the player killing a merchant
|
|
61
|
-
guardMemory.remember(record, 0.9, -0.8); // high salience, very negative
|
|
62
|
-
applyRelationshipEffect(guardMemory, record, 'witness');
|
|
63
|
-
|
|
64
|
-
// Check how the guard feels about the player
|
|
65
|
-
const rel = guardMemory.getRelationship('player');
|
|
66
|
-
// { trust: -0.15, fear: 0.25, admiration: -0.05, familiarity: 0 }
|
|
67
|
-
|
|
68
|
-
// Later, memories fade
|
|
69
|
-
guardMemory.consolidate(currentTick);
|
|
70
|
-
const memories = guardMemory.recall({ aboutEntity: 'player', minSalience: 0.5 });
|
|
71
|
-
```
|
|
55
|
+
```typescript
|
|
56
|
+
import { NpcMemoryBank, applyRelationshipEffect } from '@ai-rpg-engine/campaign-memory';
|
|
57
|
+
|
|
58
|
+
const guardMemory = new NpcMemoryBank('guard_1');
|
|
59
|
+
|
|
60
|
+
// Guard witnesses the player killing a merchant
|
|
61
|
+
guardMemory.remember(record, 0.9, -0.8); // high salience, very negative
|
|
62
|
+
applyRelationshipEffect(guardMemory, record, 'witness');
|
|
63
|
+
|
|
64
|
+
// Check how the guard feels about the player
|
|
65
|
+
const rel = guardMemory.getRelationship('player');
|
|
66
|
+
// { trust: -0.15, fear: 0.25, admiration: -0.05, familiarity: 0 }
|
|
67
|
+
|
|
68
|
+
// Later, memories fade
|
|
69
|
+
guardMemory.consolidate(currentTick);
|
|
70
|
+
const memories = guardMemory.recall({ aboutEntity: 'player', minSalience: 0.5 });
|
|
71
|
+
```
|
|
72
72
|
|
|
73
73
|
### Assi di relazione
|
|
74
74
|
|
package/README.ja.md
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
<a href="README.md">English</a> | <a href="README.zh.md">中文</a> | <a href="README.es.md">Español</a> | <a href="README.fr.md">Français</a> | <a href="README.hi.md">हिन्दी</a> | <a href="README.it.md">Italiano</a> | <a href="README.pt-BR.md">Português (BR)</a>
|
|
3
3
|
</p>
|
|
4
4
|
|
|
5
|
-
<p align="center">
|
|
6
|
-
<img src="https://raw.githubusercontent.com/mcp-tool-shop-org/brand/main/logos/ai-rpg-engine/readme.png" width="400" alt="AI RPG Engine">
|
|
7
|
-
</p>
|
|
5
|
+
<p align="center">
|
|
6
|
+
<img src="https://raw.githubusercontent.com/mcp-tool-shop-org/brand/main/logos/ai-rpg-engine/readme.png" width="400" alt="AI RPG Engine">
|
|
7
|
+
</p>
|
|
8
8
|
|
|
9
9
|
# @ai-rpg-engine/campaign-memory
|
|
10
10
|
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
|
|
16
16
|
## インストール
|
|
17
17
|
|
|
18
|
-
```bash
|
|
19
|
-
npm install @ai-rpg-engine/campaign-memory
|
|
20
|
-
```
|
|
18
|
+
```bash
|
|
19
|
+
npm install @ai-rpg-engine/campaign-memory
|
|
20
|
+
```
|
|
21
21
|
|
|
22
22
|
## 機能概要
|
|
23
23
|
|
|
@@ -27,48 +27,48 @@ NPCは、起こったことを記憶します。単に「敵対的:true」と
|
|
|
27
27
|
|
|
28
28
|
### キャンペーンジャーナル
|
|
29
29
|
|
|
30
|
-
```typescript
|
|
31
|
-
import { CampaignJournal } from '@ai-rpg-engine/campaign-memory';
|
|
32
|
-
|
|
33
|
-
const journal = new CampaignJournal();
|
|
34
|
-
|
|
35
|
-
// Record a significant event
|
|
36
|
-
const record = journal.record({
|
|
37
|
-
tick: 42,
|
|
38
|
-
category: 'kill',
|
|
39
|
-
actorId: 'player',
|
|
40
|
-
targetId: 'merchant_1',
|
|
41
|
-
zoneId: 'market',
|
|
42
|
-
description: 'Player killed the merchant during a robbery',
|
|
43
|
-
significance: 0.9,
|
|
44
|
-
witnesses: ['guard_1', 'bystander_2'],
|
|
45
|
-
data: { weapon: 'dagger' },
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
// Query the journal
|
|
49
|
-
const playerActions = journal.query({ actorId: 'player', category: 'kill' });
|
|
50
|
-
const merchantHistory = journal.getInvolving('merchant_1');
|
|
51
|
-
```
|
|
30
|
+
```typescript
|
|
31
|
+
import { CampaignJournal } from '@ai-rpg-engine/campaign-memory';
|
|
32
|
+
|
|
33
|
+
const journal = new CampaignJournal();
|
|
34
|
+
|
|
35
|
+
// Record a significant event
|
|
36
|
+
const record = journal.record({
|
|
37
|
+
tick: 42,
|
|
38
|
+
category: 'kill',
|
|
39
|
+
actorId: 'player',
|
|
40
|
+
targetId: 'merchant_1',
|
|
41
|
+
zoneId: 'market',
|
|
42
|
+
description: 'Player killed the merchant during a robbery',
|
|
43
|
+
significance: 0.9,
|
|
44
|
+
witnesses: ['guard_1', 'bystander_2'],
|
|
45
|
+
data: { weapon: 'dagger' },
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
// Query the journal
|
|
49
|
+
const playerActions = journal.query({ actorId: 'player', category: 'kill' });
|
|
50
|
+
const merchantHistory = journal.getInvolving('merchant_1');
|
|
51
|
+
```
|
|
52
52
|
|
|
53
53
|
### NPCの記憶バンク
|
|
54
54
|
|
|
55
|
-
```typescript
|
|
56
|
-
import { NpcMemoryBank, applyRelationshipEffect } from '@ai-rpg-engine/campaign-memory';
|
|
57
|
-
|
|
58
|
-
const guardMemory = new NpcMemoryBank('guard_1');
|
|
59
|
-
|
|
60
|
-
// Guard witnesses the player killing a merchant
|
|
61
|
-
guardMemory.remember(record, 0.9, -0.8); // high salience, very negative
|
|
62
|
-
applyRelationshipEffect(guardMemory, record, 'witness');
|
|
63
|
-
|
|
64
|
-
// Check how the guard feels about the player
|
|
65
|
-
const rel = guardMemory.getRelationship('player');
|
|
66
|
-
// { trust: -0.15, fear: 0.25, admiration: -0.05, familiarity: 0 }
|
|
67
|
-
|
|
68
|
-
// Later, memories fade
|
|
69
|
-
guardMemory.consolidate(currentTick);
|
|
70
|
-
const memories = guardMemory.recall({ aboutEntity: 'player', minSalience: 0.5 });
|
|
71
|
-
```
|
|
55
|
+
```typescript
|
|
56
|
+
import { NpcMemoryBank, applyRelationshipEffect } from '@ai-rpg-engine/campaign-memory';
|
|
57
|
+
|
|
58
|
+
const guardMemory = new NpcMemoryBank('guard_1');
|
|
59
|
+
|
|
60
|
+
// Guard witnesses the player killing a merchant
|
|
61
|
+
guardMemory.remember(record, 0.9, -0.8); // high salience, very negative
|
|
62
|
+
applyRelationshipEffect(guardMemory, record, 'witness');
|
|
63
|
+
|
|
64
|
+
// Check how the guard feels about the player
|
|
65
|
+
const rel = guardMemory.getRelationship('player');
|
|
66
|
+
// { trust: -0.15, fear: 0.25, admiration: -0.05, familiarity: 0 }
|
|
67
|
+
|
|
68
|
+
// Later, memories fade
|
|
69
|
+
guardMemory.consolidate(currentTick);
|
|
70
|
+
const memories = guardMemory.recall({ aboutEntity: 'player', minSalience: 0.5 });
|
|
71
|
+
```
|
|
72
72
|
|
|
73
73
|
### 関係性の軸
|
|
74
74
|
|