@korial29/tiny-fps 0.165.0 → 0.166.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.
@@ -135,7 +135,9 @@ lite?: boolean,
135
135
  /** The marine's: lit buttons on the strap round the wrist (WRIST_LIGHTS). */
136
136
  lights?: boolean,
137
137
  /** The xenomorph's claws on the fingertips (Grip). */
138
- claws?: boolean) => void;
138
+ claws?: boolean,
139
+ /** Its size: the xenomorph's grows from the wrist over 4 cm, hers is smaller (hands()). */
140
+ grow?: number) => void;
139
141
  /** What a hand does besides closing (hand()): the left index pointing, the right thumb pushing toward `to`, the left thumb cupped. */
140
142
  export interface Grip {
141
143
  point?: number;
@@ -0,0 +1,33 @@
1
+ import type { PlayerState } from '../shared/types';
2
+ import type { Floor } from './gait';
3
+ import type { Pose } from './rig';
4
+ /** How far the xenomorph's foot is tipped down from flat on its ball, radians: steep, the arch of its sole showing. */
5
+ export declare const FOOT_UP = 1;
6
+ /** Floor speeds, m/s: past the first it drops on all fours (a sprint: its run is 6.6), under the second it stands again. */
7
+ export declare const DROP: number, RISE: number;
8
+ /**
9
+ * The gaits, per paw (hind left, hind right, fore left, fore right): where in the stride it touches
10
+ * down and the share of the stride it stays down. GALLOP is a cheetah's rotary gallop: the hind
11
+ * pair a beat apart and the fore pair the other way round, a flight between them with the back
12
+ * stretched out and one after with it gathered, the fore paws down for less time. CRAWL is a
13
+ * lizard's trot: the diagonal pairs together, the body bending side to side between them.
14
+ */
15
+ export declare const GALLOP: {
16
+ at: number[];
17
+ duty: number[];
18
+ };
19
+ export declare const CRAWL: {
20
+ at: number[];
21
+ duty: number[];
22
+ };
23
+ export interface Fours {
24
+ /** Moves to the state `p` after dt seconds; `floor` is the height of the ground under a point. */
25
+ update(p: PlayerState, dt: number, floor?: Floor): void;
26
+ /** `pose` with the body on all fours laid over it, as far as it has blended in. */
27
+ apply(pose: Pose): Pose;
28
+ /** How far on all fours, 0 to 1. */
29
+ readonly weight: number;
30
+ /** The stride's phase, in cycles. */
31
+ readonly phase: number;
32
+ }
33
+ export declare const createFours: () => Fours;
@@ -1,6 +1,7 @@
1
1
  import type { Choice, PlayerState, Rover } from '../shared/types';
2
2
  import type { World } from '../shared/world';
3
3
  import type { Gait, Seat } from './gait';
4
+ import type { Fours } from './fours';
4
5
  import type { Pieces } from './store';
5
6
  import type { Tracer } from './beams';
6
7
  import type { Piece } from './limbs';
@@ -14,6 +15,8 @@ export interface Runner {
14
15
  /** The player as last seen. */
15
16
  p: PlayerState;
16
17
  gait: Gait;
18
+ /** The xenomorph's gait on all fours (fours.ts): none for the others. */
19
+ fours?: Fours;
17
20
  /** How much of a dash it is in, eased from 0 to 1: the length of the streaks. */
18
21
  dash: number;
19
22
  /** Seconds since its last shot, and how far its gun arm is raised to aim, eased from 0 to 1. */
@@ -133,7 +136,6 @@ export declare const fried: (p: PlayerState) => number;
133
136
  * thins to nothing.
134
137
  */
135
138
  export declare const dissolve: (out: Out, from: number, k: number) => void;
136
- /** The runner's pose this frame, solved: the gait, the fall and sink of one down, and the weapon's hold; and the way the body faces. */
137
139
  export declare const stance: (r: Runner) => {
138
140
  s: {
139
141
  pos: Vec3[];
@@ -15,6 +15,8 @@ export interface Draw {
15
15
  f?: Flesh;
16
16
  /** Worn: armour, which the shader scuffs (grime, chipped paint, scratches) on its glossy and gold parts. */
17
17
  w?: boolean;
18
+ /** Thin: too fine for a shadow, left out of the depth passes (the xenomorph's veins, teeth and eyes). */
19
+ s?: boolean;
18
20
  /** Close hair (hair.ts), coloured `rgb`, swung by `sw` in the head's frame at the time `t`: the shader sways it (swayOf()). */
19
21
  h?: {
20
22
  rgb: number[];
@@ -19,14 +19,43 @@ interface Solved {
19
19
  rot: Quat[];
20
20
  }
21
21
  /**
22
- * Its spine, in the world, from the base of the skull down the back and on into the tail (the user,
23
- * 2026-11-15: vertebrae linked to one another, from the tail up the back to the head): one chain of
24
- * vertebrae, each a bead pinched at its joints with a spine standing out of it, on the back half
25
- * sunk in the skin, the tail free. The tail bends from down and back up to its tip, sways with the
26
- * clock `t` and more with the speed `run` (0 to 1); `sting` (0 to 1) arches it up over the back and
27
- * forward past the head. The stinger glows in the team's `color`. `lod` 0 far, 1 near, 2 close.
28
- */
29
- export declare const column: (out: Out, s: Solved, t: number, run: number, sting: number, color: number[], lod: number) => void;
22
+ * Geometry baked into the beast's skin (shape() in skin.ts), posed with it by flesh() at no cost a
23
+ * frame: places and normals at rest, six numbers a vertex, its two joints and its weight on the
24
+ * second, three vertex indices a triangle and the palette region of each corner.
25
+ */
26
+ export interface Baked {
27
+ v: number[];
28
+ j: number[];
29
+ w: number[];
30
+ t: number[];
31
+ c: number[];
32
+ }
33
+ /** The back's part of the column at a level of detail: baked, how many vertebrae, and the ring the tail goes on from, on the pelvis. */
34
+ interface Back {
35
+ baked: Baked;
36
+ n: number;
37
+ /** The last ring's middle in the pelvis' frame, its way, its radius. */
38
+ c: Vec3;
39
+ tan: Vec3;
40
+ r: number;
41
+ }
42
+ /** The pipes' colour: a very dark grey, lighter than the chitin. */
43
+ export declare const PIPE: number[];
44
+ /**
45
+ * The back's half of its spine, sunk in the skin, and the pipes up its neck, baked into the skin of
46
+ * `lod` (shape() in skin.ts): they only follow the joints, so the shader poses them with the rest
47
+ * of it. The vertebrae lie at rest as column() spaced them; each point hangs on the joints of the
48
+ * two bones it lies between, the last ring on the pelvis alone, where tail() takes the column on.
49
+ */
50
+ export declare const backOf: (lod: number) => Back;
51
+ /**
52
+ * Its tail, in the world, from the solved skeleton `s`: the column's free part, from the pelvis
53
+ * on (the back's is in the skin, backOf()), each vertebra a bead pinched at its joints with a spine
54
+ * standing out of it but near the tip, as bonesOf() bends and sways it; the stinger at its end, a
55
+ * blade swelling to a barb, then a point, glowing in the team's `color`. Written straight into
56
+ * `out`. `lod` 0 far, 1 near, 3 close. `fours` (0 to 1): how far the body is on all fours (fours.ts).
57
+ */
58
+ export declare const tail: (out: Out, s: Solved, t: number, run: number, sting: number, color: number[], lod: number, fours?: number) => void;
30
59
  /** Bone: its claws and teeth, nothing else. */
31
60
  export declare const BONE: number[];
32
61
  /** Where the metatarsal (the foot) ends, from the ankle, in the foot joint's frame: longer than the rig's foot. */
@@ -60,13 +89,6 @@ export declare const ribs: (out: Out, at: Vec3, q: Quat, lod: number, low?: bool
60
89
  * shoulder.
61
90
  */
62
91
  export declare const clavicles: (out: Out, at: Vec3, q: Quat, lod: number) => void;
63
- /**
64
- * Thin pipes up its neck (the user, 2026-11-15: following the neck, in curves, many): six each side,
65
- * from the top of the chest round the neck's sides into the underside of the skull, each through
66
- * points carried by the chest, the neck and the head, so it bends with them, on a smooth curve
67
- * that snakes round the neck. In the world, from the solved skeleton `s`.
68
- */
69
- export declare const pipes: (out: Out, s: Solved, lod: number) => void;
70
92
  /**
71
93
  * Curved horns out of its back (the user, 2026-11-15): a pair on a joint, each from beside the spine
72
94
  * out of the back near square to it and well out to the side, clear of the head, curling up a little, `len` long and `r` thick at its root, at `base` (the right
@@ -104,6 +126,11 @@ export declare const HEAD_UP = 0.065;
104
126
  * with grey teeth, the fangs longest. A grid over the face, finer the closer.
105
127
  */
106
128
  export declare const skull: (out: Out, head: Vec3, q: Quat, lod: number) => void;
129
+ /**
130
+ * The fine parts of its face, too thin for a shadow (soldier.ts keeps them out of the depth passes):
131
+ * its steel teeth and the cords of sinew beside its mouth. Not far.
132
+ */
133
+ export declare const teeth: (out: Out, head: Vec3, q: Quat, lod: number) => void;
107
134
  /**
108
135
  * Veins along its dome (the user, 2026-11-16), on the head joint: on each side three running back
109
136
  * from the face's edge along the banana, wandering a little up and down its side, thinning toward
@@ -111,5 +138,32 @@ export declare const skull: (out: Out, head: Vec3, q: Quat, lod: number) => void
111
138
  */
112
139
  export declare const veins: (out: Out, head: Vec3, q: Quat, lod: number) => void;
113
140
  /** Its eyes, glowing slits at the back of the orbits in the team's `color`. */
114
- export declare const eyes: (out: Out, head: Vec3, q: Quat, color: number[]) => void;
141
+ export declare const eyes: (out: Out, head: Vec3, q: Quat, color: number[], lod?: number) => void;
142
+ /** A rigid piece made at the origin of its joint's frame, then only placed (store.ts). */
143
+ type Make = (o: Out, at: Vec3, q: Quat) => void;
144
+ /**
145
+ * A rigid piece of the xenomorph at a level of detail: its key in the store (all its vertices
146
+ * depend on), how it is made, and whether it is `thin`, too fine for a shadow: left out of the
147
+ * depth passes.
148
+ */
149
+ export interface Part {
150
+ key: string;
151
+ make: Make;
152
+ thin?: boolean;
153
+ }
154
+ /** Its pieces by the joint they go on (partsOf()), those on one joint merged: one draw each a pass. */
155
+ export declare const PART: {
156
+ SHIN: number;
157
+ FOOT: number;
158
+ TOES: number;
159
+ CHEST: number;
160
+ SPINE: number;
161
+ ELBOW: number;
162
+ CUFF_L: number;
163
+ CUFF_R: number;
164
+ HEAD: number;
165
+ FINE: number;
166
+ };
167
+ /** The xenomorph's rigid pieces at `lod`, in PART's order; render.ts makes them all at the map's load. */
168
+ export declare const partsOf: (lod: number) => Part[];
115
169
  export {};
@@ -7,6 +7,8 @@ export declare const TAU: number;
7
7
  export declare const norm: (a: number) => number;
8
8
  /** Unit vector the player faces at yaw, on the floor plane: yaw 0 looks toward -z. */
9
9
  export declare const forward: (yaw: number) => [x: number, z: number];
10
+ /** The unit vector from a player toward a wall or a ledge on each SIDE. */
11
+ export declare const TOWARD: number[][];
10
12
  /** The movement fields of a player at rest on a floor, for a state built by hand. */
11
13
  export declare const STILL: {
12
14
  vx: number;
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.165.0",
5
+ "version": "0.166.0",
6
6
  "type": "module",
7
7
  "files": [
8
8
  "dist"