@korial29/tiny-fps 0.196.2 → 0.197.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.
@@ -13,7 +13,7 @@ export declare const CATCH = 0.12;
13
13
  export declare const TRAIL = 1.2;
14
14
  export interface Balls {
15
15
  /** The own player fired, or threw an arc with the katana: `p` is his state after the step, `now` the time of the step (ms). */
16
- fire(p: PlayerState, now: number): void;
16
+ fire(p: PlayerState, now: number, harpoon?: boolean, disc?: boolean): void;
17
17
  /** The balls of a snapshot received at `now` (ms); `me` is the own id. */
18
18
  snapshot(balls: Ball[], me: number, now: number): void;
19
19
  /**
@@ -29,7 +29,7 @@ export interface Body {
29
29
  /** Appends the body's vertices (see STRIDE) in the jacket `color`; nothing when pose() has none. */
30
30
  draw(out: Out, eye: Vec3, yaw: number, pitch: number, roll?: number, color?: number[]): void;
31
31
  /** The own player's character (BUILD in rig.ts, PlayerInfo.body): the woman's arms are slimmer and her hands smaller, on the same grips; `tone` the skin he picked (the default's when absent). */
32
- wear(build: number, tone?: number[], ninja?: boolean, xeno?: boolean): void;
32
+ wear(build: number, tone?: number[], ninja?: boolean, xeno?: boolean, hunter?: boolean): void;
33
33
  }
34
34
  export declare const inv: ([x, y, z, w]: Quat) => Quat;
35
35
  /** The shortest rotation that turns the direction a into b. */
@@ -68,5 +68,7 @@ voice?: (id: number) => number,
68
68
  /** A player's BODY: his death cries' voice. */
69
69
  bodyOf?: (id: number) => number | undefined,
70
70
  /** Whether a player is a xenomorph: its own cries, its acid, its hiss at a tail's charge, its shriek at a dash. */
71
- beast?: (id: number) => boolean) => Combat;
71
+ beast?: (id: number) => boolean,
72
+ /** Whether a player fires the Hunter's harpoon rather than a plasma ball. */
73
+ hunter?: (id: number) => boolean) => Combat;
72
74
  export {};
@@ -20,11 +20,12 @@ export declare const GLOW: number, DEAD: number, MORE: number, FRAMES: number;
20
20
  export declare const frame: (level: number, e: number) => number;
21
21
  /** The colours of the palette, RGBA as one number each (little-endian ABGR for ImageData). */
22
22
  export declare const PALETTE: number[];
23
- /** The faces of sprite(): the man's, the woman's and the xenomorph's. */
23
+ /** The faces of sprite(): the man's, the woman's, the xenomorph's and the Hunter's. */
24
24
  export declare const LOOK: {
25
25
  readonly MAN: 0;
26
26
  readonly WOMAN: 1;
27
27
  readonly XENO: 2;
28
+ readonly HUNTER: 3;
28
29
  };
29
30
  /**
30
31
  * Frame `n`'s pixels, FW by FH palette indices, row by row; built once. `fem` (LOOK.WOMAN) is the
@@ -76,6 +76,8 @@ export interface Hud {
76
76
  marks(list: Mark[]): void;
77
77
  /** The orbital station's mission line (mission.ts), `hot` when urgent; none hides it. */
78
78
  mission(text?: string, hot?: boolean): void;
79
+ /** The Hunter's current local vision mode. */
80
+ hunterVision(text?: string): void;
79
81
  /** The dark rim of a space helmet's visor around the screen: on while the own player wears one, off otherwise. */
80
82
  visor(on: boolean): void;
81
83
  /** The red vignette of a tackle, 0 (none) to 1 (full). */
@@ -0,0 +1 @@
1
+ export declare function hunter(lod: 0 | 1 | 2): Record<string, number[]>;
@@ -49,6 +49,10 @@ export interface Controls {
49
49
  * step after a double click of it (the special); G is a short press of it.
50
50
  */
51
51
  beast: boolean;
52
+ /** Hunter-only local vision: 0 normal, 1 thermal, 2 alien scan. */
53
+ vision: number;
54
+ /** Whether the local player chose the Hunter class. */
55
+ hunter: boolean;
52
56
  /**
53
57
  * The KEY bits of the next step, read once per step. Same as `keys`, plus BLADE while the katana
54
58
  * is chosen and RAIL while the rail gun is, except for the step right after a double tap: it carries DASH and only the tapped
@@ -15,6 +15,12 @@ export declare const S: number, C: number;
15
15
  * rounded-square guard, a grip wrapped in a violet check and a pommel with a glowing bead.
16
16
  */
17
17
  export declare const katana: (lod: number) => number[];
18
+ /** The Hunter's twin wrist blades and bracer, in the hand's local space. */
19
+ export declare const wristBlade: (lod: number) => number[];
20
+ /** Places the wrist blade at the Hunter's right wrist. */
21
+ export declare const heldWrist: (out: Out, pos: Vec3, q: Quat, lod: number, k?: number, list?: Pieces) => void;
22
+ /** The blade's sweep endpoints for the Hunter's cut trail. */
23
+ export declare const wristEnds: (pos: Vec3, q: Quat) => Vec3[];
18
24
  /** Appends arcs of lightning flickering along the blade at the clock `t` (s): a few zigzags of thin crossed ribbons, each new every 70 ms. */
19
25
  export declare const arcs: (out: Out, at: Vec3, [r, u, f]: Vec3[], t: number, lod: number, k?: number) => void;
20
26
  /**
@@ -178,6 +178,8 @@ export interface Renderer {
178
178
  parried(id: number, late: number): void;
179
179
  /** The xenomorph's vision (the own player is one): a grey-blue world, the enemies in sight glowing. */
180
180
  vision(on: boolean): void;
181
+ /** The Hunter's local vision filter and the players it can detect. */
182
+ hunterVision(mode: number, targets: PlayerState[]): void;
181
183
  /** Let eligible glory kill targets flash during play. */
182
184
  edge(on: boolean): void;
183
185
  /** The body of each player (PlayerInfo.body, BODY), from the roster: the man's for one not in it; and the skin and haircut he picked, his id's for one not in `looks`. */
@@ -145,6 +145,12 @@ export declare const SOUND: {
145
145
  readonly HER_DEATH: 71;
146
146
  readonly GROAN: 72;
147
147
  readonly HER_GROAN: 73;
148
+ /** A Hunter harpoon: a tight mechanical release, then a quick metallic flight zing. */
149
+ readonly HARPOON: 74;
150
+ /** Original Hunter voice: a pain rasp, a fatal throat shriek and the short radio click-call. */
151
+ readonly HUNTER_PAIN: 75;
152
+ readonly HUNTER_DEATH: 76;
153
+ readonly HUNTER_TAUNT: 77;
148
154
  };
149
155
  /**
150
156
  * The sounds of the game: one entry per sound, its voices layered, in SOUND order. A low-passed
@@ -164,7 +164,7 @@ export declare const lowered: (r: Runner) => number;
164
164
  * seen from the runner's eye (the share `e` of it, so that it is drawn from the guard and back to
165
165
  * it), and the trunk twisting, bending and leaning through it (trunk()).
166
166
  */
167
- export declare const brandish: (from: Pose, p: PlayerState, prog: number, ph: number, t?: number, parry?: number) => Pose;
167
+ export declare const brandish: (from: Pose, p: PlayerState, prog: number, ph: number, t?: number, parry?: number, oneHand?: boolean) => Pose;
168
168
  /**
169
169
  * How closed the hands of `p` are, left then right (hand() in body.ts: 0 flat, 0.9 round a grip, 1
170
170
  * a fist), as the own body closes its own: round what they hold and on the wheel, fists with
@@ -45,4 +45,6 @@ speaker: (id: number) => number,
45
45
  /** A player's team from the roster. */
46
46
  team?: (id: number) => number | undefined,
47
47
  /** Whether a player is a xenomorph: it roars (ROAR), with no words, over the radio all the same. */
48
- beast?: (id: number) => boolean) => Taunts;
48
+ beast?: (id: number) => boolean,
49
+ /** Whether a player is a Hunter: its original click-call plays as a radio taunt. */
50
+ hunter?: (id: number) => boolean) => Taunts;
@@ -359,6 +359,22 @@ export declare const GUN_RANGE = 80;
359
359
  export declare const PLASMA_SPEED = 80;
360
360
  export declare const RIFLE_SPEED = 400;
361
361
  export declare const PLASMA_R = 0.12;
362
+ /** Ball.power of the Hunter's harpoon: its own projectile kind in snapshots. */
363
+ export declare const HARPOON = 8;
364
+ export declare const HARPOON_SPEED = 72;
365
+ export declare const HARPOON_RANGE = 90;
366
+ export declare const HARPOON_R = 0.08;
367
+ export declare const HARPOON_HP = 2;
368
+ /** Ball.power values for a Hunter's returning disc (outbound, then returning). */
369
+ export declare const DISK = 9;
370
+ export declare const DISK_RETURN = 10;
371
+ export declare const DISK_SPEED = 52;
372
+ export declare const DISK_RANGE = 28;
373
+ export declare const DISK_R = 0.16;
374
+ export declare const DISK_HP = 2;
375
+ export declare const DISK_COOL = 75;
376
+ /** Ticks between assisted shoulder-laser hits. */
377
+ export declare const HUNTER_LASER_COOL = 18;
362
378
  /** Plasma balls in flight in a room at most: past it the oldest bursts. They go on the wire. */
363
379
  export declare const PLASMA_MAX = 64;
364
380
  /** Ball.power of a vehicle's laser bolt (rover.ts): past CHARGE_MAX, so it names the bolt. It flies at BOLT_SPEED m/s. */
@@ -15,6 +15,7 @@ export declare const STRIKE: {
15
15
  readonly RAIL: 3;
16
16
  readonly LASER: 4;
17
17
  readonly NADE: 5;
18
+ readonly DISK: 6;
18
19
  };
19
20
  export type Strike = (typeof STRIKE)[keyof typeof STRIKE];
20
21
  /**
@@ -4,6 +4,7 @@ export declare const ROLE: {
4
4
  readonly NINJA: 1;
5
5
  readonly ASTRONAUT: 2;
6
6
  readonly XENO: 3;
7
+ readonly HUNTER: 4;
7
8
  };
8
9
  export interface Kit {
9
10
  run: number;
@@ -48,6 +49,8 @@ export interface Kit {
48
49
  * walls (MODE.CLING), a dash's burst that pins an enemy it reaches, acid for blood (room.ts).
49
50
  */
50
51
  xeno: boolean;
52
+ /** The Hunter's class identity; its weapons and vision are introduced in later build steps. */
53
+ hunter?: boolean;
51
54
  }
52
55
  /** By ROLE. The astronaut moves and fights as the marine: the moon's gravity is the map's. */
53
56
  export declare const KITS: readonly Kit[];
@@ -88,6 +88,8 @@ export interface Body {
88
88
  }
89
89
  /** The offset from the closest point of a body's axis to (x, z), and the height of its bottom there. */
90
90
  export declare const gapTo: (o: Body, x: number, z: number) => [dx: number, dz: number, y: number];
91
+ /** A conservative horizontal bound around a body's axis, expanded by the other radius. */
92
+ export declare const nearBody: (o: Body, x: number, z: number, radius: number) => boolean;
91
93
  /**
92
94
  * The highest floor under the point (x, z) at most as high as y: the ground of the relief, or the
93
95
  * top of a brush the point is over. For a rover's wheel.
@@ -21,7 +21,9 @@ export declare const drift: (n: number) => [number, number];
21
21
  * as the shot (`power`). The laser rifle's (the user, 2026-11-08: the gun's balls, in red) has
22
22
  * power 0, RIFLE_RANGE to go, and leaves along the look drifted by its shot's pattern.
23
23
  */
24
- export declare const launch: (p: PlayerState, team?: number) => Flying;
24
+ export declare const launch: (p: PlayerState, team?: number, harpoon?: boolean) => Flying;
25
+ /** The Hunter's returning disc: a wide, fast shot that the room turns back toward its owner. */
26
+ export declare const disk: (p: PlayerState, team?: number) => Flying;
25
27
  /**
26
28
  * The arc of energy the ARC cut of `p` throws at its strike (`p` the state after that step): from
27
29
  * the eye along the look like a ball, ARC_RANGE metres to go, its CUT in `arc`. Its id is the
@@ -1,5 +1,5 @@
1
1
  import type { BotView } from './bot';
2
- import type { Choice, Input, PlayerInfo, Snapshot } from './types';
2
+ import type { Choice, Input, PlayerInfo, PlayerState, Snapshot } from './types';
3
3
  /**
4
4
  * join: the first frame of a peer, with what he picked on the title screen (Choice: the body, BODY,
5
5
  * the man without it; the skin, the haircut, the class). map: the host picks the map of the next
@@ -102,8 +102,16 @@ export declare const onWire: (i: Input) => Input;
102
102
  export declare const encodeInput: (i: Input) => ArrayBuffer;
103
103
  /** Null on anything that is not a well-formed input frame. */
104
104
  export declare const decodeInput: (buf: ArrayBuffer) => Input | null;
105
- export declare const encodeSnapshot: (s: Snapshot) => ArrayBuffer;
105
+ type SnapshotStates = Omit<Snapshot, 'players'> & {
106
+ players: readonly PlayerState[];
107
+ };
108
+ export declare function encodeSnapshot(s: Snapshot): ArrayBuffer;
109
+ export declare function encodeSnapshot(s: SnapshotStates, meta: readonly {
110
+ ack: number;
111
+ by: number;
112
+ }[]): ArrayBuffer;
106
113
  /** Null on anything that is not a well-formed snapshot frame. */
107
114
  export declare const decodeSnapshot: (buf: ArrayBuffer) => Snapshot | null;
108
115
  /** Returns null on anything that is not a known text message. */
109
116
  export declare const parseText: <T extends ClientText | ServerText>(raw: string) => T | null;
117
+ export {};
@@ -21,8 +21,12 @@ export declare class Room {
21
21
  private gone;
22
22
  /** The plasma balls in flight, and the ones that burst since the last snapshot, which sends them once more. */
23
23
  private balls;
24
+ /** Last tick a Hunter's shoulder laser hit, by player id. */
25
+ private hunterLasers;
24
26
  /** The map's rovers, in the order of WorldDef.rovers, then its ships (ship.ts). */
25
27
  private rovers;
28
+ /** Collision geometry reused while a vehicle's pose is unchanged. */
29
+ private vehicleBodies;
26
30
  /** Ticks toward each ship's next missile, by index in `rovers`. */
27
31
  private rearm;
28
32
  /** Each vehicle's damage short of a whole hp, by index in `rovers`. */
@@ -65,6 +69,8 @@ export declare class Room {
65
69
  receive(conn: Conn, data: string | ArrayBuffer): void;
66
70
  /** One input of a player, moved at once. An input beyond the bank is dropped, and not acked. */
67
71
  private apply;
72
+ /** Vehicle solids for a step; a driven vehicle can move between two players' inputs. */
73
+ private solids;
68
74
  /** A peer left: its player goes, the roster goes out again. */
69
75
  disconnect(conn: Conn): void;
70
76
  /**
@@ -186,6 +192,8 @@ export declare class Room {
186
192
  * and counts a hit. An enemy vehicle's hull is drained the same way, and shields who is behind it.
187
193
  */
188
194
  private rail;
195
+ /** A lightly assisted shoulder shot: host-side target selection stays inside a narrow forward cone. */
196
+ private shoulder;
189
197
  /** 1 hp of the bolt's drain to `foe`, as his railer deals it; if it puts him down he is disintegrated (`fried`). */
190
198
  private fry;
191
199
  /**
@@ -362,7 +362,7 @@ export interface Ball {
362
362
  dz: number;
363
363
  /** It burst where it is: the last snapshot that carries it. */
364
364
  burst: boolean;
365
- /** Its strength, 1 to CHARGE_MAX: the health it takes. Absent reads 1. 0 is a laser rifle's, BOLT a rover's, NADE a grenade. */
365
+ /** Its strength, 1 to CHARGE_MAX: the health it takes. Absent reads 1. 0 is a laser rifle's, BOLT a rover's, NADE a grenade, HARPOON a Hunter's harpoon. */
366
366
  power?: number;
367
367
  /** A grenade's speed along its direction, m/s (the wire keeps whole m/s, 63 at most). Absent for the rest. */
368
368
  v?: number;
@@ -370,6 +370,8 @@ export interface Ball {
370
370
  arc?: number;
371
371
  /** A ship's missile (power NADE): it flies straight, and its blast reaches MISSILE_R. */
372
372
  missile?: boolean;
373
+ /** A Hunter disc which is steering back to its owner. */
374
+ returning?: boolean;
373
375
  }
374
376
  /** The flag of a team as a snapshot carries it: only the fields of its state are meaningful, the rest read 0. */
375
377
  export interface FlagState {
@@ -106,6 +106,8 @@ export interface World {
106
106
  }
107
107
  /** The key of the cell with integer coordinates (cx, cz). */
108
108
  export declare const key: (cx: number, cz: number) => number;
109
+ /** Brush candidates in the one cell containing a point; the returned list is read-only. */
110
+ export declare const atPoint: (w: World, x: number, z: number) => readonly number[];
109
111
  /** Builds the grid: each brush is listed in every cell its footprint covers. */
110
112
  export declare const build: (def: WorldDef, cell?: number) => World;
111
113
  /**
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@korial29/tiny-fps",
3
3
  "description": "Tiny multiplayer first-person rooftop game for the browser: raw WebGL, zero runtime dependencies, WebSocket or same-browser multi-tab play.",
4
4
  "license": "Apache-2.0",
5
- "version": "0.196.2",
5
+ "version": "0.197.0",
6
6
  "type": "module",
7
7
  "files": [
8
8
  "dist"