@scrolled/nav-graph 0.1.0 → 0.1.1-dev.3bb0204
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 +38 -24
- package/dist/compile/compileGraph.d.ts.map +1 -1
- package/dist/compile/compileGraph.js +23 -0
- package/dist/compile/compileGraph.js.map +1 -1
- package/dist/dsl/builder.d.ts +41 -8
- package/dist/dsl/builder.d.ts.map +1 -1
- package/dist/dsl/builder.js +26 -4
- package/dist/dsl/builder.js.map +1 -1
- package/dist/dsl/index.d.ts +1 -1
- package/dist/dsl/index.d.ts.map +1 -1
- package/dist/dsl/index.js.map +1 -1
- package/dist/graphs/starter/index.d.ts.map +1 -1
- package/dist/graphs/starter/index.js +14 -5
- package/dist/graphs/starter/index.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/ir/schema.d.ts +103 -19
- package/dist/ir/schema.d.ts.map +1 -1
- package/dist/ir/schema.js +16 -2
- package/dist/ir/schema.js.map +1 -1
- package/dist/ir/types.d.ts +27 -3
- package/dist/ir/types.d.ts.map +1 -1
- package/dist/ir/types.js +10 -1
- package/dist/ir/types.js.map +1 -1
- package/dist/path/findPath.d.ts +33 -0
- package/dist/path/findPath.d.ts.map +1 -1
- package/dist/path/findPath.js +135 -27
- package/dist/path/findPath.js.map +1 -1
- package/dist/path/index.d.ts +2 -2
- package/dist/path/index.d.ts.map +1 -1
- package/dist/path/index.js +1 -1
- package/dist/path/index.js.map +1 -1
- package/package.json +4 -1
package/dist/path/findPath.js
CHANGED
|
@@ -1,37 +1,79 @@
|
|
|
1
|
-
//
|
|
1
|
+
// Weighted pathfinding: least-time Dijkstra over the compiled adjacency.
|
|
2
|
+
//
|
|
3
|
+
// Two methods cost time — `walk` and `transport` (boats/trains/carpets). Each
|
|
4
|
+
// costs its declared `seconds`, or its method default when untimed, so a graph
|
|
5
|
+
// with no times set still routes sensibly. Every other method (portal, npc,
|
|
6
|
+
// item, skill) is a teleport-like transition, treated as instant.
|
|
7
|
+
//
|
|
8
|
+
// `transport` time is *conditional*: with fast travel enabled (the player holds
|
|
9
|
+
// a fast-travel ticket), every transport hop is instant, so routes prefer boats
|
|
10
|
+
// over long walks; without it, transports cost their ride time and the router
|
|
11
|
+
// may route around them.
|
|
12
|
+
//
|
|
13
|
+
// `scroll` edges (return-to-nearest-town) are *availability*-conditional: they
|
|
14
|
+
// are traversable only when `nearestTownScroll` is set (the player carries
|
|
15
|
+
// return scrolls). They are instant like other teleports when enabled.
|
|
2
16
|
//
|
|
3
17
|
// When an eligibility predicate is supplied:
|
|
4
|
-
// 1. Run
|
|
18
|
+
// 1. Run Dijkstra with the predicate pruning candidate edges.
|
|
5
19
|
// 2. If the destination is reachable that way, return `status: 'found'`.
|
|
6
|
-
// 3. Otherwise run
|
|
7
|
-
// `status: 'unreachable-when-filtered'` with the unfiltered path as
|
|
20
|
+
// 3. Otherwise run Dijkstra again *without* the filter. If a path exists,
|
|
21
|
+
// return `status: 'unreachable-when-filtered'` with the unfiltered path as
|
|
8
22
|
// `fallback` and the step indices the filter blocked. This is FR7 — the
|
|
9
23
|
// app never has to surface a blank "no path" state when the graph itself
|
|
10
24
|
// is connected.
|
|
11
|
-
// 4. If the unfiltered
|
|
25
|
+
// 4. If the unfiltered search also fails, return `status: 'unreachable'`.
|
|
26
|
+
/** Assumed travel time, in seconds, for a walk edge that declares no `seconds`. */
|
|
27
|
+
export const DEFAULT_WALK_SECONDS = 60;
|
|
28
|
+
/**
|
|
29
|
+
* Assumed ride time, in seconds, for a transport edge that declares no
|
|
30
|
+
* `seconds`. Longer than a walk hop: boarding a boat/train means waiting for it.
|
|
31
|
+
*/
|
|
32
|
+
export const DEFAULT_TRANSPORT_SECONDS = 300;
|
|
33
|
+
/**
|
|
34
|
+
* Travel time an edge contributes to a route. `walk` always costs time;
|
|
35
|
+
* `transport` costs its ride time unless `fastTravel` waives it; portal / npc /
|
|
36
|
+
* item / skill transitions teleport the player instantly.
|
|
37
|
+
*/
|
|
38
|
+
export function edgeSeconds(edge, opts = {}) {
|
|
39
|
+
switch (edge.method) {
|
|
40
|
+
case 'walk':
|
|
41
|
+
return edge.seconds ?? DEFAULT_WALK_SECONDS;
|
|
42
|
+
case 'transport':
|
|
43
|
+
return opts.fastTravel ? 0 : (edge.seconds ?? DEFAULT_TRANSPORT_SECONDS);
|
|
44
|
+
default:
|
|
45
|
+
return 0;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
12
48
|
export function findPath(graph, from, to, opts = {}) {
|
|
13
49
|
assertNodeKnown(graph, from, 'from');
|
|
14
50
|
assertNodeKnown(graph, to, 'to');
|
|
15
51
|
if (from === to)
|
|
16
|
-
return { status: 'found', steps: [] };
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
52
|
+
return { status: 'found', steps: [], totalSeconds: 0 };
|
|
53
|
+
const cost = { fastTravel: opts.fastTravel };
|
|
54
|
+
const allowScroll = opts.nearestTownScroll ?? false;
|
|
55
|
+
const filtered = opts.eligible
|
|
56
|
+
? dijkstra(graph, from, to, cost, allowScroll, opts.eligible)
|
|
57
|
+
: null;
|
|
58
|
+
if (filtered) {
|
|
59
|
+
return { status: 'found', steps: filtered.steps, totalSeconds: filtered.totalSeconds };
|
|
60
|
+
}
|
|
61
|
+
const unfiltered = dijkstra(graph, from, to, cost, allowScroll);
|
|
21
62
|
if (!unfiltered)
|
|
22
|
-
return { status: 'unreachable', steps: [] };
|
|
63
|
+
return { status: 'unreachable', steps: [], totalSeconds: 0 };
|
|
23
64
|
if (!opts.eligible) {
|
|
24
|
-
return { status: 'found', steps: unfiltered };
|
|
65
|
+
return { status: 'found', steps: unfiltered.steps, totalSeconds: unfiltered.totalSeconds };
|
|
25
66
|
}
|
|
26
67
|
const blocked = [];
|
|
27
|
-
unfiltered.forEach((edge, i) => {
|
|
68
|
+
unfiltered.steps.forEach((edge, i) => {
|
|
28
69
|
if (!opts.eligible(edge))
|
|
29
70
|
blocked.push(i);
|
|
30
71
|
});
|
|
31
72
|
return {
|
|
32
73
|
status: 'unreachable-when-filtered',
|
|
33
74
|
steps: [],
|
|
34
|
-
|
|
75
|
+
totalSeconds: 0,
|
|
76
|
+
fallback: { steps: unfiltered.steps, totalSeconds: unfiltered.totalSeconds, blocked },
|
|
35
77
|
};
|
|
36
78
|
}
|
|
37
79
|
function assertNodeKnown(graph, id, label) {
|
|
@@ -39,23 +81,33 @@ function assertNodeKnown(graph, id, label) {
|
|
|
39
81
|
throw new Error(`findPath ${label} references undeclared node "${id}".`);
|
|
40
82
|
}
|
|
41
83
|
}
|
|
42
|
-
function
|
|
84
|
+
function dijkstra(graph, from, to, cost, allowScroll, eligible) {
|
|
85
|
+
const dist = new Map([[from, 0]]);
|
|
43
86
|
const cameFrom = new Map();
|
|
44
|
-
const
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
87
|
+
const settled = new Set();
|
|
88
|
+
const frontier = new MinHeap();
|
|
89
|
+
frontier.push(from, 0);
|
|
90
|
+
while (!frontier.isEmpty()) {
|
|
91
|
+
const node = frontier.pop();
|
|
92
|
+
if (settled.has(node))
|
|
93
|
+
continue; // stale heap entry — already finalized
|
|
48
94
|
if (node === to)
|
|
49
|
-
return reconstruct(cameFrom, from, to);
|
|
50
|
-
|
|
51
|
-
|
|
95
|
+
return { steps: reconstruct(cameFrom, from, to), totalSeconds: dist.get(to) };
|
|
96
|
+
settled.add(node);
|
|
97
|
+
const base = dist.get(node);
|
|
98
|
+
for (const edge of graph.adjacency.get(node) ?? []) {
|
|
99
|
+
if (edge.method === 'scroll' && !allowScroll)
|
|
100
|
+
continue;
|
|
52
101
|
if (eligible && !eligible(edge))
|
|
53
102
|
continue;
|
|
54
|
-
if (
|
|
103
|
+
if (settled.has(edge.to))
|
|
55
104
|
continue;
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
105
|
+
const next = base + edgeSeconds(edge, cost);
|
|
106
|
+
if (next < (dist.get(edge.to) ?? Infinity)) {
|
|
107
|
+
dist.set(edge.to, next);
|
|
108
|
+
cameFrom.set(edge.to, edge);
|
|
109
|
+
frontier.push(edge.to, next);
|
|
110
|
+
}
|
|
59
111
|
}
|
|
60
112
|
}
|
|
61
113
|
return null;
|
|
@@ -66,7 +118,7 @@ function reconstruct(cameFrom, from, to) {
|
|
|
66
118
|
while (cursor !== from) {
|
|
67
119
|
const edge = cameFrom.get(cursor);
|
|
68
120
|
if (!edge) {
|
|
69
|
-
// Defensive:
|
|
121
|
+
// Defensive: Dijkstra only stores cameFrom for reachable nodes, so this
|
|
70
122
|
// branch is unreachable in practice — but typing the lookup demands it.
|
|
71
123
|
throw new Error(`Path reconstruction broke at "${cursor}".`);
|
|
72
124
|
}
|
|
@@ -75,4 +127,60 @@ function reconstruct(cameFrom, from, to) {
|
|
|
75
127
|
}
|
|
76
128
|
return steps.reverse();
|
|
77
129
|
}
|
|
130
|
+
// Binary min-heap keyed by tentative distance. Uses lazy deletion — a node can
|
|
131
|
+
// appear more than once and settled entries are skipped on pop.
|
|
132
|
+
class MinHeap {
|
|
133
|
+
nodes = [];
|
|
134
|
+
keys = [];
|
|
135
|
+
isEmpty() {
|
|
136
|
+
return this.nodes.length === 0;
|
|
137
|
+
}
|
|
138
|
+
push(node, key) {
|
|
139
|
+
this.nodes.push(node);
|
|
140
|
+
this.keys.push(key);
|
|
141
|
+
this.bubbleUp(this.nodes.length - 1);
|
|
142
|
+
}
|
|
143
|
+
pop() {
|
|
144
|
+
if (this.nodes.length === 0)
|
|
145
|
+
return undefined;
|
|
146
|
+
const top = this.nodes[0];
|
|
147
|
+
const lastNode = this.nodes.pop();
|
|
148
|
+
const lastKey = this.keys.pop();
|
|
149
|
+
if (this.nodes.length > 0) {
|
|
150
|
+
this.nodes[0] = lastNode;
|
|
151
|
+
this.keys[0] = lastKey;
|
|
152
|
+
this.bubbleDown(0);
|
|
153
|
+
}
|
|
154
|
+
return top;
|
|
155
|
+
}
|
|
156
|
+
bubbleUp(i) {
|
|
157
|
+
while (i > 0) {
|
|
158
|
+
const parent = (i - 1) >> 1;
|
|
159
|
+
if (this.keys[parent] <= this.keys[i])
|
|
160
|
+
break;
|
|
161
|
+
this.swap(i, parent);
|
|
162
|
+
i = parent;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
bubbleDown(i) {
|
|
166
|
+
const n = this.nodes.length;
|
|
167
|
+
for (;;) {
|
|
168
|
+
const left = 2 * i + 1;
|
|
169
|
+
const right = left + 1;
|
|
170
|
+
let smallest = i;
|
|
171
|
+
if (left < n && this.keys[left] < this.keys[smallest])
|
|
172
|
+
smallest = left;
|
|
173
|
+
if (right < n && this.keys[right] < this.keys[smallest])
|
|
174
|
+
smallest = right;
|
|
175
|
+
if (smallest === i)
|
|
176
|
+
break;
|
|
177
|
+
this.swap(i, smallest);
|
|
178
|
+
i = smallest;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
swap(a, b) {
|
|
182
|
+
[this.nodes[a], this.nodes[b]] = [this.nodes[b], this.nodes[a]];
|
|
183
|
+
[this.keys[a], this.keys[b]] = [this.keys[b], this.keys[a]];
|
|
184
|
+
}
|
|
185
|
+
}
|
|
78
186
|
//# sourceMappingURL=findPath.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findPath.js","sourceRoot":"","sources":["../../src/path/findPath.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"findPath.js","sourceRoot":"","sources":["../../src/path/findPath.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,EAAE;AACF,8EAA8E;AAC9E,+EAA+E;AAC/E,4EAA4E;AAC5E,kEAAkE;AAClE,EAAE;AACF,gFAAgF;AAChF,gFAAgF;AAChF,8EAA8E;AAC9E,yBAAyB;AACzB,EAAE;AACF,+EAA+E;AAC/E,2EAA2E;AAC3E,uEAAuE;AACvE,EAAE;AACF,6CAA6C;AAC7C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serCapability } from './eligibility';
|
|
3
|
-
export { findPath } from './findPath';
|
|
4
|
-
export type { FindPathOptions, PathResult } from './findPath';
|
|
3
|
+
export { DEFAULT_TRANSPORT_SECONDS, DEFAULT_WALK_SECONDS, edgeSeconds, findPath, } from './findPath';
|
|
4
|
+
export type { EdgeCostOptions, FindPathOptions, PathResult } from './findPath';
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/path/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/path/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,YAAY,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/path/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,YAAY,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EACL,yBAAyB,EACzB,oBAAoB,EACpB,WAAW,EACX,QAAQ,GACT,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,eAAe,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/path/index.js
CHANGED
package/dist/path/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/path/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAElD,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/path/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAElD,OAAO,EACL,yBAAyB,EACzB,oBAAoB,EACpB,WAAW,EACX,QAAQ,GACT,MAAM,YAAY,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scrolled/nav-graph",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1-dev.3bb0204",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Framework-agnostic graph core: IR types + Zod schema, an authoring DSL, a compiler (IR → runtime adjacency), and pathfinding (BFS + eligibility). The engine behind Scrolled Navigator; usable standalone in Node and the browser.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -29,6 +29,9 @@
|
|
|
29
29
|
"README.md",
|
|
30
30
|
"LICENSE"
|
|
31
31
|
],
|
|
32
|
+
"main": "./src/index.ts",
|
|
33
|
+
"module": "./src/index.ts",
|
|
34
|
+
"types": "./src/index.ts",
|
|
32
35
|
"exports": {
|
|
33
36
|
".": "./src/index.ts",
|
|
34
37
|
"./ir": "./src/ir/index.ts",
|