@wildshard/shard-format 0.38.0 → 0.39.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/package.json +2 -1
- package/src/format/budget-tiers.ts +33 -1
- package/src/format/creature-patrols.ts +151 -0
- package/src/format/creatures.ts +8 -5
- package/src/format/encounters.ts +24 -2
- package/src/format/groupBrains.ts +4 -0
- package/src/format/materialGraph.ts +13 -2
- package/src/format/materials.ts +7 -4
- package/src/format/memory-armed.json +193 -1
- package/src/format/memory-armed.ts +17 -2
- package/src/format/postStack.ts +6 -4
- package/src/format/primitive-table.ts +7 -3
- package/src/format/primitives.ts +15 -7
- package/src/format/runtime-tier.ts +4 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wildshard/shard-format",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.39.0",
|
|
4
4
|
"description": "The raw shardfile format: the spec, the validator and a validate CLI. The public, versioned contract every other repo builds on.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"repository": {
|
|
@@ -108,6 +108,7 @@
|
|
|
108
108
|
"./creatures": "./src/format/creatures.ts",
|
|
109
109
|
"./creaturePerch": "./src/format/creature-perch.ts",
|
|
110
110
|
"./creatureLayers": "./src/format/creature-layers.ts",
|
|
111
|
+
"./creatureRanks": "./src/format/creature-ranks.ts",
|
|
111
112
|
"./creatureVolumes": "./src/format/creature-volumes.ts",
|
|
112
113
|
"./creatureSizes": "./src/format/creature-sizes.ts",
|
|
113
114
|
"./creatureSkeletons": "./src/format/creature-skeletons.ts",
|
|
@@ -10,13 +10,21 @@ import type { PicklistSchema } from 'valibot'
|
|
|
10
10
|
* - `cpuMicrosPerFrame`: the shard's own runtime and page features, per 60 Hz frame on the reference phone.
|
|
11
11
|
* - `memoryBytes`: resident memory its runtime and owned stages may hold beyond the admitted content.
|
|
12
12
|
* - `bandwidthBytes`: compressed bytes a player downloads for the shard (J338: 50 MB is fine, 100 MB is the hard cap).
|
|
13
|
+
* - `gpu`: graph nodes, sampler slots, estimated instructions, and authored post passes.
|
|
13
14
|
*/
|
|
14
15
|
interface BudgetTierLimits {
|
|
15
16
|
readonly cpuMicrosPerFrame: number
|
|
16
17
|
readonly memoryBytes: number
|
|
17
18
|
readonly bandwidthBytes: number
|
|
19
|
+
readonly gpu: GraphTierLimit
|
|
18
20
|
}
|
|
19
21
|
type BudgetTier = 'small' | 'medium' | 'large'
|
|
22
|
+
interface GraphTierLimit {
|
|
23
|
+
readonly nodes: number
|
|
24
|
+
readonly samplers: number
|
|
25
|
+
readonly instructions: number
|
|
26
|
+
readonly passes: number
|
|
27
|
+
}
|
|
20
28
|
|
|
21
29
|
const MEBIBYTE = 1_048_576
|
|
22
30
|
const SMALL_CPU = 1000
|
|
@@ -34,16 +42,19 @@ const BUDGET_TIERS: Readonly<Record<BudgetTier, BudgetTierLimits>> = {
|
|
|
34
42
|
cpuMicrosPerFrame: SMALL_CPU,
|
|
35
43
|
memoryBytes: SMALL_MEMORY * MEBIBYTE,
|
|
36
44
|
bandwidthBytes: SMALL_BANDWIDTH,
|
|
45
|
+
gpu: { nodes: 512, samplers: 4, instructions: 1024, passes: 2 },
|
|
37
46
|
},
|
|
38
47
|
medium: {
|
|
39
48
|
cpuMicrosPerFrame: MEDIUM_CPU,
|
|
40
49
|
memoryBytes: MEDIUM_MEMORY * MEBIBYTE,
|
|
41
50
|
bandwidthBytes: MEDIUM_BANDWIDTH,
|
|
51
|
+
gpu: { nodes: 1280, samplers: 8, instructions: 3072, passes: 3 },
|
|
42
52
|
},
|
|
43
53
|
large: {
|
|
44
54
|
cpuMicrosPerFrame: LARGE_CPU,
|
|
45
55
|
memoryBytes: LARGE_MEMORY * MEBIBYTE,
|
|
46
56
|
bandwidthBytes: LARGE_BANDWIDTH,
|
|
57
|
+
gpu: { nodes: 4096, samplers: 16, instructions: 8192, passes: 4 },
|
|
47
58
|
},
|
|
48
59
|
}
|
|
49
60
|
/** The tier a shard picks; an unknown tier refuses. */
|
|
@@ -58,5 +69,26 @@ function budgetTierLimits(budgets: {
|
|
|
58
69
|
return BUDGET_TIERS[budgets.tier ?? 'small']
|
|
59
70
|
}
|
|
60
71
|
|
|
61
|
-
|
|
72
|
+
/** The compatibility tier for older runtime publications. */
|
|
73
|
+
const UNNAMED_TIER: BudgetTier = 'large'
|
|
74
|
+
|
|
75
|
+
/** Material programs and authored post stacks use their product's tier. */
|
|
76
|
+
function graphTierLimits(source: {
|
|
77
|
+
readonly budgets?: { readonly tier?: BudgetTier }
|
|
78
|
+
readonly runtime?: unknown
|
|
79
|
+
}): GraphTierLimit {
|
|
80
|
+
const fallback =
|
|
81
|
+
source.runtime === null || source.runtime === undefined
|
|
82
|
+
? 'small'
|
|
83
|
+
: UNNAMED_TIER
|
|
84
|
+
return budgetTierLimits({ tier: source.budgets?.tier ?? fallback }).gpu
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export {
|
|
88
|
+
BUDGET_TIERS,
|
|
89
|
+
BudgetTierSchema,
|
|
90
|
+
UNNAMED_TIER,
|
|
91
|
+
budgetTierLimits,
|
|
92
|
+
graphTierLimits,
|
|
93
|
+
}
|
|
62
94
|
export type { BudgetTier, BudgetTierLimits }
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import {
|
|
2
|
+
array,
|
|
3
|
+
check,
|
|
4
|
+
finite,
|
|
5
|
+
maxLength,
|
|
6
|
+
maxValue,
|
|
7
|
+
minLength,
|
|
8
|
+
minValue,
|
|
9
|
+
number,
|
|
10
|
+
pipe,
|
|
11
|
+
regex,
|
|
12
|
+
strictObject,
|
|
13
|
+
string,
|
|
14
|
+
tuple,
|
|
15
|
+
} from 'valibot'
|
|
16
|
+
|
|
17
|
+
import type { GenericSchema } from 'valibot'
|
|
18
|
+
|
|
19
|
+
/** Metres per second: a walking patrol, up to a run. */
|
|
20
|
+
const MAX_SPEED = 15
|
|
21
|
+
/** Metres: the cell's half-width. */
|
|
22
|
+
const MAX_COORD = 250
|
|
23
|
+
const MAX_RADIUS = 250
|
|
24
|
+
const MIN_RADIUS = 0.5
|
|
25
|
+
const MIN_STOPS = 2
|
|
26
|
+
const MAX_STOPS = 32
|
|
27
|
+
const MAX_MEMBERS = 16
|
|
28
|
+
const MAX_ID = 128
|
|
29
|
+
const MAX_PATROLS = 64
|
|
30
|
+
const MIN_SPEED = 0.1
|
|
31
|
+
const ONE = 1
|
|
32
|
+
const NONE = 0
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* ONE-FORMAT OF37a (Q-S10: a separate patrol primitive). A patrol walks its members round `route` at `speed`, in step;
|
|
36
|
+
* a player within `engage` metres of any member draws the patrol into the fight, and once every member is more than
|
|
37
|
+
* `leash` metres from the route it gives up and walks back to where it left the route. Its members are creature spawns
|
|
38
|
+
* that belong to no other group. Nalati's `encounter.patrol` and timed encounters move onto it (OF37b).
|
|
39
|
+
*/
|
|
40
|
+
interface CreaturePatrol {
|
|
41
|
+
id: string
|
|
42
|
+
members: string[]
|
|
43
|
+
route: [number, number, number][]
|
|
44
|
+
speed: number
|
|
45
|
+
engage: number
|
|
46
|
+
leash: number
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const id = pipe(string(), regex(/^[a-z][a-z0-9.:-]*$/u), maxLength(MAX_ID))
|
|
50
|
+
const coord = pipe(
|
|
51
|
+
number(),
|
|
52
|
+
finite(),
|
|
53
|
+
minValue(-MAX_COORD),
|
|
54
|
+
maxValue(MAX_COORD),
|
|
55
|
+
)
|
|
56
|
+
const radius = pipe(
|
|
57
|
+
number(),
|
|
58
|
+
finite(),
|
|
59
|
+
minValue(MIN_RADIUS),
|
|
60
|
+
maxValue(MAX_RADIUS),
|
|
61
|
+
)
|
|
62
|
+
const stop = tuple([coord, coord, coord])
|
|
63
|
+
const route = pipe(
|
|
64
|
+
array(stop),
|
|
65
|
+
minLength(MIN_STOPS, 'A patrol route needs two stops'),
|
|
66
|
+
maxLength(MAX_STOPS),
|
|
67
|
+
)
|
|
68
|
+
const members = pipe(
|
|
69
|
+
array(id),
|
|
70
|
+
minLength(ONE, 'A patrol needs a member'),
|
|
71
|
+
maxLength(MAX_MEMBERS),
|
|
72
|
+
)
|
|
73
|
+
const speed = pipe(number(), finite(), minValue(MIN_SPEED), maxValue(MAX_SPEED))
|
|
74
|
+
|
|
75
|
+
/** A patrol as the rules read it. */
|
|
76
|
+
interface PatrolReading {
|
|
77
|
+
readonly id: string
|
|
78
|
+
readonly members: readonly string[]
|
|
79
|
+
readonly engage: number
|
|
80
|
+
readonly leash: number
|
|
81
|
+
}
|
|
82
|
+
interface GroupReading {
|
|
83
|
+
readonly members: readonly string[]
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function leashOutreaches(row: PatrolReading): boolean {
|
|
87
|
+
return row.leash >= row.engage
|
|
88
|
+
}
|
|
89
|
+
const patrol = pipe(
|
|
90
|
+
strictObject({ id, members, route, speed, engage: radius, leash: radius }),
|
|
91
|
+
check<CreaturePatrol, string>(
|
|
92
|
+
leashOutreaches,
|
|
93
|
+
'A patrol leash reaches at least its engage radius',
|
|
94
|
+
),
|
|
95
|
+
)
|
|
96
|
+
const CreaturePatrolsSchema: GenericSchema<CreaturePatrol[]> = pipe(
|
|
97
|
+
array(patrol),
|
|
98
|
+
maxLength(MAX_PATROLS),
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
/** Each member once across the patrols and groups: the members already taken by a group or an earlier patrol. */
|
|
102
|
+
function memberErrors(
|
|
103
|
+
row: PatrolReading,
|
|
104
|
+
known: ReadonlySet<string>,
|
|
105
|
+
taken: Set<string>,
|
|
106
|
+
): string[] {
|
|
107
|
+
const errors: string[] = []
|
|
108
|
+
for (const member of row.members) {
|
|
109
|
+
if (!known.has(member)) {
|
|
110
|
+
errors.push('declared patrol member')
|
|
111
|
+
}
|
|
112
|
+
if (taken.has(member)) {
|
|
113
|
+
errors.push('a patrol member belongs to one controller')
|
|
114
|
+
}
|
|
115
|
+
taken.add(member)
|
|
116
|
+
}
|
|
117
|
+
return errors
|
|
118
|
+
}
|
|
119
|
+
/** Patrol references: unique ids, members that are spawns, and no spawn in two patrols or in a group too. */
|
|
120
|
+
function patrolRules(
|
|
121
|
+
patrols: readonly PatrolReading[],
|
|
122
|
+
spawns: readonly Readonly<{ id: string }>[],
|
|
123
|
+
groups: readonly GroupReading[],
|
|
124
|
+
): string[] {
|
|
125
|
+
const known = new Set(
|
|
126
|
+
spawns.map((row: Readonly<{ id: string }>): string => row.id),
|
|
127
|
+
)
|
|
128
|
+
const taken = new Set(
|
|
129
|
+
groups.flatMap((row: GroupReading): readonly string[] => row.members),
|
|
130
|
+
)
|
|
131
|
+
const ids = new Set(patrols.map((row: PatrolReading): string => row.id))
|
|
132
|
+
const errors = ids.size === patrols.length ? [] : ['unique patrol ids']
|
|
133
|
+
return [
|
|
134
|
+
...errors,
|
|
135
|
+
...patrols.flatMap((row: PatrolReading): string[] =>
|
|
136
|
+
memberErrors(row, known, taken),
|
|
137
|
+
),
|
|
138
|
+
]
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/** Whether the patrols' references hold (`patrolRules` finds nothing). */
|
|
142
|
+
function patrolsAdmitted(
|
|
143
|
+
patrols: readonly PatrolReading[],
|
|
144
|
+
spawns: readonly Readonly<{ id: string }>[],
|
|
145
|
+
groups: readonly GroupReading[],
|
|
146
|
+
): boolean {
|
|
147
|
+
return patrolRules(patrols, spawns, groups).length === NONE
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export type { CreaturePatrol }
|
|
151
|
+
export { CreaturePatrolsSchema, patrolRules, patrolsAdmitted }
|
package/src/format/creatures.ts
CHANGED
|
@@ -7,9 +7,12 @@ import { ReturnProgramSchema } from './namedJsonContracts.ts';
|
|
|
7
7
|
import { NativeRidingSchema } from './nativeRiding.ts';
|
|
8
8
|
import { isJsonData } from './json.ts';
|
|
9
9
|
import { StalkerSchema, GuardianPatternsSchema, SkirmisherSchema, GuardianSchema, PerchHunterSchema, ScriptBrainSchema } from './brains.ts';
|
|
10
|
-
import {
|
|
10
|
+
import type { CreaturePatrol } from './groupBrains.ts';
|
|
11
|
+
import { CreaturePatrolsSchema, patrolsAdmitted, GroupBrainSchema, groupBrainRules, GuardedHerdGuestSchema, GroupGuestBindingSchema } from './groupBrains.ts';
|
|
11
12
|
import { RamGrazerSchema, ChallengeGrazerSchema, GrazerSchema } from './grazers.ts';
|
|
12
13
|
import { DiverSchema, OrbitDiverSchema, PatrolDiverSchema, BurstFlyerSchema } from './flyers.ts';
|
|
14
|
+
/** One creature spawn row; input and output differ only in the home they carry. */
|
|
15
|
+
interface CreatureSpawnRow<Home> { perchBody?: string; group?: string; rank?: 'veteran' | 'elite' | 'champion' | 'legendary'; count?: { per: number; max: number }; when?: { quest?: { id: string; stage: number }; time?: 'day' | 'night'; wave?: { set: string; index: number } }; phaseOffset?: number | undefined; respawn?: number | undefined; home?: Home | undefined; id: string; species: string; variant: string; brain: (string) | null; strike: (string) | null; seed: number; scale: number; at: [number, number, number]; yaw: number; }
|
|
13
16
|
|
|
14
17
|
const id = v.pipe(v.string(), v.regex(/^[a-z][a-z0-9.:-]*$/u), v.maxLength(128));
|
|
15
18
|
const finite = v.pipe(v.number(), v.finite());
|
|
@@ -81,8 +84,8 @@ const timeWhen = v.picklist(['day', 'night'], 'unknown spawn time');
|
|
|
81
84
|
const when = v.strictObject({ quest: v.exactOptional(questWhen), time: v.exactOptional(timeWhen), wave: v.exactOptional(waveWhen) }, 'unknown spawn condition');
|
|
82
85
|
const spawn = v.strictObject({ perchBody: v.exactOptional(id), group: v.exactOptional(id), rank: v.exactOptional(rank), count: v.exactOptional(count), when: v.exactOptional(when), phaseOffset: v.optional(phase), home: v.optional(CreatureHomeSchema), respawn: v.optional(respawn), id, species: id, variant: id, brain: v.nullable(id), strike: v.nullable(id), seed: v.pipe(finite, v.integer(), v.minValue(0), v.maxValue(0xffffffff)), scale: v.pipe(finite, v.minValue(0.1), v.maxValue(10)), at: v.tuple([coord, coord, coord]), yaw: finite });
|
|
83
86
|
/** Pure-data creature archetypes and stable spawn layouts, expanded before the local sim boots. */
|
|
84
|
-
export const CreaturesSchema: v.GenericSchema<ShardCreaturesInput, ShardCreatures> = v.pipe(v.strictObject({ perchBodies: v.exactOptional(CreaturePerchBodiesSchema), brains: v.pipe(v.array(v.variant('kind', [brain, SkirmisherSchema, GuardianSchema, PerchHunterSchema, ScriptBrainSchema, RamGrazerSchema, ChallengeGrazerSchema, OrbitDiverSchema, PatrolDiverSchema, BurstFlyerSchema, GrazerSchema, DiverSchema, GuardianPatternsSchema, StalkerSchema])), v.maxLength(64)), groups: v.optional(v.pipe(v.array(GroupBrainSchema), v.maxLength(64)), []), spawns: v.pipe(v.array(spawn), v.maxLength(10000)) }),
|
|
85
|
-
v.check((c) => creatureRules(c).length === 0, 'creature reference rules'));
|
|
87
|
+
export const CreaturesSchema: v.GenericSchema<ShardCreaturesInput, ShardCreatures> = v.pipe(v.strictObject({ perchBodies: v.exactOptional(CreaturePerchBodiesSchema), brains: v.pipe(v.array(v.variant('kind', [brain, SkirmisherSchema, GuardianSchema, PerchHunterSchema, ScriptBrainSchema, RamGrazerSchema, ChallengeGrazerSchema, OrbitDiverSchema, PatrolDiverSchema, BurstFlyerSchema, GrazerSchema, DiverSchema, GuardianPatternsSchema, StalkerSchema])), v.maxLength(64)), groups: v.optional(v.pipe(v.array(GroupBrainSchema), v.maxLength(64)), []), patrols: v.exactOptional(CreaturePatrolsSchema), spawns: v.pipe(v.array(spawn), v.maxLength(10000)) }),
|
|
88
|
+
v.check((c) => creatureRules(c).length === 0 && patrolsAdmitted(c.patrols ?? [], c.spawns, c.groups), 'creature reference rules'));
|
|
86
89
|
/** Validated brain parameters and spawn layout, with no rig or runtime closure. */
|
|
87
90
|
|
|
88
91
|
/** Unique ids and brain references; species and strikes are resolved against the loader's declared catalogues. */
|
|
@@ -185,8 +188,8 @@ export interface CreatureMemoryActionsRows { stateKey: string; states: (string)[
|
|
|
185
188
|
export interface CreatureBodyRecipeRowsInput { actions?: CreatureMemoryActionsRowsInput; offset?: { field: string; from: number; to: number; }; kind: 'animal'; motion: 'ground' | 'flight'; attack: 'keeper' | 'unlimited'; stunned: 'none' | 'look-hold'; contact: ({ kind: 'environment'; halfArc: number; }) | ({ kind: 'actor'; halfArc: number; move: string; }); }
|
|
186
189
|
export interface CreatureBodyRecipeRows { actions?: CreatureMemoryActionsRows; offset?: { field: string; from: number; to: number; }; kind: 'animal'; motion: 'ground' | 'flight'; attack: 'keeper' | 'unlimited'; stunned: 'none' | 'look-hold'; contact: ({ kind: 'environment'; halfArc: number; }) | ({ kind: 'actor'; halfArc: number; move: string; }); }
|
|
187
190
|
// oxlint-disable-next-line typescript/consistent-type-definitions -- Valibot's readonly defaults need the alias's implicit dictionary compatibility.
|
|
188
|
-
export type ShardCreaturesInput = { perchBodies?: CreaturePerchBodyInput[]; brains: (({ id: string; kind: 'pursue'; awareRadius: number; leashRadius: number; speed: number; returnSpeed: number; stopDistance: number; turnRate: number; thinkDivisor: number; attackCooldownTicks: number; wanderRadius: number; wanderEveryTicks: number; }) | (v.InferInput<typeof SkirmisherSchema>) | (v.InferInput<typeof GuardianSchema>) | (v.InferInput<typeof PerchHunterSchema>) | (v.InferInput<typeof ScriptBrainSchema>) | (v.InferInput<typeof RamGrazerSchema>) | (v.InferInput<typeof ChallengeGrazerSchema>) | (v.InferInput<typeof OrbitDiverSchema>) | (v.InferInput<typeof PatrolDiverSchema>) | (v.InferInput<typeof BurstFlyerSchema>) | (v.InferInput<typeof GrazerSchema>) | (v.InferInput<typeof DiverSchema>) | (v.InferInput<typeof GuardianPatternsSchema>) | (v.InferInput<typeof StalkerSchema>))[]; groups?: (v.InferInput<typeof GroupBrainSchema>)[] | undefined;
|
|
189
|
-
export interface ShardCreatures { perchBodies?: CreaturePerchBody[]; brains: (({ id: string; kind: 'pursue'; awareRadius: number; leashRadius: number; speed: number; returnSpeed: number; stopDistance: number; turnRate: number; thinkDivisor: number; attackCooldownTicks: number; wanderRadius: number; wanderEveryTicks: number; }) | (v.InferOutput<typeof SkirmisherSchema>) | (v.InferOutput<typeof GuardianSchema>) | (v.InferOutput<typeof PerchHunterSchema>) | (v.InferOutput<typeof ScriptBrainSchema>) | (v.InferOutput<typeof RamGrazerSchema>) | (v.InferOutput<typeof ChallengeGrazerSchema>) | (v.InferOutput<typeof OrbitDiverSchema>) | (v.InferOutput<typeof PatrolDiverSchema>) | (v.InferOutput<typeof BurstFlyerSchema>) | (v.InferOutput<typeof GrazerSchema>) | (v.InferOutput<typeof DiverSchema>) | (v.InferOutput<typeof GuardianPatternsSchema>) | (v.InferOutput<typeof StalkerSchema>))[]; groups: (v.InferOutput<typeof GroupBrainSchema>)[];
|
|
191
|
+
export type ShardCreaturesInput = { perchBodies?: CreaturePerchBodyInput[]; brains: (({ id: string; kind: 'pursue'; awareRadius: number; leashRadius: number; speed: number; returnSpeed: number; stopDistance: number; turnRate: number; thinkDivisor: number; attackCooldownTicks: number; wanderRadius: number; wanderEveryTicks: number; }) | (v.InferInput<typeof SkirmisherSchema>) | (v.InferInput<typeof GuardianSchema>) | (v.InferInput<typeof PerchHunterSchema>) | (v.InferInput<typeof ScriptBrainSchema>) | (v.InferInput<typeof RamGrazerSchema>) | (v.InferInput<typeof ChallengeGrazerSchema>) | (v.InferInput<typeof OrbitDiverSchema>) | (v.InferInput<typeof PatrolDiverSchema>) | (v.InferInput<typeof BurstFlyerSchema>) | (v.InferInput<typeof GrazerSchema>) | (v.InferInput<typeof DiverSchema>) | (v.InferInput<typeof GuardianPatternsSchema>) | (v.InferInput<typeof StalkerSchema>))[]; groups?: (v.InferInput<typeof GroupBrainSchema>)[] | undefined; patrols?: CreaturePatrol[]; spawns: CreatureSpawnRow<ShardCreatureHomeInput>[]; };
|
|
192
|
+
export interface ShardCreatures { perchBodies?: CreaturePerchBody[]; brains: (({ id: string; kind: 'pursue'; awareRadius: number; leashRadius: number; speed: number; returnSpeed: number; stopDistance: number; turnRate: number; thinkDivisor: number; attackCooldownTicks: number; wanderRadius: number; wanderEveryTicks: number; }) | (v.InferOutput<typeof SkirmisherSchema>) | (v.InferOutput<typeof GuardianSchema>) | (v.InferOutput<typeof PerchHunterSchema>) | (v.InferOutput<typeof ScriptBrainSchema>) | (v.InferOutput<typeof RamGrazerSchema>) | (v.InferOutput<typeof ChallengeGrazerSchema>) | (v.InferOutput<typeof OrbitDiverSchema>) | (v.InferOutput<typeof PatrolDiverSchema>) | (v.InferOutput<typeof BurstFlyerSchema>) | (v.InferOutput<typeof GrazerSchema>) | (v.InferOutput<typeof DiverSchema>) | (v.InferOutput<typeof GuardianPatternsSchema>) | (v.InferOutput<typeof StalkerSchema>))[]; groups: (v.InferOutput<typeof GroupBrainSchema>)[]; patrols?: CreaturePatrol[]; spawns: CreatureSpawnRow<ShardCreatureHome>[]; }
|
|
190
193
|
export type CreatureStrikeRowsInput = CreatureStrikeRows;
|
|
191
194
|
export interface CreatureStrikeRows { debris?: StrikeDebrisPolicy; id: string; shape: ({ kind: 'arc'; radius: number; halfAngle: number; yawOffset?: number; }) | ({ kind: 'lane'; length: number; width: number; }) | ({ kind: 'ring'; inner: number; outer: number; }) | ({ kind: 'wedge'; length: number; halfAngle: number; }) | ({ kind: 'point'; radius: number; exclusive?: boolean; }) | ({ kind: 'sphere'; radius: number; }); windup: number; active: number; recover: number; cooldown: number; range: (number) | null; damage: number; tags: (`${string}.${string}`)[]; weight: ({ kind: 'constant'; value: number; }) | ({ kind: 'horizontal-distance'; above: number; far: number; near: number; }); units?: 'world' | 'actor'; alternatives?: (({ kind: 'arc'; radius: number; halfAngle: number; yawOffset?: number; }) | ({ kind: 'lane'; length: number; width: number; }) | ({ kind: 'ring'; inner: number; outer: number; }) | ({ kind: 'wedge'; length: number; halfAngle: number; }) | ({ kind: 'point'; radius: number; exclusive?: boolean; }) | ({ kind: 'sphere'; radius: number; }))[]; motion?: { speed?: number; delay?: number; track?: 'none' | 'lead' | 'follow'; overshoot?: number; skid?: number; }; eligibility?: { maxDy?: number; jumpDodges?: boolean; }; }
|
|
192
195
|
export type CreatureStrikesInput = unknown;
|
package/src/format/encounters.ts
CHANGED
|
@@ -8,10 +8,29 @@ const point = v.tuple([coord, coord, coord]);
|
|
|
8
8
|
const positive = v.pipe(finite, v.minValue(0.001), v.maxValue(500));
|
|
9
9
|
const duration = v.pipe(finite, v.minValue(0), v.maxValue(60));
|
|
10
10
|
const phase = v.strictObject({ at: v.pipe(finite, v.minValue(0.001), v.maxValue(1)), name: label, caption: label, speed: v.pipe(finite, v.minValue(0), v.maxValue(15)), stopDistance: v.pipe(finite, v.minValue(0), v.maxValue(50)), turnRate: v.pipe(finite, v.minValue(0), v.maxValue(30)) });
|
|
11
|
+
/**
|
|
12
|
+
* ONE-FORMAT OF34a (J420 (1), Jake 2026-11-18): every boss is three parts. `boss` is the one fight: it `start`s `placed`
|
|
13
|
+
* (its body stands in the world from load, as before), `spawned` (no body until a player enters the arena) or `resident`
|
|
14
|
+
* (its body lives in the world and the fight starts at the first blow, wherever it is), and `capExempt` keeps it out of
|
|
15
|
+
* the cell's fight cap. `boss.arena` is the arena's `bounds`: a `room` resets the fight when every contender has left it,
|
|
16
|
+
* `open` ground when the boss is drawn out past its radius. Tells are any ability's (CC11b), not a boss field. A row
|
|
17
|
+
* without these fields reads as before: placed, capped, no bounds.
|
|
18
|
+
*/
|
|
19
|
+
const BOSS_STARTS = ['placed', 'spawned', 'resident'] as const;
|
|
20
|
+
const ARENA_BOUNDS = ['room', 'open'] as const;
|
|
21
|
+
const start = v.exactOptional(v.picklist(BOSS_STARTS, 'Unknown boss start'));
|
|
22
|
+
const bounds = v.exactOptional(v.picklist(ARENA_BOUNDS, 'Unknown arena bounds'));
|
|
23
|
+
const arena = v.strictObject({ at: point, radius: positive, bounds });
|
|
24
|
+
const capExempt = v.exactOptional(v.literal(true));
|
|
25
|
+
/** Only a boss starts, and only a boss skips the fight cap. */
|
|
26
|
+
function bossOnly(row: Readonly<{ kind: 'elite' | 'boss'; start?: (typeof BOSS_STARTS)[number]; capExempt?: true }>): boolean {
|
|
27
|
+
return row.kind === 'boss' || (row.start === undefined && row.capExempt === undefined);
|
|
28
|
+
}
|
|
11
29
|
const encounter = v.pipe(v.strictObject({ id, entity: id, kind: v.picklist(['elite', 'boss']), panel: v.nullable(id), name: label, title: label, retry: label,
|
|
12
|
-
|
|
30
|
+
start, capExempt, arena, intro: duration, introShort: duration,
|
|
13
31
|
respawn: v.strictObject({ at: point, yaw: finite }), phases: v.pipe(v.array(phase), v.minLength(1), v.maxLength(16)) }),
|
|
14
|
-
v.check((e) => e.phases[0]?.at === 1 && e.phases.every((p, i) => i === 0 || p.at < (e.phases[i - 1]?.at ?? 0)), 'descending phase thresholds starting at 1')
|
|
32
|
+
v.check((e) => e.phases[0]?.at === 1 && e.phases.every((p, i) => i === 0 || p.at < (e.phases[i - 1]?.at ?? 0)), 'descending phase thresholds starting at 1'),
|
|
33
|
+
v.check<ShardEncounters[number], string>(bossOnly, 'Only a boss has a start or capExempt'));
|
|
15
34
|
/** Elite/boss phase tables with checkpoints/retry, neutral steering data and declared panel references. */
|
|
16
35
|
export const EncountersSchema: v.GenericSchema<ShardEncountersInput, ShardEncounters> = v.pipe(v.array(encounter), v.maxLength(64), v.check((rows) => new Set(rows.map((e) => e.id)).size === rows.length && new Set(rows.map((e) => e.entity)).size === rows.length, 'unique encounter ids and actors'));
|
|
17
36
|
/** Validated data-only encounter tables. */
|
|
@@ -36,6 +55,8 @@ export type ShardEncounters = ({
|
|
|
36
55
|
name: string;
|
|
37
56
|
title: string;
|
|
38
57
|
retry: string;
|
|
58
|
+
start?: (typeof BOSS_STARTS)[number];
|
|
59
|
+
capExempt?: true;
|
|
39
60
|
arena: {
|
|
40
61
|
at: [
|
|
41
62
|
number,
|
|
@@ -43,6 +64,7 @@ export type ShardEncounters = ({
|
|
|
43
64
|
number
|
|
44
65
|
];
|
|
45
66
|
radius: number;
|
|
67
|
+
bounds?: (typeof ARENA_BOUNDS)[number];
|
|
46
68
|
};
|
|
47
69
|
intro: number;
|
|
48
70
|
introShort: number;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as v from 'valibot';
|
|
2
2
|
|
|
3
|
+
|
|
3
4
|
/** Built-in guarded group states shared by its wire rows and native owner. */
|
|
4
5
|
export const GUARDED_STALLION_STATES: readonly ['watch', 'warn', 'display', 'charge', 'wheel', 'lead', 'beaten', 'ridden'] = ['watch', 'warn', 'display', 'charge', 'wheel', 'lead', 'beaten', 'ridden'] as const;
|
|
5
6
|
|
|
@@ -247,3 +248,6 @@ export type GuardedHerdGuestRows = {
|
|
|
247
248
|
references?: Record<string, string>;
|
|
248
249
|
plans?: true;
|
|
249
250
|
} & GroupGuestBindingRows;
|
|
251
|
+
/** ONE-FORMAT OF37a: patrols sit beside the group controllers, so their rules live with them. */
|
|
252
|
+
export { CreaturePatrolsSchema, patrolRules, patrolsAdmitted } from './creature-patrols.ts';
|
|
253
|
+
export type { CreaturePatrol } from './creature-patrols.ts';
|
|
@@ -252,7 +252,7 @@ export interface GraphBudget {
|
|
|
252
252
|
}
|
|
253
253
|
/** the default ceilings (a starter graph: the measure preset is ≈ 60 nodes, ≈ 170 instructions) */
|
|
254
254
|
export const DEFAULT_GRAPH_BUDGET: GraphBudget = { nodes: 160, samplers: 4, instructions: 480 };
|
|
255
|
-
/** Hard ceilings for
|
|
255
|
+
/** Hard ceilings for an authored declaration; loop trips remain charged to the estimated cost. */
|
|
256
256
|
export const MAX_GRAPH_BUDGET: GraphBudget = Object.freeze({ nodes: 4096, samplers: 16, instructions: 8192 });
|
|
257
257
|
|
|
258
258
|
/** Raw graph JSON bounds, enforced before typing or compiler work; host-owned presets supply their own node budget. */
|
|
@@ -559,6 +559,8 @@ export interface GraphValidationOptions {
|
|
|
559
559
|
/** the shard's declared public numeric state fields a param may bind to (any name when absent) */
|
|
560
560
|
readonly stateFields?: readonly string[];
|
|
561
561
|
readonly budget?: GraphBudget;
|
|
562
|
+
/** A product's ceiling also bounds explicit budgets and nested graphs. */
|
|
563
|
+
readonly budgetCeiling?: GraphBudget;
|
|
562
564
|
/** Host authority to use an explicit declaration; content cannot grant this. */
|
|
563
565
|
readonly declaredBudget?: boolean;
|
|
564
566
|
/** the directional lights a `sun` sub-graph is built for (1 … SUN_CASCADES_MAX; SUN_CASCADES when absent) */
|
|
@@ -624,7 +626,9 @@ interface Scope {
|
|
|
624
626
|
* every reason it is refused.
|
|
625
627
|
*/
|
|
626
628
|
export function validateGraph(input: unknown, opts: GraphValidationOptions = {}): GraphValidation {
|
|
627
|
-
const
|
|
629
|
+
const ceiling = opts.budgetCeiling;
|
|
630
|
+
const rawLimit = opts.declaredBudget === true ? MAX_GRAPH_BUDGET.nodes : opts.budget?.nodes ?? DEFAULT_GRAPH_BUDGET.nodes;
|
|
631
|
+
const rawErrors = graphAdmissionErrors(input, Math.min(rawLimit, ceiling?.nodes ?? rawLimit));
|
|
628
632
|
if (rawErrors.length > 0) return { ok: false, errors: rawErrors };
|
|
629
633
|
const errors: string[] = [];
|
|
630
634
|
const fail = (msg: string): null => { errors.push(msg); return null; };
|
|
@@ -642,6 +646,13 @@ export function validateGraph(input: unknown, opts: GraphValidationOptions = {})
|
|
|
642
646
|
if (opts.declaredBudget !== true) return { ok: false, errors: ['graph: declared budget requires native runtime authority'] };
|
|
643
647
|
budget = { nodes: Number(declared.nodes), samplers: Number(declared['samplers']), instructions: Number(declared['instructions']) };
|
|
644
648
|
}
|
|
649
|
+
if (ceiling !== undefined) {
|
|
650
|
+
budget = {
|
|
651
|
+
nodes: Math.min(budget.nodes, ceiling.nodes),
|
|
652
|
+
samplers: Math.min(budget.samplers, ceiling.samplers),
|
|
653
|
+
instructions: Math.min(budget.instructions, ceiling.instructions),
|
|
654
|
+
};
|
|
655
|
+
}
|
|
645
656
|
if (input.version !== GRAPH_IR_VERSION) fail(`graph: version ${String(input.version)} (this engine reads ${GRAPH_IR_VERSION})`);
|
|
646
657
|
const kind = input.kind, primitive = input.primitive;
|
|
647
658
|
if (kind !== 'material' && kind !== 'post' && kind !== 'fog') fail(`graph: kind ${String(kind)} (material, post or fog)`);
|
package/src/format/materials.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { graphTierLimits } from './budget-tiers.ts';
|
|
1
2
|
import { hasDeclaredClientPage } from './runtimeBinds.ts';
|
|
2
3
|
import * as v from 'valibot';
|
|
3
4
|
import {
|
|
@@ -155,9 +156,10 @@ function numericFields(state: Shardfile['state'], privacy: 'public' | 'host'): s
|
|
|
155
156
|
* programs are held to `PRESET_GRAPH_BUDGET` by the engine's own tests, never the author caps); a graph file must be a
|
|
156
157
|
* JSON file of the library closure (`files` / `library` given: its bytes are validated by product admission, `graphFileRules`).
|
|
157
158
|
*/
|
|
158
|
-
export function materialGraphRules(source: Pick<Shardfile, 'look' | 'state'> & Partial<Pick<Shardfile, 'files' | 'library' | 'runtime' | 'questHost'>>): string[] {
|
|
159
|
+
export function materialGraphRules(source: Pick<Shardfile, 'look' | 'state'> & Partial<Pick<Shardfile, 'files' | 'library' | 'runtime' | 'questHost' | 'budgets'>>): string[] {
|
|
159
160
|
const errors: string[] = [];
|
|
160
161
|
const { day: dayChannels, state: stateFields } = graphBindingSources(source);
|
|
162
|
+
const budget = graphTierLimits(source);
|
|
161
163
|
const files = new Map((source.files ?? []).map((row) => [row.hash, row])), closure = new Set<string>(), pending = [...source.library ?? []];
|
|
162
164
|
while (pending.length > 0) { const hash = pending.pop(); if (hash === undefined || closure.has(hash)) continue; closure.add(hash); pending.push(...files.get(hash)?.dependencies ?? []); }
|
|
163
165
|
for (const [materialId, material] of Object.entries(source.look.materials)) {
|
|
@@ -167,7 +169,7 @@ export function materialGraphRules(source: Pick<Shardfile, 'look' | 'state'> & P
|
|
|
167
169
|
continue;
|
|
168
170
|
}
|
|
169
171
|
if ('preset' in material) { const refusal = presetRefusal(material.preset); if (refusal !== null) errors.push(`material ${materialId}: ${refusal}`); continue; }
|
|
170
|
-
const checked = validateGraph(material.graph, { dayKeys: [...dayChannels.keys()], stateFields,
|
|
172
|
+
const checked = validateGraph(material.graph, { dayKeys: [...dayChannels.keys()], stateFields, budget, budgetCeiling: budget, declaredBudget: true });
|
|
171
173
|
if (!checked.ok) { errors.push(...checked.errors.map((error) => `material ${materialId}: ${error}`)); continue; }
|
|
172
174
|
errors.push(...bindingTypeErrors(materialId, checked.graph, dayChannels));
|
|
173
175
|
const fog = checked.graph.effectState?.fog;
|
|
@@ -184,15 +186,16 @@ export function materialGraphRules(source: Pick<Shardfile, 'look' | 'state'> & P
|
|
|
184
186
|
* one `kind: "material"` graph that validates under the author caps against the shard's admitted bindings, and every
|
|
185
187
|
* texture param names a KTX2 file its row declares as a direct dependency (so the texture is charged with the closure).
|
|
186
188
|
*/
|
|
187
|
-
export function graphFileRules(source: Pick<Shardfile, 'look' | 'state' | 'files'> & Partial<Pick<Shardfile, 'runtime' | 'questHost'>>, bytes: (hash: string) => Uint8Array | undefined): string[] {
|
|
189
|
+
export function graphFileRules(source: Pick<Shardfile, 'look' | 'state' | 'files'> & Partial<Pick<Shardfile, 'runtime' | 'questHost' | 'budgets'>>, bytes: (hash: string) => Uint8Array | undefined): string[] {
|
|
188
190
|
const errors: string[] = [];
|
|
189
191
|
const { day: dayChannels, state: stateFields } = graphBindingSources(source);
|
|
192
|
+
const budget = graphTierLimits(source);
|
|
190
193
|
const files = new Map(source.files.map((row) => [row.hash, row]));
|
|
191
194
|
for (const [materialId, material] of Object.entries(source.look.materials)) {
|
|
192
195
|
if (material.family !== 'graph' || !('file' in material)) continue;
|
|
193
196
|
let ir: unknown;
|
|
194
197
|
try { ir = graphFileJson(material.file, bytes); } catch (error) { errors.push(`material ${materialId}: ${error instanceof Error ? error.message : 'graph file'}`); continue; }
|
|
195
|
-
const checked = validateGraph(ir, { dayKeys: [...dayChannels.keys()], stateFields,
|
|
198
|
+
const checked = validateGraph(ir, { dayKeys: [...dayChannels.keys()], stateFields, budget, budgetCeiling: budget, declaredBudget: true });
|
|
196
199
|
if (!checked.ok) { errors.push(...checked.errors.map((error) => `material ${materialId}: ${error}`)); continue; }
|
|
197
200
|
if (checked.graph.kind === 'post') { errors.push(`material ${materialId}: a graph file in a material slot holds a material or fog graph, not a post pass`); continue; }
|
|
198
201
|
const fog = checked.graph.effectState?.fog, target = typeof fog === 'string' ? source.look.materials[fog] : undefined;
|
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$doc": "J426 (Jake, 2026-11-18): the one armed-zone list. A zone named here has done the work to get under the J410 lines, and from then on every memory gate refuses it back over them, with no override flag and no report-only fallback: the format's offline estimate over lines.playingBytes / lines.loadingBytes (check, validate, cook, upload), the declared worst-location total over the J408 1.5 GB line, the runtime tier and a stale runtime reading; engine's ledger, footprint and boot-line guards read the same list. A zone not named here reports only (J424). Each zone's playingBytes / loadingBytes are its offline estimate when it was armed (memory epoch in `epoch`)
|
|
2
|
+
"$doc": "J426 (Jake, 2026-11-18): the one armed-zone list. A zone named here has done the work to get under the J410 lines, and from then on every memory gate refuses it back over them, with no override flag and no report-only fallback: the format's offline estimate over lines.playingBytes / lines.loadingBytes (check, validate, cook, upload), the declared worst-location total over the J408 1.5 GB line, the runtime tier and a stale runtime reading; engine's ledger, footprint and boot-line guards read the same list. A zone not named here reports only (J424). Each zone's playingBytes / loadingBytes are its offline estimate when it was armed (memory epoch in `epoch`); the offline estimate refuses over the larger of the line and that reading plus 0.5% (memory-armed.ts ARMED_ALLOWANCE), so a zone EM11 measured under the line whose conservative estimate reads over it (Nine's playing) is locked at its armed state. Decimal bytes. Format memory-armed.ts reads this; engine reads @wildshard/format/src/format/memory-armed.json.",
|
|
3
3
|
"lines": {
|
|
4
4
|
"playingBytes": 1000000000,
|
|
5
5
|
"loadingBytes": 1500000000
|
|
6
6
|
},
|
|
7
7
|
"zones": {
|
|
8
|
+
"brasscap-mesa": {
|
|
9
|
+
"armed": "2026-11-18",
|
|
10
|
+
"by": "mini-pinemem5",
|
|
11
|
+
"epoch": 8,
|
|
12
|
+
"playingBytes": 679221837,
|
|
13
|
+
"loadingBytes": 984731013,
|
|
14
|
+
"evidence": "engine-pinned product revision 6 (tar f42fe0449a93), a data shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
|
|
15
|
+
},
|
|
8
16
|
"driftwood-isle": {
|
|
9
17
|
"armed": "2026-11-18",
|
|
10
18
|
"by": "mini-pinemem5",
|
|
@@ -13,6 +21,22 @@
|
|
|
13
21
|
"loadingBytes": 1157545785,
|
|
14
22
|
"evidence": "shard-driftwood e736730 built with format 0.37 (epoch 8); codex-nalati locked pairs on the EM11 upper read 990.5 / 1,344.7 MB (meta MEMORY-GATES)"
|
|
15
23
|
},
|
|
24
|
+
"far-reach": {
|
|
25
|
+
"armed": "2026-11-18",
|
|
26
|
+
"by": "mini-pinemem5",
|
|
27
|
+
"epoch": 8,
|
|
28
|
+
"playingBytes": 999952196,
|
|
29
|
+
"loadingBytes": 1415754105,
|
|
30
|
+
"evidence": "engine-pinned product revision 4 (tar 5bc5adcf764a), a data shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
|
|
31
|
+
},
|
|
32
|
+
"ink-cel-valley": {
|
|
33
|
+
"armed": "2026-11-18",
|
|
34
|
+
"by": "mini-pinemem5",
|
|
35
|
+
"epoch": 8,
|
|
36
|
+
"playingBytes": 636979847,
|
|
37
|
+
"loadingBytes": 925290035,
|
|
38
|
+
"evidence": "engine-pinned product revision 1 (tar 5764c86a258a), a data shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
|
|
39
|
+
},
|
|
16
40
|
"nalati-grasslands": {
|
|
17
41
|
"armed": "2026-11-18",
|
|
18
42
|
"by": "mini-pinemem5",
|
|
@@ -20,6 +44,174 @@
|
|
|
20
44
|
"playingBytes": 945736154,
|
|
21
45
|
"loadingBytes": 1328901899,
|
|
22
46
|
"evidence": "shard-nalati 1d5014e8 built with format 0.37 (epoch 8); mini-resweep EM11 upper on the J420 stand-in: playing 0.940 GB less the worker, loading 1.470 GB (meta MEMORY-GATES)"
|
|
47
|
+
},
|
|
48
|
+
"nine-dragon-stack": {
|
|
49
|
+
"armed": "2026-11-18",
|
|
50
|
+
"by": "mini-pinemem5",
|
|
51
|
+
"epoch": 8,
|
|
52
|
+
"playingBytes": 1023504847,
|
|
53
|
+
"loadingBytes": 1434692360,
|
|
54
|
+
"evidence": "shard-nine-dragon 8779b872 built with format 0.37 (epoch 8); mini-pinemem6 prepared online boot on engine d0fd6e62, 9 pairs: playing upper 0.938 GB, loading upper 1.435 GB (meta 1677f091). The estimate's playing (1,023.5 MB) is over the 1.0 GB line, so it locks at that reading"
|
|
55
|
+
},
|
|
56
|
+
"open-plot-alien-plain": {
|
|
57
|
+
"armed": "2026-11-18",
|
|
58
|
+
"by": "mini-pinemem5",
|
|
59
|
+
"epoch": 8,
|
|
60
|
+
"playingBytes": 665173554,
|
|
61
|
+
"loadingBytes": 967392441,
|
|
62
|
+
"evidence": "engine-pinned product revision 1 (tar c32cd9fb9229), a data shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
|
|
63
|
+
},
|
|
64
|
+
"open-plot-clockwork-canyon": {
|
|
65
|
+
"armed": "2026-11-18",
|
|
66
|
+
"by": "mini-pinemem5",
|
|
67
|
+
"epoch": 8,
|
|
68
|
+
"playingBytes": 675751489,
|
|
69
|
+
"loadingBytes": 982935896,
|
|
70
|
+
"evidence": "engine-pinned product revision 1 (tar 3b322eccd99e), a data shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
|
|
71
|
+
},
|
|
72
|
+
"open-plot-coral-drift": {
|
|
73
|
+
"armed": "2026-11-18",
|
|
74
|
+
"by": "mini-pinemem5",
|
|
75
|
+
"epoch": 8,
|
|
76
|
+
"playingBytes": 681768940,
|
|
77
|
+
"loadingBytes": 992453778,
|
|
78
|
+
"evidence": "engine-pinned product revision 1 (tar 87841749dc3f), a data shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
|
|
79
|
+
},
|
|
80
|
+
"open-plot-desert-ruin": {
|
|
81
|
+
"armed": "2026-11-18",
|
|
82
|
+
"by": "mini-pinemem5",
|
|
83
|
+
"epoch": 8,
|
|
84
|
+
"playingBytes": 686478807,
|
|
85
|
+
"loadingBytes": 997958716,
|
|
86
|
+
"evidence": "engine-pinned product revision 1 (tar 3b65bfef7275), a data shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
|
|
87
|
+
},
|
|
88
|
+
"open-plot-ember-forge": {
|
|
89
|
+
"armed": "2026-11-18",
|
|
90
|
+
"by": "mini-pinemem5",
|
|
91
|
+
"epoch": 8,
|
|
92
|
+
"playingBytes": 679682616,
|
|
93
|
+
"loadingBytes": 987005255,
|
|
94
|
+
"evidence": "engine-pinned product revision 1 (tar e1a3a9325e8e), a data shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
|
|
95
|
+
},
|
|
96
|
+
"open-plot-fossil-badlands": {
|
|
97
|
+
"armed": "2026-11-18",
|
|
98
|
+
"by": "mini-pinemem5",
|
|
99
|
+
"epoch": 8,
|
|
100
|
+
"playingBytes": 671308241,
|
|
101
|
+
"loadingBytes": 976533532,
|
|
102
|
+
"evidence": "engine-pinned product revision 1 (tar 5bbdd51b8db9), a data shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
|
|
103
|
+
},
|
|
104
|
+
"open-plot-frostline-peaks": {
|
|
105
|
+
"armed": "2026-11-18",
|
|
106
|
+
"by": "mini-pinemem5",
|
|
107
|
+
"epoch": 8,
|
|
108
|
+
"playingBytes": 694731191,
|
|
109
|
+
"loadingBytes": 1007041500,
|
|
110
|
+
"evidence": "engine-pinned product revision 1 (tar ec7b8879a343), a data shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
|
|
111
|
+
},
|
|
112
|
+
"open-plot-jungle-ziggurat": {
|
|
113
|
+
"armed": "2026-11-18",
|
|
114
|
+
"by": "mini-pinemem5",
|
|
115
|
+
"epoch": 8,
|
|
116
|
+
"playingBytes": 683128342,
|
|
117
|
+
"loadingBytes": 992540003,
|
|
118
|
+
"evidence": "engine-pinned product revision 1 (tar 62fdb3cc7e41), a data shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
|
|
119
|
+
},
|
|
120
|
+
"open-plot-lantern-bayou": {
|
|
121
|
+
"armed": "2026-11-18",
|
|
122
|
+
"by": "mini-pinemem5",
|
|
123
|
+
"epoch": 8,
|
|
124
|
+
"playingBytes": 679945285,
|
|
125
|
+
"loadingBytes": 989938627,
|
|
126
|
+
"evidence": "engine-pinned product revision 1 (tar 1f9fb1cba098), a data shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
|
|
127
|
+
},
|
|
128
|
+
"open-plot-mosslight-ruins": {
|
|
129
|
+
"armed": "2026-11-18",
|
|
130
|
+
"by": "mini-pinemem5",
|
|
131
|
+
"epoch": 8,
|
|
132
|
+
"playingBytes": 693006386,
|
|
133
|
+
"loadingBytes": 1006944516,
|
|
134
|
+
"evidence": "engine-pinned product revision 1 (tar 19840339238b), a data shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
|
|
135
|
+
},
|
|
136
|
+
"open-plot-night-market": {
|
|
137
|
+
"armed": "2026-11-18",
|
|
138
|
+
"by": "mini-pinemem5",
|
|
139
|
+
"epoch": 8,
|
|
140
|
+
"playingBytes": 709180040,
|
|
141
|
+
"loadingBytes": 1028237840,
|
|
142
|
+
"evidence": "engine-pinned product revision 1 (tar d8fe11c2db67), a data shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
|
|
143
|
+
},
|
|
144
|
+
"open-plot-patchwork-fairground": {
|
|
145
|
+
"armed": "2026-11-18",
|
|
146
|
+
"by": "mini-pinemem5",
|
|
147
|
+
"epoch": 8,
|
|
148
|
+
"playingBytes": 670516626,
|
|
149
|
+
"loadingBytes": 974863462,
|
|
150
|
+
"evidence": "engine-pinned product revision 1 (tar e517f4814ef6), a data shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
|
|
151
|
+
},
|
|
152
|
+
"open-plot-saltwind-lighthouse": {
|
|
153
|
+
"armed": "2026-11-18",
|
|
154
|
+
"by": "mini-pinemem5",
|
|
155
|
+
"epoch": 8,
|
|
156
|
+
"playingBytes": 657567209,
|
|
157
|
+
"loadingBytes": 956173411,
|
|
158
|
+
"evidence": "engine-pinned product revision 1 (tar 2e37a04b0c9e), a data shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
|
|
159
|
+
},
|
|
160
|
+
"open-plot-sky-harbor": {
|
|
161
|
+
"armed": "2026-11-18",
|
|
162
|
+
"by": "mini-pinemem5",
|
|
163
|
+
"epoch": 8,
|
|
164
|
+
"playingBytes": 671985118,
|
|
165
|
+
"loadingBytes": 977835231,
|
|
166
|
+
"evidence": "engine-pinned product revision 1 (tar 9aa4a9839015), a data shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
|
|
167
|
+
},
|
|
168
|
+
"open-plot-sky-race": {
|
|
169
|
+
"armed": "2026-11-18",
|
|
170
|
+
"by": "mini-pinemem5",
|
|
171
|
+
"epoch": 8,
|
|
172
|
+
"playingBytes": 671490214,
|
|
173
|
+
"loadingBytes": 977159704,
|
|
174
|
+
"evidence": "engine-pinned product revision 1 (tar a5633d8eee7f), a data shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
|
|
175
|
+
},
|
|
176
|
+
"open-plot-starfall-observatory": {
|
|
177
|
+
"armed": "2026-11-18",
|
|
178
|
+
"by": "mini-pinemem5",
|
|
179
|
+
"epoch": 8,
|
|
180
|
+
"playingBytes": 674717033,
|
|
181
|
+
"loadingBytes": 981241332,
|
|
182
|
+
"evidence": "engine-pinned product revision 1 (tar 25331b613be1), a data shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
|
|
183
|
+
},
|
|
184
|
+
"open-plot-thin-ice": {
|
|
185
|
+
"armed": "2026-11-18",
|
|
186
|
+
"by": "mini-pinemem5",
|
|
187
|
+
"epoch": 8,
|
|
188
|
+
"playingBytes": 657896658,
|
|
189
|
+
"loadingBytes": 957357794,
|
|
190
|
+
"evidence": "engine-pinned product revision 1 (tar 4546f70ddac2), a data shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
|
|
191
|
+
},
|
|
192
|
+
"pastel-plain": {
|
|
193
|
+
"armed": "2026-11-18",
|
|
194
|
+
"by": "mini-pinemem5",
|
|
195
|
+
"epoch": 8,
|
|
196
|
+
"playingBytes": 636958876,
|
|
197
|
+
"loadingBytes": 925256481,
|
|
198
|
+
"evidence": "engine-pinned product revision 1 (tar e42e2f5f5793), a data shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
|
|
199
|
+
},
|
|
200
|
+
"pine-hollow": {
|
|
201
|
+
"armed": "2026-11-18",
|
|
202
|
+
"by": "mini-pinemem5",
|
|
203
|
+
"epoch": 8,
|
|
204
|
+
"playingBytes": 920666659,
|
|
205
|
+
"loadingBytes": 1298769921,
|
|
206
|
+
"evidence": "shard-pine-hollow 400ed4b7 built with format 0.37 (epoch 8); mini-pinemem6 prepared online boot on engine f0a96518, 9 pairs: playing upper 0.969 GB, loading upper 1.407 GB (meta 118a2b13)"
|
|
207
|
+
},
|
|
208
|
+
"sunscar-dunes": {
|
|
209
|
+
"armed": "2026-11-18",
|
|
210
|
+
"by": "mini-pinemem5",
|
|
211
|
+
"epoch": 8,
|
|
212
|
+
"playingBytes": 772000529,
|
|
213
|
+
"loadingBytes": 1108011593,
|
|
214
|
+
"evidence": "engine-pinned product revision 2 (tar f4a1d611cccc), a data shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
|
|
23
215
|
}
|
|
24
216
|
}
|
|
25
217
|
}
|
|
@@ -31,15 +31,30 @@ function zoneArmed(slug?: string): boolean {
|
|
|
31
31
|
return slug !== undefined && Object.hasOwn(ARMED_ZONES, slug)
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
/**
|
|
34
|
+
/** A rebuild of the same source moves the computed estimate by packing and compression drift only. */
|
|
35
|
+
const ARMED_ALLOWANCE = 0.005
|
|
36
|
+
|
|
37
|
+
/** What an armed zone's offline estimate refuses over: the J410 line, or, when the conservative estimate of a source
|
|
38
|
+
* that EM11 measured under the line already reads over it (Nine's playing), that reading at arming plus the
|
|
39
|
+
* allowance, so the gate locks in the measured state and refuses any growth. Undefined for a zone that only reports. */
|
|
35
40
|
function armedLine(
|
|
36
41
|
slug: string | undefined,
|
|
37
42
|
kind: ArmedKind,
|
|
38
43
|
): number | undefined {
|
|
39
|
-
|
|
44
|
+
const zone =
|
|
45
|
+
slug === undefined || !zoneArmed(slug) ? undefined : ARMED_ZONES[slug]
|
|
46
|
+
if (zone === undefined) {
|
|
47
|
+
return undefined
|
|
48
|
+
}
|
|
49
|
+
const armedBytes = kind === 'playing' ? zone.playingBytes : zone.loadingBytes
|
|
50
|
+
return Math.max(
|
|
51
|
+
ARMED_LINES[kind],
|
|
52
|
+
armedBytes + Math.floor(armedBytes * ARMED_ALLOWANCE),
|
|
53
|
+
)
|
|
40
54
|
}
|
|
41
55
|
|
|
42
56
|
export {
|
|
57
|
+
ARMED_ALLOWANCE,
|
|
43
58
|
ARMED_LINES,
|
|
44
59
|
ARMED_ZONES,
|
|
45
60
|
type ArmedKind,
|
package/src/format/postStack.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* A shard's own post stack (SHARD-PLATFORM SF59 steps 3–4, G158, budget v1 C4-R1-A5 / C7): inside its cell a shard's
|
|
3
3
|
* look owns the whole frame, its post passes included, as data. `look.post` is an ordered list of at most
|
|
4
|
-
*
|
|
4
|
+
* its tier’s allowed number of authored post graphs (`kind: "post"`), each inline (`{ graph }`) or a graph file of the
|
|
5
5
|
* library closure (`{ file }`, validated with its bytes at product admission). Each pass is a full-screen program; its
|
|
6
6
|
* instruction estimate is a per-pixel cost at the phone's 2× render scale, so the stack's cost is the sum of its passes'
|
|
7
7
|
* estimates plus the normal pre-pass when any pass reads `sceneNormal` ({@link POST_NORMAL_PREPASS_COST}, paid once).
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
import * as v from 'valibot';
|
|
13
13
|
import { validateGraph, type GraphIr, type PostInputs } from './materialGraph.ts';
|
|
14
14
|
import { graphBindingSources, graphFileJson } from './materials.ts';
|
|
15
|
+
import { graphTierLimits } from './budget-tiers.ts';
|
|
15
16
|
import { isJsonData } from './json.ts';
|
|
16
17
|
import type { Shardfile } from './shardSchema.ts';
|
|
17
18
|
|
|
@@ -48,7 +49,7 @@ export interface PostStackCost { readonly passes: number; readonly instructions:
|
|
|
48
49
|
* Validate and cost a stack: each pass under the author caps against the shard's admitted bindings (a graph file read
|
|
49
50
|
* through `bytes`; undefined bytes are refused), the sum against the stack budget. Returns the cost and every refusal.
|
|
50
51
|
*/
|
|
51
|
-
export function postStackCost(source: Pick<Shardfile, 'look' | 'state'> & { readonly look: { readonly post?: readonly PostPass[] } }, bytes: (hash: string) => Uint8Array | undefined): { cost: PostStackCost; errors: string[] } {
|
|
52
|
+
export function postStackCost(source: Pick<Shardfile, 'look' | 'state'> & Partial<Pick<Shardfile, 'budgets' | 'runtime'>> & { readonly look: { readonly post?: readonly PostPass[] } }, bytes: (hash: string) => Uint8Array | undefined): { cost: PostStackCost; errors: string[] } {
|
|
52
53
|
const errors: string[] = [], passes = source.look.post ?? [];
|
|
53
54
|
const { day, state } = graphBindingSources(source);
|
|
54
55
|
let instructions = 0;
|
|
@@ -63,7 +64,8 @@ export function postStackCost(source: Pick<Shardfile, 'look' | 'state'> & { read
|
|
|
63
64
|
inputs.colour ||= checked.inputs.colour; inputs.depth ||= checked.inputs.depth; inputs.normal ||= checked.inputs.normal;
|
|
64
65
|
});
|
|
65
66
|
if (inputs.normal) instructions += POST_NORMAL_PREPASS_COST;
|
|
66
|
-
|
|
67
|
+
const passLimit = Math.min(POST_STACK_BUDGET.passes, graphTierLimits(source).passes);
|
|
68
|
+
if (passes.length > passLimit) errors.push(`post: ${passes.length} passes (at most ${passLimit})`);
|
|
67
69
|
if (instructions > POST_STACK_BUDGET.instructions) errors.push(`post: ≈ ${instructions} instructions per pixel at 2× (at most ${POST_STACK_BUDGET.instructions})`);
|
|
68
70
|
return { cost: { passes: passes.length, instructions, inputs }, errors };
|
|
69
71
|
}
|
|
@@ -73,7 +75,7 @@ export function postStackCost(source: Pick<Shardfile, 'look' | 'state'> & { read
|
|
|
73
75
|
* file pass must be a JSON file of the library closure (`files` / `library` given; its bytes are costed by product
|
|
74
76
|
* admission through `postStackCost`, so a stack holding files is summed there).
|
|
75
77
|
*/
|
|
76
|
-
export function postStackRules(source: Pick<Shardfile, 'look' | 'state'> & Partial<Pick<Shardfile, 'files' | 'library'>> & { readonly look: { readonly post?: readonly PostPass[] } }): string[] {
|
|
78
|
+
export function postStackRules(source: Pick<Shardfile, 'look' | 'state'> & Partial<Pick<Shardfile, 'budgets' | 'runtime'>> & Partial<Pick<Shardfile, 'files' | 'library'>> & { readonly look: { readonly post?: readonly PostPass[] } }): string[] {
|
|
77
79
|
const passes = source.look.post ?? [];
|
|
78
80
|
if (passes.length === 0) return [];
|
|
79
81
|
const errors: string[] = [];
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
interface PrimitiveSwitch {
|
|
6
6
|
readonly section: string
|
|
7
7
|
readonly path: readonly string[]
|
|
8
|
-
/** When set, the family is on only if some row of the list at `path` has this key. */
|
|
8
|
+
/** When set, the family is on only if some row of the list at `path` has this key (a dotted key reads a nested one). */
|
|
9
9
|
readonly having?: string
|
|
10
10
|
/** With `having`: only a row whose `having` key holds this value counts. */
|
|
11
11
|
readonly equals?: string
|
|
@@ -104,7 +104,11 @@ const TABLE: readonly Primitive[] = [
|
|
|
104
104
|
{
|
|
105
105
|
name: 'boss.arena',
|
|
106
106
|
row: 'OF34',
|
|
107
|
-
on:
|
|
107
|
+
on: {
|
|
108
|
+
section: 'combat/encounters',
|
|
109
|
+
path: ['encounters'],
|
|
110
|
+
having: 'arena.bounds',
|
|
111
|
+
},
|
|
108
112
|
hosts: ['boss.arena', 'boss.open-arena'],
|
|
109
113
|
},
|
|
110
114
|
{
|
|
@@ -130,7 +134,7 @@ const TABLE: readonly Primitive[] = [
|
|
|
130
134
|
{
|
|
131
135
|
name: 'patrol',
|
|
132
136
|
row: 'OF37',
|
|
133
|
-
on: '
|
|
137
|
+
on: { section: 'actors/creatures', path: ['creatures', 'patrols'] },
|
|
134
138
|
hosts: ['encounter.patrol', 'timed.encounters'],
|
|
135
139
|
},
|
|
136
140
|
{
|
package/src/format/primitives.ts
CHANGED
|
@@ -64,6 +64,19 @@ function filled(value: unknown): boolean {
|
|
|
64
64
|
Object.keys(value).length > NONE
|
|
65
65
|
)
|
|
66
66
|
}
|
|
67
|
+
/** A row's key, or a nested one by a dotted key (`arena.bounds`). */
|
|
68
|
+
function field(row: object, key: string): { has: boolean; value?: unknown } {
|
|
69
|
+
const keys = key.split('.')
|
|
70
|
+
const last = keys.pop() ?? key
|
|
71
|
+
const holder = at(row, keys)
|
|
72
|
+
if (typeof holder !== 'object' || holder === null) {
|
|
73
|
+
return { has: false }
|
|
74
|
+
}
|
|
75
|
+
return {
|
|
76
|
+
has: Object.hasOwn(holder, last),
|
|
77
|
+
value: Object.getOwnPropertyDescriptor(holder, last)?.value,
|
|
78
|
+
}
|
|
79
|
+
}
|
|
67
80
|
function rowCounts(row: unknown, rule: PrimitiveSwitch): boolean {
|
|
68
81
|
if (typeof row !== 'object' || row === null) {
|
|
69
82
|
return false
|
|
@@ -75,13 +88,8 @@ function rowCounts(row: unknown, rule: PrimitiveSwitch): boolean {
|
|
|
75
88
|
if (having === undefined) {
|
|
76
89
|
return true
|
|
77
90
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
81
|
-
return (
|
|
82
|
-
equals === undefined ||
|
|
83
|
-
Object.getOwnPropertyDescriptor(row, having)?.value === equals
|
|
84
|
-
)
|
|
91
|
+
const found = field(row, having)
|
|
92
|
+
return found.has && (equals === undefined || found.value === equals)
|
|
85
93
|
}
|
|
86
94
|
function switchedOn(value: unknown, rule: PrimitiveSwitch): boolean {
|
|
87
95
|
if (rule.having === undefined && rule.lacking === undefined) {
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
import { budgetTierLimits } from './budget-tiers.ts'
|
|
1
|
+
import { UNNAMED_TIER, budgetTierLimits } from './budget-tiers.ts'
|
|
2
2
|
import { ratchetNote, ratchetSeverity } from './memory-ratchet.ts'
|
|
3
3
|
import { runtimeAccountedBytes } from './runtimeCost.ts'
|
|
4
4
|
|
|
5
5
|
import type { BudgetTier } from './budget-tiers.ts'
|
|
6
6
|
|
|
7
|
-
/** The tier an unnamed runtime is held to until OF10c1b names every runtime shard's tier. */
|
|
8
|
-
const UNNAMED_TIER: BudgetTier = 'large'
|
|
9
|
-
|
|
10
7
|
/** What the check reads of a shard: its runtime's reviewed cost and its budgets. */
|
|
11
8
|
type RuntimeTierSource = Readonly<{
|
|
12
9
|
runtime: Readonly<{ cost?: unknown }> | null
|
|
@@ -55,9 +52,6 @@ function runtimeTierIssues(source: RuntimeTierSource): RuntimeTierIssue[] {
|
|
|
55
52
|
]
|
|
56
53
|
}
|
|
57
54
|
|
|
58
|
-
export {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
type RuntimeTierSource,
|
|
62
|
-
runtimeTierIssues,
|
|
63
|
-
}
|
|
55
|
+
export { UNNAMED_TIER } from './budget-tiers.ts'
|
|
56
|
+
|
|
57
|
+
export { type RuntimeTierIssue, type RuntimeTierSource, runtimeTierIssues }
|