@wildshard/sdk 0.2.3 → 0.2.5
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/GUIDE.md +178 -18
- package/bin/wildshard.mjs +1 -1
- package/codemods/0.2.5.mjs +12 -0
- package/lint/ratchet.json +1 -9
- package/lint/sdk-plugin.mjs +24 -2
- package/package.json +4 -3
- package/scripts/gen-format-schema.mjs +1 -1
- package/scripts/wildshard.mjs +8 -2
- package/skills/wildshard-upgrade/SKILL.md +15 -22
- package/src/cli/audio/audio.ts +17 -2
- package/src/cli/help.ts +11 -0
- package/src/cli/main.ts +1 -2
- package/src/cli/report.ts +8 -4
- package/src/cli/shardfile/command.ts +1 -2
- package/src/sharddev/agentFiles.ts +127 -0
- package/src/sharddev/author.ts +16 -3
- package/src/sharddev/bake/authoredWorld.ts +1 -1
- package/src/sharddev/bake/specimenCatalogue.ts +1 -1
- package/src/sharddev/bake/staticMaterials.ts +1 -1
- package/src/sharddev/check.ts +7 -6
- package/src/sharddev/checkProject.ts +4 -3
- package/src/sharddev/cli.ts +18 -5
- package/src/sharddev/formatJsonSchema.ts +1117 -3
- package/src/sharddev/kit/bakedGeometry.ts +58 -12
- package/src/sharddev/nativePopulationRows.ts +1 -1
- package/src/sharddev/newProject.ts +4 -25
- package/src/sharddev/performancePolicy.ts +16 -5
- package/src/sharddev/phasedBoss.ts +212 -34
- package/src/sharddev/project.ts +1 -1
- package/src/sharddev/projectEntryProof.ts +1 -1
- package/src/sharddev/projectGeneration.ts +1 -1
- package/src/sharddev/projectOutput.ts +1 -1
- package/src/sharddev/projectSections.ts +1 -1
- package/src/sharddev/refusals.ts +92 -18
- package/src/sharddev/reportCard.ts +1 -1
- package/src/sharddev/sections.ts +1 -1
- package/src/sharddev/species/clips.ts +64 -24
- package/src/sharddev/speciesBrains.ts +98 -15
- package/src/sharddev/updatePins.ts +254 -0
- package/src/sharddev/weapons/bowProfile.ts +3 -3
- package/src/sharddev/weapons/meleeProfile.ts +48 -4
- package/src/sharddev/worldScenes.ts +1 -1
- package/tsconfig.author.json +1 -0
|
@@ -1,16 +1,62 @@
|
|
|
1
|
-
|
|
1
|
+
// The geometry bake codec as the SDK reads it (SHARD-AUTHORING SA12): an offline bake stores each attribute's typed
|
|
2
|
+
// array exactly as its builder made it, then the index as int32 deltas, every block 4-byte aligned (SHARD-PLATFORM M3,
|
|
3
|
+
// the kit system). `test/sdk-engine-types.test.ts` keeps these types equal to the engine's codec
|
|
4
|
+
// (game/plugin/bakedGeometry); `kit/bakedGeometry.test.ts` reads the same geometry from the same bytes as it.
|
|
5
|
+
import { BufferAttribute, BufferGeometry, Float16BufferAttribute } from 'three';
|
|
2
6
|
|
|
3
7
|
/** An attribute's element type in a geometry bake ('f16' is a half float held in a Uint16Array). */
|
|
4
|
-
export type BakedType =
|
|
5
|
-
/** One baked geometry: its attributes, vertex count, index kind and count, and whether it has a box
|
|
6
|
-
export
|
|
8
|
+
export type BakedType = 'f32' | 'f16' | 'u16' | 'i8' | 'u8';
|
|
9
|
+
/** One baked geometry: its attributes [name, type, item size, normalized], vertex count, index kind and count, and whether it has a box. */
|
|
10
|
+
export interface BakedGeometryRow {
|
|
11
|
+
readonly attrs: readonly (readonly [string, BakedType, number, boolean])[];
|
|
12
|
+
readonly count: number;
|
|
13
|
+
readonly index: 'u16' | 'u32' | null;
|
|
14
|
+
readonly indexCount: number;
|
|
15
|
+
/** whether the builder computed its bounding box (every one computes its sphere) */
|
|
16
|
+
readonly box: boolean;
|
|
17
|
+
}
|
|
18
|
+
|
|
7
19
|
/** Bytes per element of each baked type. */
|
|
8
|
-
export const BAKED_BYTES:
|
|
20
|
+
export const BAKED_BYTES: Readonly<Record<BakedType, number>> = { f32: 4, f16: 2, u16: 2, i8: 1, u8: 1 };
|
|
21
|
+
|
|
9
22
|
/** A block's length padded to 4 bytes. */
|
|
10
|
-
export
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
23
|
+
export function pad4(n: number): number { return Math.ceil(n / 4) * 4; }
|
|
24
|
+
|
|
25
|
+
/** The bytes a row's blocks take in a bake: each attribute padded to 4 bytes, then the index as int32 deltas. */
|
|
26
|
+
export function bakedGeometryBytes(row: BakedGeometryRow): number {
|
|
27
|
+
let n = 0;
|
|
28
|
+
for (const [, type, size] of row.attrs) n += pad4(row.count * size * BAKED_BYTES[type]);
|
|
29
|
+
return n + (row.index === null ? 0 : row.indexCount * 4);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** One attribute block's typed array, copied so the attribute owns it. */
|
|
33
|
+
function attribute(bytes: Uint8Array, offset: number, count: number, [, type, size, normalized]: BakedGeometryRow['attrs'][number]): BufferAttribute {
|
|
34
|
+
const buffer = bytes.slice(offset, offset + count * size * BAKED_BYTES[type]).buffer;
|
|
35
|
+
if (type === 'f32') return new BufferAttribute(new Float32Array(buffer), size, normalized);
|
|
36
|
+
if (type === 'f16') return new Float16BufferAttribute(new Uint16Array(buffer), size, normalized);
|
|
37
|
+
if (type === 'u16') return new BufferAttribute(new Uint16Array(buffer), size, normalized);
|
|
38
|
+
if (type === 'i8') return new BufferAttribute(new Int8Array(buffer), size, normalized);
|
|
39
|
+
return new BufferAttribute(new Uint8Array(buffer), size, normalized);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** Reads one baked geometry from the bytes at an offset: its attributes, its index summed back from the deltas, its
|
|
43
|
+
* bounding sphere and (when the row says so) its box. The arrays are copies the geometry owns. */
|
|
44
|
+
export function readBakedGeometry(bytes: Uint8Array, offset: number, row: BakedGeometryRow): BufferGeometry {
|
|
45
|
+
const g = new BufferGeometry();
|
|
46
|
+
let at = offset;
|
|
47
|
+
for (const attr of row.attrs) {
|
|
48
|
+
const [name, type, size] = attr;
|
|
49
|
+
g.setAttribute(name, attribute(bytes, at, row.count, attr));
|
|
50
|
+
at += pad4(row.count * size * BAKED_BYTES[type]);
|
|
51
|
+
}
|
|
52
|
+
if (row.index !== null) {
|
|
53
|
+
const deltas = new Int32Array(bytes.slice(at, at + row.indexCount * 4).buffer);
|
|
54
|
+
const index = row.index === 'u16' ? new Uint16Array(row.indexCount) : new Uint32Array(row.indexCount);
|
|
55
|
+
let last = 0;
|
|
56
|
+
for (let i = 0; i < deltas.length; i++) { last += deltas[i] ?? 0; index[i] = last; }
|
|
57
|
+
g.setIndex(new BufferAttribute(index, 1));
|
|
58
|
+
}
|
|
59
|
+
g.computeBoundingSphere();
|
|
60
|
+
if (row.box) g.computeBoundingBox();
|
|
61
|
+
return g;
|
|
62
|
+
}
|
|
@@ -6,7 +6,7 @@ import { PopulationFieldSchema } from '@wildshard/format/populationEnvironment';
|
|
|
6
6
|
import { parseNativePopulationRows } from '@wildshard/format/populationRoster';
|
|
7
7
|
import { nameBlob, type NamedBlob } from './blobs';
|
|
8
8
|
import { encodeCanonicalJson } from './immutable';
|
|
9
|
-
import { namedJsonSchema, registeredJsonSchema } from '
|
|
9
|
+
import { namedJsonSchema, registeredJsonSchema } from './formatJsonSchema';
|
|
10
10
|
|
|
11
11
|
/** Admit complete native fauna/encounter/pose roster data with its original identity and resource checks. */
|
|
12
12
|
export function parseNativePopulationRoster(input: unknown): ReturnType<typeof parseNativePopulationRows> { return parseNativePopulationRows(input); }
|
|
@@ -5,6 +5,7 @@ import { resolve } from 'node:path';
|
|
|
5
5
|
import { encodeCanonicalJson } from './immutable';
|
|
6
6
|
import { authorCard } from './authorManifest';
|
|
7
7
|
import { writeHandwrittenSource } from './handwritten';
|
|
8
|
+
import { syncAgentFiles } from './agentFiles';
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* SA39 (J319): generators may install any npm package, so a dependency's install scripts run only when listed here.
|
|
@@ -30,29 +31,6 @@ function writeInstallScriptPolicy(project: string): void {
|
|
|
30
31
|
writeFileSync(resolve(project, 'pnpm-workspace.yaml'), INSTALL_SCRIPT_POLICY);
|
|
31
32
|
}
|
|
32
33
|
|
|
33
|
-
/** SA13 (J314): the author's manual at the package root, shipped by `files`; `new` copies it into every project. */
|
|
34
|
-
export const GUIDE_SOURCE: string = resolve(import.meta.dirname, '../../GUIDE.md');
|
|
35
|
-
|
|
36
|
-
/** SA14, SA27 (J314 Q6): the core `wildshard` skill and its three siblings, at the package's `skills/`, shipped by `files`. */
|
|
37
|
-
export const SKILLS = ['wildshard', 'wildshard-mockup-to-model', 'wildshard-goldens', 'wildshard-upgrade'] as const;
|
|
38
|
-
export type SkillName = (typeof SKILLS)[number];
|
|
39
|
-
/** A skill's file in the installed sdk. */
|
|
40
|
-
export const skillSource = (name: SkillName): string => resolve(import.meta.dirname, `../../skills/${name}/SKILL.md`);
|
|
41
|
-
/** Where a project keeps a skill: Claude Code lists project skills from `.claude/skills/<name>/SKILL.md`. */
|
|
42
|
-
export const skillFile = (name: SkillName): string => `.claude/skills/${name}/SKILL.md`;
|
|
43
|
-
/** The core `wildshard` skill (SA14). */
|
|
44
|
-
export const SKILL_SOURCE: string = skillSource('wildshard');
|
|
45
|
-
export const SKILL_FILE: string = skillFile('wildshard');
|
|
46
|
-
|
|
47
|
-
/** Copy the installed sdk's GUIDE.md and the four `wildshard` skills into the project, byte for byte. */
|
|
48
|
-
function writeGuide(project: string): void {
|
|
49
|
-
cpSync(GUIDE_SOURCE, resolve(project, 'GUIDE.md'));
|
|
50
|
-
for (const name of SKILLS) {
|
|
51
|
-
mkdirSync(resolve(project, `.claude/skills/${name}`), { recursive: true });
|
|
52
|
-
cpSync(skillSource(name), resolve(project, skillFile(name)));
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
34
|
/** SA16 (J314, J317): `new --template <name>`. `sdk` is Mossgate (sharddev's `_template`); `blender` is shard-format's
|
|
57
35
|
* hand-written `blender-template` (`corpus/handwritten`): a shard file folder held by hand, no sdk at runtime, no three. */
|
|
58
36
|
export const TEMPLATES = ['sdk', 'blender'] as const;
|
|
@@ -170,7 +148,8 @@ ${layout}
|
|
|
170
148
|
`;
|
|
171
149
|
}
|
|
172
150
|
|
|
173
|
-
/** Write the repo files around a shard source at `src/`: package.json, tsconfig, ignores, README,
|
|
151
|
+
/** Write the repo files around a shard source at `src/`: package.json, tsconfig, ignores, README, and the agent files
|
|
152
|
+
* (GUIDE.md, the four skills, their `.agents/skills` links, AGENTS.md and CLAUDE.md; SA28). */
|
|
174
153
|
function writeRepoFiles(project: string, slug: string, template: TemplateName, empty: boolean): void {
|
|
175
154
|
writeFileSync(resolve(project, 'package.json'), repoPackageJson(slug, empty ? DEFAULT_TEMPLATE : template));
|
|
176
155
|
// A hand-written repo holds no TypeScript to check.
|
|
@@ -179,7 +158,7 @@ function writeRepoFiles(project: string, slug: string, template: TemplateName, e
|
|
|
179
158
|
writeFileSync(resolve(project, '.npmrc'), NPMRC);
|
|
180
159
|
writeFileSync(resolve(project, 'README.md'), repoReadme(slug, template, empty));
|
|
181
160
|
writeInstallScriptPolicy(project);
|
|
182
|
-
|
|
161
|
+
syncAgentFiles(project);
|
|
183
162
|
}
|
|
184
163
|
|
|
185
164
|
/** Copy the shipped teaching world into `source`; generation and gameplay remain authored there. */
|
|
@@ -1,15 +1,26 @@
|
|
|
1
1
|
// oxlint-disable-next-line import/no-nodejs-modules -- Only canonical checkout paths can receive the old-six offline warning policy.
|
|
2
|
-
import { existsSync, realpathSync } from 'node:fs';
|
|
2
|
+
import { existsSync, readFileSync, realpathSync } from 'node:fs';
|
|
3
3
|
// oxlint-disable-next-line import/no-nodejs-modules -- Author identities and symlink spellings do not confer checkout provenance.
|
|
4
4
|
import { resolve } from 'node:path';
|
|
5
|
-
import type { Shardfile } from '@wildshard/
|
|
5
|
+
import type { Shardfile } from '@wildshard/format/shardSchema';
|
|
6
6
|
|
|
7
7
|
const legacy = new Set(['driftwood-isle', 'pine-hollow', 'nalati-grasslands', 'far-reach', 'sunscar-dunes', 'nine-dragon-stack']);
|
|
8
|
+
/** A first-party shard repo is `project-wildshard/shard-*`, its package `@wildshard/shard-*`. SA28: `wildshard new` writes
|
|
9
|
+
* an AGENTS.md into every author repo, so AGENTS.md alone no longer tells a first-party checkout from a `new` one. */
|
|
10
|
+
function firstPartyCheckout(root: string): boolean {
|
|
11
|
+
const file = resolve(root, 'package.json');
|
|
12
|
+
if (!existsSync(file) || !existsSync(resolve(root, 'AGENTS.md'))) return false;
|
|
13
|
+
try {
|
|
14
|
+
const parsed: unknown = JSON.parse(readFileSync(file, 'utf8'));
|
|
15
|
+
const name: unknown = typeof parsed === 'object' && parsed !== null ? Reflect.get(parsed, 'name') : undefined;
|
|
16
|
+
return typeof name === 'string' && name.startsWith('@wildshard/shard-');
|
|
17
|
+
} catch { return false; }
|
|
18
|
+
}
|
|
8
19
|
/** Offline policy is selected by trusted checkout provenance, never by author slug or a product flag. */
|
|
9
|
-
export function projectPerformancePolicy(project: string | undefined, source: Pick<Shardfile,'identity'
|
|
20
|
+
export function projectPerformancePolicy(project: string | undefined, source: Pick<Shardfile,'identity'>, root: string = process.cwd()): 'warn' | 'refuse' {
|
|
10
21
|
if (project === undefined || !legacy.has(source.identity.slug)) return 'refuse';
|
|
11
|
-
|
|
12
|
-
if (!
|
|
22
|
+
// P4: a first-party shard repo is the checkout (the cwd), and it holds the shard at this path.
|
|
23
|
+
if (!firstPartyCheckout(root)) return 'refuse';
|
|
13
24
|
// SA16 (J317): a single-shard repo holds it at src/ (SA24 moves the six there), a multi-shard repo at src/shards/<slug>/.
|
|
14
25
|
const canonical = existsSync(resolve(root, 'src/shard.config.ts')) ? resolve(root, 'src') : resolve(root, 'src/shards', source.identity.slug);
|
|
15
26
|
if (!existsSync(project) || !existsSync(canonical)) return 'refuse';
|
|
@@ -1,34 +1,212 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
/** A
|
|
6
|
-
export type
|
|
7
|
-
/** The
|
|
8
|
-
export type
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
1
|
+
// A phased boss fight's rows, as the SDK defines them (SHARD-AUTHORING SA12): the fixed-arena row (SF27) and the roaming
|
|
2
|
+
// row, both data. The engine runs them (game/plugin/bossPhase `phasedBossFight`; SA26 took that runtime call off the SDK);
|
|
3
|
+
// `test/sdk-engine-types.test.ts` keeps each row type equal to the engine's, so a drift in either fails the test.
|
|
4
|
+
|
|
5
|
+
/** A declared view call as data: the view's name and its numeric arguments (`['arena.shaft', 0, 0.38]`). */
|
|
6
|
+
export type BossViewCall = readonly [string, ...number[]];
|
|
7
|
+
/** The shard's view bindings: one function per declared view name, numeric arguments only (positions are world space). */
|
|
8
|
+
export type BossViewBinding = Readonly<Record<string, (...args: number[]) => void>>;
|
|
9
|
+
|
|
10
|
+
/** What a mode change does, applied in this order: the mode clock, the attack cancel, memory, yaw, motion, hp lock, views, adds, cooldowns, a feed line. */
|
|
11
|
+
export interface BossEffect {
|
|
12
|
+
/** The new mode's clock (default 0). */
|
|
13
|
+
readonly modeT?: number;
|
|
14
|
+
/** Cancel the attack in progress (the act field drops to 0 with it when `mem` says so). */
|
|
15
|
+
readonly cancel?: boolean;
|
|
16
|
+
/** Memory fields written on the body (the body's animation reads them). */
|
|
17
|
+
readonly mem?: Readonly<Record<string, number>>;
|
|
18
|
+
/** Snap the body's yaw. */
|
|
19
|
+
readonly yaw?: number;
|
|
20
|
+
/** The body's motion: yaw, speed, turn rate. */
|
|
21
|
+
readonly motion?: readonly [number, number, number];
|
|
22
|
+
/** Lock hp where it stands (shielded modes and beats restore it every tick). */
|
|
23
|
+
readonly lockHp?: boolean;
|
|
24
|
+
/** View calls. */
|
|
25
|
+
readonly views?: readonly BossViewCall[];
|
|
26
|
+
/** Spawn a wave of adds. */
|
|
27
|
+
readonly wave?: boolean;
|
|
28
|
+
/** Cooldowns set. */
|
|
29
|
+
readonly cooldowns?: Readonly<Record<string, number>>;
|
|
30
|
+
/** A feed line. */
|
|
31
|
+
readonly line?: string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** A mode's motion in the 10 Hz think: hold still, fight (attacks then chase), face the player or a yaw, or walk to a spot. */
|
|
35
|
+
export type BossMotion =
|
|
36
|
+
| { readonly kind: 'hold' }
|
|
37
|
+
| { readonly kind: 'fight' }
|
|
38
|
+
| { readonly kind: 'face'; readonly yaw?: number; readonly turn: number }
|
|
39
|
+
| { readonly kind: 'goto'; readonly spot: 'shield'; readonly speed: number; readonly turn: number; readonly arrive: number; readonly roarTurn: number; readonly next: string };
|
|
40
|
+
|
|
41
|
+
/** A mode's timed beat: after `seconds` in the mode (and only in `phase` when given), go to `to` with `effect`. */
|
|
42
|
+
export interface BossTimeout { readonly seconds: number; readonly to: string; readonly phase?: number; readonly effect?: BossEffect }
|
|
43
|
+
|
|
44
|
+
/** One mode of the fight's state machine. */
|
|
45
|
+
export interface BossModeRow {
|
|
46
|
+
/** Damage taken: 0 = immune, 1 = normal, above 1 = a soft opening (a stun). */
|
|
47
|
+
readonly damage: number;
|
|
48
|
+
/** The bar shimmers and hp is locked every tick. */
|
|
49
|
+
readonly shielded: boolean;
|
|
50
|
+
/** The body looks at the player (1) or not (0). */
|
|
51
|
+
readonly look: number;
|
|
52
|
+
/** The mode drives the body's glow (the intro's modes leave it to the intro). */
|
|
53
|
+
readonly glows: boolean;
|
|
54
|
+
readonly motion: BossMotion;
|
|
55
|
+
readonly timeouts?: readonly BossTimeout[];
|
|
56
|
+
/** Entering the mode through `enter` (a goto's arrival, a resume) applies this. */
|
|
57
|
+
readonly enter?: BossEffect;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** A cut in a combo: its damage, reach multiplier, arc half-width (rad), the shove on a hit, and whether its arc is painted. */
|
|
61
|
+
export interface BossCutRow { readonly damage: number; readonly reachMul: number; readonly arc: number; readonly shove: number; readonly painted: boolean }
|
|
62
|
+
|
|
63
|
+
/** The fight's attack patterns (strike rows), tried in order each think: the burst, then the combo, else the chase. Pairs are [normal, enraged]. */
|
|
64
|
+
export interface BossAttackRows {
|
|
65
|
+
/** The charged burst: its act id, range (min, max m), wind-up seconds, the fraction it fires at, how many rings, the cooldown after (base + rng × spread). */
|
|
66
|
+
readonly burst: {
|
|
67
|
+
readonly act: number; readonly min: number; readonly max: number; readonly seconds: readonly [number, number]; readonly fireAt: number;
|
|
68
|
+
readonly rings: readonly [number, number]; readonly after: readonly [readonly [number, number], readonly [number, number]]; readonly comboFloor: number;
|
|
69
|
+
readonly lines: readonly [string, string];
|
|
70
|
+
};
|
|
71
|
+
/** The combo: its act id, reach (m), how far past reach it engages, the cuts (count per stance), wind-up seconds per cut, contact fraction, chain range past reach, rest after. */
|
|
72
|
+
readonly combo: {
|
|
73
|
+
readonly act: number; readonly reach: number; readonly engage: number; readonly count: readonly [number, number]; readonly seconds: readonly [number, number];
|
|
74
|
+
readonly hitAt: number; readonly chain: number; readonly rest: readonly [number, number]; readonly cuts: readonly BossCutRow[]; readonly above: number;
|
|
75
|
+
};
|
|
76
|
+
/** Committed attacks turn slowly through the wind-up (`turn[0]` before `windup`), barely through the cut. */
|
|
77
|
+
readonly commit: { readonly windup: number; readonly turn: readonly [number, number] };
|
|
78
|
+
/** The chase between attacks: stop distance, speed per stance, turn rate. */
|
|
79
|
+
readonly chase: { readonly stop: number; readonly speed: readonly [number, number]; readonly turn: number };
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/** A phase change's roar: its act id and length, and a memory field it sheds (fades 1 → 0 past `from` at `rate`/s, 0 at the end). */
|
|
83
|
+
export interface BossRoarRow { readonly act: number; readonly seconds: number; readonly shed?: { readonly field: string; readonly from: number; readonly rate: number } }
|
|
84
|
+
|
|
85
|
+
/** One phase: its hp share at the checkpoint, its memory at reset, how a fight resumed at it begins, and what entering it does. */
|
|
86
|
+
export interface BossPhaseRow {
|
|
87
|
+
readonly at: number;
|
|
88
|
+
/** Memory written at a reset to this checkpoint. */
|
|
89
|
+
readonly mem?: Readonly<Record<string, number>>;
|
|
90
|
+
/** A fight resumed at this checkpoint: placed at the shield spot and entering `mode`, its memory, the sweep started. */
|
|
91
|
+
readonly resume?: { readonly shieldSpot?: boolean; readonly mode?: string; readonly mem?: Readonly<Record<string, number>>; readonly sweep?: boolean };
|
|
92
|
+
/** Entering this phase mid-fight. */
|
|
93
|
+
readonly enter?: {
|
|
94
|
+
readonly roar?: BossRoarRow; readonly line?: string; readonly mode: string; readonly modeT: number; readonly views?: readonly BossViewCall[];
|
|
95
|
+
readonly pourDelay?: number; readonly pourStop?: boolean; readonly sweep?: boolean; readonly crownReset?: boolean; readonly lineFirst?: boolean;
|
|
96
|
+
readonly cooldowns?: Readonly<Record<string, number>>;
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/** The expanding ring hazard (a burst's): start radius, gap between rings (s), speed (m/s), last radius, contact band, jump clearance, damage, push. */
|
|
101
|
+
export interface BossRingRow {
|
|
102
|
+
readonly count: number; readonly start: number; readonly gap: number; readonly speed: number; readonly max: number; readonly band: number;
|
|
103
|
+
readonly jump: number; readonly damage: number; readonly push: number; readonly pushTime: number; readonly strike: string;
|
|
104
|
+
}
|
|
105
|
+
/** The timed pour hazard: its spots (arena-local), the phase it runs in, the pick interval, tell and pour lengths, fades, what it piles, how it hurts. */
|
|
106
|
+
export interface BossPourRow {
|
|
107
|
+
readonly spots: readonly { readonly x: number; readonly z: number }[]; readonly phase: number; readonly every: readonly [number, number];
|
|
108
|
+
readonly tell: number; readonly pour: number; readonly fadeIn: number; readonly fadeOut: readonly [number, number];
|
|
109
|
+
readonly pile: { readonly r: number; readonly rate: number; readonly cap: number };
|
|
110
|
+
readonly hitRadius: number; readonly hitRate: number; readonly damage: number; readonly strike: string; readonly reset: number;
|
|
111
|
+
}
|
|
112
|
+
/** The sweeping beam hazard: its arc (radius, z squash, z offset, angular speed, limit, start), ease, what it hurts and how often, and its burn on the boss. */
|
|
113
|
+
export interface BossSweepRow {
|
|
114
|
+
readonly radius: number; readonly squash: number; readonly offset: number; readonly speed: number; readonly limit: number; readonly start: number;
|
|
115
|
+
readonly ease: number; readonly hitRadius: number; readonly damage: number; readonly every: number; readonly strike: string;
|
|
116
|
+
readonly boss: { readonly damage: number; readonly every: number; readonly extra: number; readonly line: string };
|
|
117
|
+
}
|
|
118
|
+
/** Adds: their spots (arena-local, pushed out by `push` along x), the pairs that alternate, the shielded mode they guard, the reinforce wait, the retire delay and the beat when the last falls. */
|
|
119
|
+
export interface BossAddsRow {
|
|
120
|
+
readonly spots: readonly { readonly x: number; readonly z: number; readonly yaw: number }[]; readonly push: number;
|
|
121
|
+
readonly pairs: readonly [readonly number[], readonly number[]]; readonly mode: string; readonly reinforce: number; readonly retireAfter: number;
|
|
122
|
+
readonly cleared: { readonly to: string; readonly effect: BossEffect };
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/** A phased boss fight's row: everything but the views and the arena, as data. */
|
|
126
|
+
export interface PhasedBossRow {
|
|
127
|
+
/** The arena's frame (world): every arena-local spot is relative to it. */
|
|
128
|
+
readonly origin: { readonly x: number; readonly y: number; readonly z: number };
|
|
129
|
+
/** The body stays within ±`bounds` m of the origin. */
|
|
130
|
+
readonly bounds: number;
|
|
131
|
+
/** Its rest (arena-local): where it wakes, the floor there (plinth + lift above the origin), the rest box (half sizes less `inset`). */
|
|
132
|
+
readonly rest: { readonly x: number; readonly z: number; readonly plinth: number; readonly lift: number; readonly halfW: number; readonly halfL: number; readonly inset: number; readonly focusY: number };
|
|
133
|
+
/** Where it kneels to shield (arena-local). */
|
|
134
|
+
readonly shieldSpot: { readonly x: number; readonly z: number };
|
|
135
|
+
/** The phase from which it is enraged (the second of every pair). */
|
|
136
|
+
readonly enragedFrom: number;
|
|
137
|
+
readonly phases: readonly BossPhaseRow[];
|
|
138
|
+
readonly modes: Readonly<Record<string, BossModeRow>>;
|
|
139
|
+
/** The modes the fight starts, rises, fights and dies in. */
|
|
140
|
+
readonly modeNames: { readonly rest: string; readonly rising: string; readonly fight: string; readonly dead: string };
|
|
141
|
+
readonly attacks: BossAttackRows;
|
|
142
|
+
/** The memory fields the fight drives: the attack's act, the cut's index, its hit latch, the floor height, the smoothed floor, the rise and the pose. */
|
|
143
|
+
readonly fields: { readonly act: string; readonly strike: string; readonly hitDone: string; readonly floorY: string; readonly floorS: string; readonly rise: string; readonly pose: string };
|
|
144
|
+
/** The reset: memory, cooldowns (base + rng × spread for `burst`), the drifts piled from `drifts.fromPhase`, the view calls. */
|
|
145
|
+
readonly reset: {
|
|
146
|
+
readonly mem: Readonly<Record<string, number>>; readonly combo: number; readonly burst: readonly [number, number]; readonly pourDelay: number;
|
|
147
|
+
readonly drifts: { readonly fromPhase: number; readonly height: number; readonly cap: number; readonly at: readonly (readonly [number, number, number])[] };
|
|
148
|
+
readonly views: readonly BossViewCall[]; readonly glow: number;
|
|
149
|
+
};
|
|
150
|
+
/** The intro (long, short): the lid's window, the rise's window, the shaft's pulse length; the shaft and the glow's waking. */
|
|
151
|
+
readonly intro: {
|
|
152
|
+
readonly long: { readonly lid: readonly [number, number]; readonly rise: readonly [number, number]; readonly pulse: number };
|
|
153
|
+
readonly short: { readonly lid: readonly [number, number]; readonly rise: readonly [number, number]; readonly pulse: number };
|
|
154
|
+
readonly shaft: { readonly index: number; readonly base: number; readonly amp: number };
|
|
155
|
+
readonly glow: { readonly base: number; readonly peak: number; readonly lead: number; readonly fade: number };
|
|
156
|
+
};
|
|
157
|
+
/** The fight begins: memory, cooldowns (burst base + rng × spread), view calls, the resting glow. */
|
|
158
|
+
readonly begin: { readonly mem: Readonly<Record<string, number>>; readonly combo: number; readonly burst: readonly [number, number]; readonly views: readonly BossViewCall[] };
|
|
159
|
+
/** The glow: resting, the glint's and charge's weights and fades, the enraged burn. */
|
|
160
|
+
readonly glow: { readonly base: number; readonly glint: number; readonly charge: number; readonly glintFade: number; readonly chargeFade: number; readonly burn: readonly [number, number, number] };
|
|
161
|
+
/** Damage: the head sphere (radius × scale + pad), the armour melee breaks (range, hits, ranged share until broken, line). */
|
|
162
|
+
readonly hits: { readonly head: readonly [number, number]; readonly armour: { readonly melee: number; readonly breaks: number; readonly ranged: number; readonly line: string } };
|
|
163
|
+
/** A weak point worn by headshots from `fromPhase`: its hp, the memory field it lives on, the beat when it breaks. */
|
|
164
|
+
readonly crown: { readonly hp: number; readonly fromPhase: number; readonly field: string; readonly to: string; readonly effect: BossEffect };
|
|
165
|
+
readonly rings: BossRingRow;
|
|
166
|
+
readonly pour: BossPourRow;
|
|
167
|
+
readonly sweep: BossSweepRow;
|
|
168
|
+
readonly adds: BossAddsRow;
|
|
169
|
+
/** The victory: its view calls, when the body crumbles (s) and how fast the arena drains. */
|
|
170
|
+
readonly victory: { readonly views: readonly BossViewCall[]; readonly crumble: number; readonly drain: number };
|
|
171
|
+
/** Every view name the fight may call (the binding must bind exactly these). */
|
|
172
|
+
readonly views: readonly string[];
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/** One phase's movement, openings, summons and arena changes. */
|
|
176
|
+
export interface RoamingBossPhase {
|
|
177
|
+
readonly at: number; readonly beginMode: string; readonly chaseSpeed: number; readonly recoverySeconds: number;
|
|
178
|
+
readonly burstCooldown: number; readonly summons: boolean; readonly rings: number; readonly darkness: boolean;
|
|
179
|
+
readonly enter?: { readonly mode: string; readonly drop?: boolean; readonly summonDelay?: number; readonly resetChain?: boolean; readonly roar?: boolean };
|
|
180
|
+
}
|
|
181
|
+
/** A stance's policy and damage rule; mode names are authored, not interpreted as content identities. */
|
|
182
|
+
export interface RoamingBossMode {
|
|
183
|
+
readonly kind: 'idle'|'intro'|'pursue'|'strike'|'burst'|'wait-rings'|'recover'|'summon'|'lanes'|'dead';
|
|
184
|
+
readonly damage: number;
|
|
185
|
+
}
|
|
186
|
+
/** Roaming encounters use authored strike clocks, lane chains, falling hazards and roaming adds on the same phasedBoss entry. */
|
|
187
|
+
export interface RoamingBossRow<K extends string, A extends string, Q extends string> {
|
|
188
|
+
/** Admitted guest fields; the arena owner applies requests without selecting actions. */
|
|
189
|
+
readonly decision: { readonly mode: string; readonly request: string; readonly rings: string; readonly adds: string; readonly lane: string;
|
|
190
|
+
readonly phase: string; readonly fight: string; readonly modeT: string; readonly strikeCd: string; readonly burstCd: string; readonly summonCd: string; readonly chain: string; readonly modes: readonly string[] };
|
|
191
|
+
readonly kind: 'roaming'; readonly origin: { readonly x: number; readonly z: number };
|
|
192
|
+
readonly phases: readonly RoamingBossPhase[]; readonly modes: Readonly<Record<string, RoamingBossMode>>;
|
|
193
|
+
readonly names: { readonly idle: string; readonly intro: string; readonly dead: string; readonly pursue: string; readonly strike: string; readonly burst: string; readonly wait: string; readonly recover: string; readonly summon: string };
|
|
194
|
+
readonly arena: { readonly entry: number; readonly wall: number; readonly fog: number; readonly leash: number; readonly wallPad: number; readonly clampPad: number; readonly shoveBase: number; readonly shoveGain: number; readonly shoveDistance: number; readonly shoveSpan: number; readonly epsilon: number };
|
|
195
|
+
readonly seal: { readonly inSeconds: number; readonly outSeconds: number; readonly darkIn: number; readonly darkOut: number };
|
|
196
|
+
readonly opening: { readonly mode: string; readonly lanesMode: string; readonly inRate: number; readonly outRate: number; readonly inactiveRate: number };
|
|
197
|
+
readonly damage: { readonly invulnerable: number; readonly weakOpen: number; readonly weakClosed: number; readonly opening: number };
|
|
198
|
+
readonly initial: { readonly strikeCd: number; readonly burstCd: number; readonly summonCd: number };
|
|
199
|
+
readonly recoveryTurn: number;
|
|
200
|
+
readonly reset: { readonly glow: number; readonly strikeCd: number; readonly burstCd: number; readonly summonCd: number; readonly herd: number };
|
|
201
|
+
readonly intro: { readonly short: number; readonly long: number; readonly glowStart: number; readonly glowEnd: number; readonly lookEnd: number; readonly roarAt: number; readonly crossingStep: number; readonly absentHeight: number };
|
|
202
|
+
readonly begin: { readonly glow: number; readonly summonDelay: number }; readonly victoryGlow: number;
|
|
203
|
+
readonly points: { readonly rewardZ: number; readonly rewardY: number; readonly respawnZ: number; readonly respawnYaw: number };
|
|
204
|
+
readonly strike: { readonly id: string; readonly clip: { readonly duration: number; readonly hitPhase: number }; readonly action: A; readonly reach: number; readonly chaseNear: number; readonly chaseTurn: number; readonly turn: number; readonly radius: number; readonly cooldown: number; readonly tell: readonly [number,number,number,number,number]; readonly trauma: number; readonly contactTrauma: number };
|
|
205
|
+
readonly burst: { readonly clip: { readonly duration: number; readonly hitPhase: number }; readonly action: A; readonly after: number; readonly turn: number; readonly radius: number; readonly tell: readonly [number,number,number,number,number]; readonly trauma: number };
|
|
206
|
+
readonly rings: { readonly gap: number; readonly speed: number; readonly trauma: number; readonly strike: string };
|
|
207
|
+
readonly summon: { readonly clip: { readonly duration: number; readonly hitPhase: number }; readonly action: A; readonly count: number; readonly limit: number; readonly cooldown: number; readonly turn: number };
|
|
208
|
+
readonly lanes: { readonly stop: number; readonly speed: number; readonly turn: number; readonly burstRange: number; readonly after: number; readonly tell: number; readonly action: A; readonly batch: number; readonly rest: number; readonly chainRest: number; readonly soundTicks: number; readonly trauma: number };
|
|
209
|
+
readonly adds: { readonly kinds: readonly K[]; readonly radius: number; readonly far: number; readonly near: number; readonly fast: number; readonly slow: number; readonly turn: number; readonly chargeRange: number; readonly rate: number; readonly tell: number; readonly trauma: number; readonly leashPad: number };
|
|
210
|
+
readonly hazards: { readonly count: number; readonly angleStart: number; readonly angleStep: number; readonly angleOffset: number; readonly radius: number; readonly radiusStep: number; readonly fallSeconds: number; readonly every: number; readonly damage: number; readonly strike: string; readonly fromPhase: number };
|
|
211
|
+
readonly sounds: { readonly intro: Q; readonly roar: Q; readonly burst: Q; readonly add: Q; readonly charge: Q };
|
|
212
|
+
}
|
package/src/sharddev/project.ts
CHANGED
|
@@ -14,7 +14,7 @@ import { resolve, sep } from 'node:path';
|
|
|
14
14
|
import process from 'node:process';
|
|
15
15
|
import { build } from 'vite';
|
|
16
16
|
import ts from '@typescript/typescript6';
|
|
17
|
-
import { parseShardfile, type Shardfile } from '@wildshard/
|
|
17
|
+
import { parseShardfile, type Shardfile } from '@wildshard/format/shardSchema';
|
|
18
18
|
import { preflightAssetGraph, offlineMemoryAdmission, prepareAssetDecoders } from "@wildshard/format/product";
|
|
19
19
|
import { preflightDeclaredCosts } from '@wildshard/format/assetAdmission';
|
|
20
20
|
import { preflightShardfile } from '@wildshard/format/preflight';
|
|
@@ -7,7 +7,7 @@ import { Physics } from '@wildshard/engine/physics/Physics';
|
|
|
7
7
|
import { addBakedPieces } from '@wildshard/engine/game/plugin/simulation';
|
|
8
8
|
import { proveEntryways } from '@wildshard/engine/game/bake/entryways';
|
|
9
9
|
import { readBoundedFile } from './sourceReader';
|
|
10
|
-
import { parseShardfile, type Shardfile } from '@wildshard/
|
|
10
|
+
import { parseShardfile, type Shardfile } from '@wildshard/format/shardSchema';
|
|
11
11
|
|
|
12
12
|
/** Actual static capsule walks and transfers, never a caller-supplied receipt. */
|
|
13
13
|
export interface StaticPortalEntryProof { readonly lanes: number; readonly steps: number; readonly portalTransfers: number }
|
|
@@ -30,7 +30,7 @@ import { memoAssemblyScript } from './bake/assemblyscriptMemo';
|
|
|
30
30
|
import { meshoptNoLargerMemo } from './bake/meshoptChoiceMemo';
|
|
31
31
|
import { projectInputFiles } from './projectInputFiles';
|
|
32
32
|
import { generationCache, maybePruneGenerationCache } from './generationCache.ts';
|
|
33
|
-
import type { Shardfile } from '@wildshard/
|
|
33
|
+
import type { Shardfile } from '@wildshard/format/shardSchema';
|
|
34
34
|
import type { ProjectOutput } from './projectOutput';
|
|
35
35
|
import type { DiscoveryInput } from '@wildshard/format/discoveryValues';
|
|
36
36
|
|
|
@@ -8,7 +8,7 @@ import * as v from 'valibot';
|
|
|
8
8
|
import { ScriptContractSchema, decisionModuleContracts, type ScriptContractInput, type ScriptContract } from '@wildshard/format/scriptContract';
|
|
9
9
|
import { OutputIndexSchema, type OutputFile } from '@wildshard/format/outputIndex';
|
|
10
10
|
import { ShardNaturalSchema } from '@wildshard/format/shardSections';
|
|
11
|
-
import { parseShardfile, type Shardfile } from '@wildshard/
|
|
11
|
+
import { parseShardfile, type Shardfile } from '@wildshard/format/shardSchema';
|
|
12
12
|
import { readNamedBlob, emitNamedBlobs, nameBlob, type NamedBlob, type ServerBlob } from './blobs';
|
|
13
13
|
import { encodeCanonicalJson } from './immutable';
|
|
14
14
|
import { copyAssetBytes, hashAssetBytes } from './assetHandle';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isJsonData } from '@wildshard/format/json';
|
|
2
2
|
import { parseOutputSection } from '@wildshard/format/outputIndex';
|
|
3
3
|
import { SHARDFILE_ADMISSION_LIMITS } from '@wildshard/format/admissionLimits';
|
|
4
|
-
import { parseShardfile, type Shardfile } from '@wildshard/
|
|
4
|
+
import { parseShardfile, type Shardfile } from '@wildshard/format/shardSchema';
|
|
5
5
|
import { encodeCanonicalJson } from './immutable';
|
|
6
6
|
|
|
7
7
|
/** CLI-only root-mapped section declarations. Existing nonempty fields cannot be overridden. */
|