@gemwright/ai 0.0.0 → 0.8.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.
Files changed (59) hide show
  1. package/Dockerfile +12 -0
  2. package/README.md +82 -1
  3. package/catalogs/aggressive-bodies.json +1 -0
  4. package/catalogs/crafts/alchemy.json +22 -0
  5. package/catalogs/crafts/blacksmith.json +110 -0
  6. package/catalogs/crafts/bowcraft.json +13 -0
  7. package/catalogs/crafts/carpentry.json +105 -0
  8. package/catalogs/crafts/inscription.json +67 -0
  9. package/catalogs/crafts/tailoring.json +72 -0
  10. package/catalogs/crafts/tinkering.json +61 -0
  11. package/catalogs/dungeons/covetous.json +1 -0
  12. package/catalogs/dungeons/deceit.json +1 -0
  13. package/catalogs/dungeons/despise.json +1 -0
  14. package/catalogs/dungeons/destard.json +1 -0
  15. package/catalogs/dungeons/fire.json +1 -0
  16. package/catalogs/dungeons/hythloth.json +1 -0
  17. package/catalogs/dungeons/ice.json +1 -0
  18. package/catalogs/dungeons/khaldun.json +1 -0
  19. package/catalogs/dungeons/misc-dungeons.json +1 -0
  20. package/catalogs/dungeons/orc-cave.json +1 -0
  21. package/catalogs/dungeons/shame.json +1 -0
  22. package/catalogs/dungeons/terathan-keep.json +1 -0
  23. package/catalogs/dungeons/wrong.json +1 -0
  24. package/catalogs/house-lots.json +86 -0
  25. package/catalogs/hunting-grounds.json +10071 -0
  26. package/catalogs/magery-spells.json +697 -0
  27. package/catalogs/monsters.json +1 -0
  28. package/catalogs/prices.json +466 -0
  29. package/catalogs/tamables.json +864 -0
  30. package/catalogs/taming-grounds.json +2198 -0
  31. package/dist/index.js +55289 -0
  32. package/dist/life-journal-worker.js +469 -0
  33. package/dist/load-test.js +55098 -0
  34. package/dist/path-worker.js +1384 -0
  35. package/dist/persistence-worker.js +16503 -0
  36. package/dist/progress-report.js +182 -0
  37. package/dist/report.js +163 -0
  38. package/dist/serve.js +62078 -0
  39. package/locations/ankhs.json +91 -0
  40. package/locations/areas.json +760 -0
  41. package/locations/cobblers.json +148 -0
  42. package/locations/escorts.json +115 -0
  43. package/locations/forges.json +18 -0
  44. package/locations/locations.json +1501 -0
  45. package/locations/new-haven.json +522 -0
  46. package/locations/route-corridors.json +1 -0
  47. package/locations/services-guide.json +1329 -0
  48. package/locations/services.json +144 -0
  49. package/locations/teleporters.json +38 -0
  50. package/locations/vendors.json +1503 -0
  51. package/package.json +39 -3
  52. package/railway.json +6 -0
  53. package/start.sh +36 -0
  54. package/templates/archetypes-new-haven.json +38 -0
  55. package/templates/archetypes.json +274 -0
  56. package/templates/population.example.json +123 -0
  57. package/tuning.json +17 -0
  58. package/world/names.json +4055 -0
  59. package/world/world.json +743 -0
package/package.json CHANGED
@@ -1,9 +1,45 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@gemwright/ai",
4
- "description": "Forge your own shard",
5
- "version": "0.0.0",
4
+ "description": "Independent ServUO resident runtime",
5
+ "version": "0.8.1",
6
6
  "type": "module",
7
+ "license": "MIT",
7
8
  "private": false,
8
- "license": "MIT"
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/gokaygurcan/gemwright.git",
12
+ "directory": "packages/ai"
13
+ },
14
+ "engines": {
15
+ "bun": ">=1.4.3"
16
+ },
17
+ "scripts": {
18
+ "start": "bun dist/serve.js",
19
+ "dev": "bun --watch src/serve.ts",
20
+ "build": "rm -rf dist && bun build src/index.ts src/serve.ts src/report.ts src/progress-report.ts src/load-test.ts src/persistence-worker.ts src/life-journal-worker.ts src/path-worker.ts --outdir dist --target bun && cp ../../LICENSE ."
21
+ },
22
+ "devDependencies": {
23
+ "@gemwright/common": "workspace:*",
24
+ "@gemwright/network": "workspace:*",
25
+ "@anthropic-ai/sdk": "1.3.0",
26
+ "@typesafe-ai/sdk": "0.7.0"
27
+ },
28
+ "files": [
29
+ "dist/",
30
+ "catalogs/",
31
+ "locations/",
32
+ "templates/",
33
+ "world/",
34
+ "tuning.json",
35
+ "start.sh",
36
+ "Dockerfile",
37
+ "railway.json"
38
+ ],
39
+ "publishConfig": {
40
+ "access": "public"
41
+ },
42
+ "gemwright": {
43
+ "schemaVersion": 1
44
+ }
9
45
  }
package/railway.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "$schema": "https://railway.com/railway.schema.json",
3
+ "deploy": {
4
+ "restartPolicyType": "ALWAYS"
5
+ }
6
+ }
package/start.sh ADDED
@@ -0,0 +1,36 @@
1
+ #!/bin/sh
2
+ set -eu
3
+
4
+ rm -f /app/data/.ai-ready
5
+
6
+ # gemwright restore uploads a pulled resident database to restore/ and restarts this service: it
7
+ # replaces the current one here, before the residents start, and the replaced one is kept.
8
+ if [ -e /app/data/restore/residents.sqlite ]; then
9
+ rm -f /app/data/residents.sqlite.before-restore
10
+ if [ -e /app/data/residents.sqlite ]; then mv /app/data/residents.sqlite /app/data/residents.sqlite.before-restore; fi
11
+ rm -f /app/data/residents.sqlite-wal /app/data/residents.sqlite-shm
12
+ mv /app/data/restore/residents.sqlite /app/data/residents.sqlite
13
+ rm -rf /app/data/restore
14
+ echo 'Restored the resident database from a gemwright pull.'
15
+ fi
16
+
17
+ # The deployment uploads the map files the residents walk by as /app/data/assets.tar.gz.
18
+ trap 'exit 0' TERM INT
19
+ # A newer upload replaces the extracted files.
20
+ while [ ! -e /app/data/.assets-ready ] || [ -e /app/data/assets.tar.gz ]; do
21
+ if [ -e /app/data/assets.tar.gz ]; then
22
+ rm -rf /app/data/assets
23
+ mkdir -p /app/data/assets
24
+ tar -xzf /app/data/assets.tar.gz -C /app/data/assets
25
+ touch /app/data/.assets-ready
26
+ rm /app/data/assets.tar.gz
27
+ else
28
+ echo 'Waiting for map files on the data volume.'
29
+ sleep 3 &
30
+ wait $! || true
31
+ fi
32
+ done
33
+ trap - TERM INT
34
+
35
+ cd /app
36
+ exec bun /app/dist/serve.js
@@ -0,0 +1,38 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "archetypes": [
4
+ {
5
+ "id": "scribe-mage",
6
+ "version": 1,
7
+ "primarySkills": ["Magery", "Inscription"],
8
+ "supportingSkills": [
9
+ "Eval Int",
10
+ "Meditation",
11
+ "Magic Resist",
12
+ "Wrestling"
13
+ ],
14
+ "stats": {
15
+ "str": 60,
16
+ "dex": 25,
17
+ "int": 100
18
+ }
19
+ },
20
+ {
21
+ "id": "warlock",
22
+ "version": 1,
23
+ "primarySkills": ["Necromancy", "Magery"],
24
+ "supportingSkills": [
25
+ "Spirit Speak",
26
+ "Eval Int",
27
+ "Meditation",
28
+ "Magic Resist",
29
+ "Wrestling"
30
+ ],
31
+ "stats": {
32
+ "str": 80,
33
+ "dex": 25,
34
+ "int": 100
35
+ }
36
+ }
37
+ ]
38
+ }
@@ -0,0 +1,274 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "archetypes": [
4
+ {
5
+ "id": "pure-mage",
6
+ "version": 1,
7
+ "primarySkills": ["Magery", "Eval Int"],
8
+ "supportingSkills": [
9
+ "Meditation",
10
+ "Magic Resist",
11
+ "Wrestling",
12
+ "Anatomy",
13
+ "Healing",
14
+ "Inscription"
15
+ ],
16
+ "stats": {
17
+ "str": 100,
18
+ "dex": 25,
19
+ "int": 100
20
+ }
21
+ },
22
+ {
23
+ "id": "tank-mage",
24
+ "version": 1,
25
+ "primarySkills": ["Magery", "Tactics"],
26
+ "supportingSkills": [
27
+ "Magic Resist",
28
+ "Meditation",
29
+ "Swordsmanship",
30
+ "Anatomy",
31
+ "Healing",
32
+ "Eval Int"
33
+ ],
34
+ "stats": {
35
+ "str": 100,
36
+ "dex": 45,
37
+ "int": 80
38
+ }
39
+ },
40
+ {
41
+ "id": "swordsman",
42
+ "version": 1,
43
+ "primarySkills": ["Swordsmanship", "Tactics"],
44
+ "supportingSkills": [
45
+ "Anatomy",
46
+ "Healing",
47
+ "Magic Resist",
48
+ "Parrying",
49
+ "Arms Lore",
50
+ "Lumberjacking"
51
+ ],
52
+ "stats": {
53
+ "str": 100,
54
+ "dex": 100,
55
+ "int": 25
56
+ }
57
+ },
58
+ {
59
+ "id": "mace-fighter",
60
+ "version": 1,
61
+ "primarySkills": ["Mace Fighting", "Tactics"],
62
+ "supportingSkills": [
63
+ "Anatomy",
64
+ "Healing",
65
+ "Magic Resist",
66
+ "Parrying",
67
+ "Arms Lore",
68
+ "Wrestling"
69
+ ],
70
+ "stats": {
71
+ "str": 100,
72
+ "dex": 100,
73
+ "int": 25
74
+ }
75
+ },
76
+ {
77
+ "id": "fencer",
78
+ "version": 1,
79
+ "primarySkills": ["Fencing", "Tactics"],
80
+ "supportingSkills": [
81
+ "Anatomy",
82
+ "Healing",
83
+ "Magic Resist",
84
+ "Parrying",
85
+ "Arms Lore",
86
+ "Poisoning"
87
+ ],
88
+ "stats": {
89
+ "str": 100,
90
+ "dex": 100,
91
+ "int": 25
92
+ }
93
+ },
94
+ {
95
+ "id": "archer",
96
+ "version": 1,
97
+ "primarySkills": ["Archery", "Tactics"],
98
+ "supportingSkills": [
99
+ "Anatomy",
100
+ "Healing",
101
+ "Magic Resist",
102
+ "Arms Lore",
103
+ "Hiding",
104
+ "Tracking"
105
+ ],
106
+ "stats": {
107
+ "str": 100,
108
+ "dex": 100,
109
+ "int": 25
110
+ }
111
+ },
112
+ {
113
+ "id": "bard",
114
+ "version": 1,
115
+ "primarySkills": ["Provocation", "Musicianship"],
116
+ "supportingSkills": [
117
+ "Discordance",
118
+ "Peacemaking",
119
+ "Magery",
120
+ "Magic Resist",
121
+ "Meditation",
122
+ "Eval Int"
123
+ ],
124
+ "stats": {
125
+ "str": 90,
126
+ "dex": 45,
127
+ "int": 90
128
+ }
129
+ },
130
+ {
131
+ "id": "tamer",
132
+ "version": 1,
133
+ "primarySkills": ["Animal Taming", "Animal Lore"],
134
+ "supportingSkills": [
135
+ "Magery",
136
+ "Magic Resist",
137
+ "Meditation",
138
+ "Eval Int",
139
+ "Veterinary",
140
+ "Musicianship"
141
+ ],
142
+ "stats": {
143
+ "str": 100,
144
+ "dex": 25,
145
+ "int": 100
146
+ }
147
+ },
148
+ {
149
+ "id": "archer-tamer",
150
+ "version": 1,
151
+ "primarySkills": ["Animal Taming", "Archery"],
152
+ "supportingSkills": [
153
+ "Animal Lore",
154
+ "Veterinary",
155
+ "Tactics",
156
+ "Anatomy",
157
+ "Healing"
158
+ ],
159
+ "stats": {
160
+ "str": 90,
161
+ "dex": 90,
162
+ "int": 45
163
+ }
164
+ },
165
+ {
166
+ "id": "thief",
167
+ "version": 1,
168
+ "primarySkills": ["Stealing", "Snooping"],
169
+ "supportingSkills": [
170
+ "Magery",
171
+ "Magic Resist",
172
+ "Meditation",
173
+ "Hiding",
174
+ "Stealth",
175
+ "Detect Hidden"
176
+ ],
177
+ "stats": {
178
+ "str": 100,
179
+ "dex": 80,
180
+ "int": 45
181
+ }
182
+ },
183
+ {
184
+ "id": "craftsman",
185
+ "version": 1,
186
+ "primarySkills": ["Blacksmithy", "Mining"],
187
+ "supportingSkills": [
188
+ "Magery",
189
+ "Tinkering",
190
+ "Arms Lore",
191
+ "Tailoring",
192
+ "Carpentry",
193
+ "Imbuing"
194
+ ],
195
+ "stats": {
196
+ "str": 100,
197
+ "dex": 25,
198
+ "int": 100
199
+ }
200
+ },
201
+ {
202
+ "id": "fisherman",
203
+ "version": 1,
204
+ "primarySkills": ["Fishing", "Cooking"],
205
+ "supportingSkills": [
206
+ "Tactics",
207
+ "Swordsmanship",
208
+ "Healing",
209
+ "Anatomy",
210
+ "Magic Resist",
211
+ "Arms Lore"
212
+ ],
213
+ "stats": {
214
+ "str": 100,
215
+ "dex": 50,
216
+ "int": 75
217
+ }
218
+ },
219
+ {
220
+ "id": "tailor",
221
+ "version": 1,
222
+ "primarySkills": ["Tailoring", "Arms Lore"],
223
+ "supportingSkills": [
224
+ "Magery",
225
+ "Meditation",
226
+ "Tinkering",
227
+ "Carpentry",
228
+ "Anatomy",
229
+ "Imbuing"
230
+ ],
231
+ "stats": {
232
+ "str": 100,
233
+ "dex": 25,
234
+ "int": 100
235
+ }
236
+ },
237
+ {
238
+ "id": "alchemist",
239
+ "version": 1,
240
+ "primarySkills": ["Alchemy", "Magery"],
241
+ "supportingSkills": [
242
+ "Meditation",
243
+ "Magic Resist",
244
+ "Eval Int",
245
+ "Inscription",
246
+ "Taste ID",
247
+ "Healing"
248
+ ],
249
+ "stats": {
250
+ "str": 100,
251
+ "dex": 25,
252
+ "int": 100
253
+ }
254
+ },
255
+ {
256
+ "id": "bowyer",
257
+ "version": 1,
258
+ "primarySkills": ["Fletching", "Archery"],
259
+ "supportingSkills": [
260
+ "Tactics",
261
+ "Anatomy",
262
+ "Healing",
263
+ "Lumberjacking",
264
+ "Carpentry",
265
+ "Magic Resist"
266
+ ],
267
+ "stats": {
268
+ "str": 100,
269
+ "dex": 100,
270
+ "int": 25
271
+ }
272
+ }
273
+ ]
274
+ }
@@ -0,0 +1,123 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "shardId": "example-shard",
4
+ "targetPopulation": 4,
5
+ "templates": [
6
+ {
7
+ "id": "britain-miner",
8
+ "version": 4,
9
+ "label": "Minoc miner",
10
+ "creation": {
11
+ "namePrefix": "Miner",
12
+ "city": "Minoc",
13
+ "skills": {
14
+ "Mining": 50,
15
+ "Blacksmith": 50
16
+ },
17
+ "equipment": [],
18
+ "provisioning": "normal-character-creation"
19
+ },
20
+ "behavior": {
21
+ "activities": ["mine", "smelt", "bank", "sell", "restock", "socialize"],
22
+ "trainingGoals": {
23
+ "Mining": 100,
24
+ "Blacksmith": 100
25
+ },
26
+ "riskTolerance": 0.2,
27
+ "sociability": 0.4,
28
+ "cooperation": 0.7,
29
+ "supplies": {
30
+ "pickaxe": 1
31
+ },
32
+ "bankAtWeightRatio": 0.8,
33
+ "corpseRecovery": "seek-help"
34
+ },
35
+ "archetype": {
36
+ "id": "craftsman",
37
+ "version": 1
38
+ }
39
+ },
40
+ {
41
+ "id": "britain-swordsman",
42
+ "version": 2,
43
+ "label": "Britain swordsman",
44
+ "creation": {
45
+ "namePrefix": "Adventurer",
46
+ "city": "Britain",
47
+ "skills": {
48
+ "Swordsmanship": 50,
49
+ "Tactics": 50
50
+ },
51
+ "equipment": [],
52
+ "provisioning": "normal-character-creation"
53
+ },
54
+ "behavior": {
55
+ "activities": ["hunt", "train", "bank", "restock", "socialize"],
56
+ "trainingGoals": {
57
+ "Swordsmanship": 100,
58
+ "Healing": 100,
59
+ "Tactics": 100
60
+ },
61
+ "riskTolerance": 0.5,
62
+ "sociability": 0.6,
63
+ "cooperation": 0.8,
64
+ "supplies": {
65
+ "bandage": 30
66
+ },
67
+ "bankAtWeightRatio": 0.75,
68
+ "corpseRecovery": "recover-if-safe"
69
+ },
70
+ "archetype": {
71
+ "id": "swordsman",
72
+ "version": 1
73
+ }
74
+ },
75
+ {
76
+ "id": "britain-lumberjack",
77
+ "version": 4,
78
+ "label": "Britain lumberjack",
79
+ "creation": {
80
+ "namePrefix": "Woodcutter",
81
+ "city": "Britain",
82
+ "skills": {
83
+ "Lumberjacking": 50,
84
+ "Carpentry": 50
85
+ },
86
+ "equipment": [],
87
+ "provisioning": "normal-character-creation"
88
+ },
89
+ "behavior": {
90
+ "activities": ["chop", "cut", "sell", "bank", "restock", "socialize"],
91
+ "trainingGoals": {
92
+ "Lumberjacking": 100,
93
+ "Carpentry": 100
94
+ },
95
+ "riskTolerance": 0.2,
96
+ "sociability": 0.4,
97
+ "cooperation": 0.7,
98
+ "supplies": {
99
+ "hatchet": 1
100
+ },
101
+ "bankAtWeightRatio": 0.8,
102
+ "corpseRecovery": "seek-help"
103
+ },
104
+ "archetype": {
105
+ "id": "craftsman",
106
+ "version": 1
107
+ }
108
+ }
109
+ ],
110
+ "allocation": {
111
+ "mode": "weighted",
112
+ "entries": [
113
+ {
114
+ "templateId": "britain-miner",
115
+ "weight": 1
116
+ },
117
+ {
118
+ "templateId": "britain-swordsman",
119
+ "weight": 1
120
+ }
121
+ ]
122
+ }
123
+ }
package/tuning.json ADDED
@@ -0,0 +1,17 @@
1
+ {
2
+ "escort": { "seekBelowGold": 1000, "walkToGate": 250 },
3
+ "fighter": {
4
+ "supplyRunMinGold": 150,
5
+ "ammoLow": 20,
6
+ "reagentLow": 3,
7
+ "carriedGold": 500
8
+ },
9
+ "sideTrade": {
10
+ "checkHours": 3,
11
+ "spellHours": 2,
12
+ "lessonTo": 30,
13
+ "lessonMinGold": 500
14
+ },
15
+ "trouble": { "holdHours": 6, "penaltyAt": 3, "stepCost": 4 },
16
+ "taming": { "emptySearches": 6, "givenUpHours": 1 }
17
+ }