@korial29/tiny-fps 0.181.0 → 0.182.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/dist/server.js CHANGED
@@ -73,7 +73,7 @@ var CLAW = {
73
73
  strike: 5,
74
74
  reach: 1.8,
75
75
  arc: .7,
76
- hp: 4,
76
+ hp: 2,
77
77
  hold: -1,
78
78
  knock: 0
79
79
  };
@@ -105,12 +105,18 @@ var PUNCHES = [
105
105
  * The xenomorph's tail (the user, 2026-11-16: it fights as the katana does, slower, and its sting
106
106
  * kills). The right button (KEY.BLADE, input.ts) starts a strike by the keys as cutOf() reads them:
107
107
  * a STAB ahead with FORWARD, a SWEEP across from LEFT or RIGHT, else a LASH down from above. Held at
108
- * the top of its wind-up (`hold`) it charges as a cut does (HEAVY, swingOf()). A double click of the
109
- * right button (KEY.SPECIAL with it) is its special: a sweep's is the SPIN, the tail whipped all
110
- * round the body; the stab's and the lash's the LEAP, up TAIL_LEAP m/s and down on the foe as it
111
- * lands. Whoever a strike reaches goes down (`hp` Infinity: through armour). The xenomorph's `cut`
112
- * reads this table: CLAW_L and CLAW_R are its claws, at their place in it.
108
+ * the top of its wind-up (`hold`) it charges as a cut does (HEAVY, swingOf()), and the strike takes
109
+ * more the longer it charged (TAIL_HP, sting()). A double click of the right button (KEY.SPECIAL
110
+ * with it) is its special: a sweep's is the SPIN, the tail whipped all round the body; the stab's
111
+ * and the lash's the LEAP, up TAIL_LEAP m/s and down on the foe as it lands; each takes its own
112
+ * `hp`. The xenomorph's `cut` reads this table: CLAW_L and CLAW_R are its claws, at their place in it.
113
113
  */
114
+ /**
115
+ * The tail's strike (the user, 2026-11-16, after Aliens versus Predator, 1999: held, it charges; let
116
+ * go, it strikes as hard as it charged; full, it hurts a lot but kills no one fresh): TAIL_HP[0]
117
+ * health let go before a charge (HEAVY_TAP), up to TAIL_HP[1] at a full one (HEAVY_MAX), under HP_MAX.
118
+ */
119
+ var TAIL_HP = [2, 6];
114
120
  var STING = {
115
121
  STAB: 0,
116
122
  SWEEP_L: 1,
@@ -125,7 +131,7 @@ var TAILS = [
125
131
  strike: 26,
126
132
  reach: 3.4,
127
133
  arc: .25,
128
- hp: Infinity,
134
+ hp: TAIL_HP[0],
129
135
  hold: 18,
130
136
  knock: 0
131
137
  },
@@ -134,7 +140,7 @@ var TAILS = [
134
140
  strike: 26,
135
141
  reach: 2.8,
136
142
  arc: 1.1,
137
- hp: Infinity,
143
+ hp: TAIL_HP[0],
138
144
  hold: 16,
139
145
  knock: 0
140
146
  },
@@ -143,7 +149,7 @@ var TAILS = [
143
149
  strike: 26,
144
150
  reach: 2.8,
145
151
  arc: 1.1,
146
- hp: Infinity,
152
+ hp: TAIL_HP[0],
147
153
  hold: 16,
148
154
  knock: 0
149
155
  },
@@ -152,7 +158,7 @@ var TAILS = [
152
158
  strike: 28,
153
159
  reach: 3.1,
154
160
  arc: .4,
155
- hp: Infinity,
161
+ hp: TAIL_HP[0],
156
162
  hold: 20,
157
163
  knock: 0
158
164
  },
@@ -163,7 +169,7 @@ var TAILS = [
163
169
  strike: 30,
164
170
  reach: 2.6,
165
171
  arc: Math.PI,
166
- hp: Infinity,
172
+ hp: 3,
167
173
  hold: -1,
168
174
  knock: 0
169
175
  },
@@ -172,7 +178,7 @@ var TAILS = [
172
178
  strike: 52,
173
179
  reach: 2.8,
174
180
  arc: .6,
175
- hp: Infinity,
181
+ hp: 5,
176
182
  hold: -1,
177
183
  knock: 0
178
184
  }
@@ -1911,6 +1917,17 @@ var swingOf = (p, table = CUTS) => {
1911
1917
  } : c;
1912
1918
  };
1913
1919
  /**
1920
+ * The health a xenomorph's swing `p` takes: the claws and the specials their own `hp`; the tail
1921
+ * TAIL_HP[0] let go before a charge, up to TAIL_HP[1] for a heavy release of a full one (`charge`
1922
+ * stays through the release, gun.ts).
1923
+ */
1924
+ var sting = (p) => {
1925
+ const c = TAILS[p.cut ?? 0];
1926
+ if (c.hold < 0) return c.hp;
1927
+ const k = p.heavy ? Math.min(p.charge ?? 0, HEAVY_MAX) / HEAVY_MAX : 0;
1928
+ return TAIL_HP[0] + Math.round((TAIL_HP[1] - TAIL_HP[0]) * k);
1929
+ };
1930
+ /**
1914
1931
  * The enemies the cut of `p` (`p.cut`, `p` the state after the step that struck) hits, of `foes`
1915
1932
  * (as he saw them): each within CUTS reach of his centre less PLAYER_R on the floor plane, inside
1916
1933
  * the arc round his look (the foe's own angular radius counts: his edge in the arc is a hit), with
@@ -6454,16 +6471,17 @@ var step = (p, i, w, team, armed = true, bodies = [], kit = KITS[0]) => {
6454
6471
  const top = !!p.swing && !p.heavy && ticks - (p.swing ?? 0) === hold;
6455
6472
  if (top && (p.wield || kit.xeno) && armed && !busy && i.keys & (kit.xeno ? KEY.BLADE : KEY.FIRE)) p.charge = Math.min((p.charge ?? 0) + 1, HEAVY_MAX);
6456
6473
  else if (top && armed && !busy && (p.charge ?? 0) >= HEAVY_TAP) {
6457
- [p.heavy, p.charge] = [true, 0];
6474
+ [p.heavy, p.charge] = [true, kit.xeno ? p.charge : 0];
6458
6475
  p.swing = swingOf(p, table).ticks;
6459
6476
  } else {
6460
- p.charge = top || kit.xeno ? 0 : p.charge;
6477
+ p.charge = top || kit.xeno && !p.heavy ? 0 : p.charge;
6461
6478
  const s = p.swing ?? 0;
6462
6479
  const c = swingOf(p, table);
6463
6480
  const blow = PUNCHES[p.cut ?? 0] ?? PUNCHES[0];
6464
6481
  const stop = (v) => v == s - 1 && (v == c.ticks - c.strike || v == blow.ticks - blow.strike || !p.heavy && v == ticks - hold);
6465
6482
  p.swing = Math.max(0, kit.haste > 1 && stop(s - 1) ? s - 1 : s - kit.haste);
6466
6483
  p.heavy = !!p.swing && !!p.heavy;
6484
+ p.charge = kit.xeno && !p.heavy ? 0 : p.charge;
6467
6485
  }
6468
6486
  p.mag = Math.min(p.mag ?? 0, Math.max(p.ammo, 0));
6469
6487
  const has = [
@@ -9382,12 +9400,13 @@ var Room = class {
9382
9400
  * whole one. The PUNCH_STUN-th blow he takes with no more than PUNCH_MEMORY ticks between two, or
9383
9401
  * a blow with a `knock`, stuns him as a tackle does: a stumble thrown the way `p` faces (`knock`
9384
9402
  * times as hard), the flag dropped, `by` the puncher. The xenomorph's swings (TAILS) take their
9385
- * whole `hp` and never stun: its claws XENO_CLAW, its tail all.
9403
+ * whole `hp` and never stun: its claws XENO_CLAW, its tail as hard as it charged (sting()).
9386
9404
  */
9387
9405
  punch(p, view) {
9388
9406
  const xeno = this.kit(p).xeno;
9389
9407
  const blow = xeno ? {
9390
9408
  ...swingOf(p.state, TAILS),
9409
+ hp: sting(p.state),
9391
9410
  knock: 0
9392
9411
  } : PUNCHES[p.state.cut ?? 0] ?? PUNCHES[0];
9393
9412
  const seen = strike(this.world, p.state, this.enemies(p, view), blow);
@@ -35,4 +35,6 @@ export declare const flesh: (list: Pieces, s: Skin, pose: {
35
35
  bare?: boolean;
36
36
  }, hood?: number,
37
37
  /** The runner's id: his skin's marks. */
38
- seed?: number) => void;
38
+ seed?: number,
39
+ /** The xenomorph's: its chitin. */
40
+ chitin?: boolean) => void;
@@ -47,6 +47,21 @@ export declare const CARD_BASE: number, CARD_STEP: number;
47
47
  * to a -1 corner blends. The CPU's skin (the own body, a runner coming apart) stays at -1.
48
48
  */
49
49
  export declare const SKIN_LAYER = -1.06;
50
+ /**
51
+ * The xenomorph's chitin (the user, 2026-11-16: a texture), on its rest place: a shell of small
52
+ * plates with fine seams, a grain, a mottled tone and a wet gloss that varies over it. Its rigid
53
+ * pieces and its skin; not its tail, drawn in the world's frame each frame (it would swim on it).
54
+ * Within SHINE's band of the shader (0.1 round it): it takes polished metal's sky reflection, a
55
+ * blue sheen under a blue sky (the user, 2026-11-16: keep it).
56
+ */
57
+ export declare const CHITIN = -1.17;
58
+ /**
59
+ * Its striated tubes (the user, 2026-11-16: dark ringed pipes, "the render is top"): rings of
60
+ * grooves round a tube. Its red carries how far along the tube the point is, metres, not a colour
61
+ * (tubed() in xeno.ts); the shader paints its own grey (the user: lighter, to show), with little
62
+ * of SHINE's sheen, whose band it is in.
63
+ */
64
+ export declare const TUBE = -1.19;
50
65
  /**
51
66
  * Camera axes [right, up, forward]: forward is (-sin yaw cos pitch, sin pitch, -cos yaw cos pitch),
52
67
  * y up at roll 0. A positive roll leans the camera right: up tilts toward right.
@@ -100,6 +100,13 @@ export interface Skin {
100
100
  }
101
101
  /** How far out the face is (its z) at x across, height y: the carved surface, found by halving. */
102
102
  export declare const onHead: (x: number, y: number) => number;
103
+ /**
104
+ * How much larger its head is than it was drawn (the user, 2026-11-16: a bigger head), about the
105
+ * head joint: the dome here (CREST), the face's pieces in xeno.ts (grow()).
106
+ */
107
+ export declare const HEAD_K = 1.12;
108
+ /** And how much narrower (the user, 2026-11-16: less round, the sides in), across it alone. */
109
+ export declare const HEAD_X = 0.86;
103
110
  /**
104
111
  * The dome's section `z` behind the face's edge (0 to PROFILE[0]), in the rest pose: its centre's
105
112
  * height, half width and half height (an ellipse). xeno.ts lays its veins on it.
@@ -40,6 +40,8 @@ export interface Flesh {
40
40
  accent?: number[];
41
41
  /** The runner's id: the marks of his skin (moles, freckles, scars) in the shader. */
42
42
  seed?: number;
43
+ /** The xenomorph's skin: its chitin (CHITIN in mesh.ts). */
44
+ chitin?: boolean;
43
45
  }
44
46
  /** What the vertex shader reads by texel (flesh.ts): four floats each, 2048 a row. */
45
47
  export declare let data: Float32Array<ArrayBuffer>;
@@ -4,3 +4,13 @@ export declare const LAYERS: number;
4
4
  export declare const hash: (x: number, y: number, s: number) => number;
5
5
  /** All layers, RGBA, layer after layer, rows top to bottom: the upload of a texture array. */
6
6
  export declare const textures: () => Uint8ClampedArray;
7
+ /** The chitin's plates (CHITIN): cells across its 3D texture, which repeats; texels across a cell. */
8
+ export declare const PLATES: number, PLATE_TEXELS: number;
9
+ /**
10
+ * The xenomorph's chitin plates, worked out once (the user, 2026-11-16: in a texture, to cost the
11
+ * GPU less; the shader read 27 cells a pixel): a cube of PLATES cells a side, a jittered point in
12
+ * each, wrapping round; each texel how far it is from the edge between its two nearest points (the
13
+ * second's distance less the first's, in cells, 1 at most) times 255. Its V down to an edge is the
14
+ * groove's crisp line, so PLATE_TEXELS keeps it under a millimetre wide.
15
+ */
16
+ export declare const plates: () => Uint8Array;
@@ -108,12 +108,6 @@ export declare const metatarsal: (out: Out, at: Vec3, q: Quat, lod: number) => v
108
108
  export declare const toes: (out: Out, at: Vec3, q: Quat, lod: number) => void;
109
109
  /** Its tendons on a shin joint: the heel's cord down the back of the shin, and one down each side of its front. */
110
110
  export declare const sinews: (out: Out, at: Vec3, q: Quat, lod: number) => void;
111
- /**
112
- * Its rib cage on the chest joint, standing out of a starved trunk in a lighter chitin: five pairs of ribs from the
113
- * spine round to the breastbone, each sloping down toward the front, the lower ones shorter, and
114
- * the keel of the breastbone down the middle. Each row: the height at the spine, the half width and
115
- * the half depth of the arch (a hair outside the skin's).
116
- */
117
111
  export declare const ribs: (out: Out, at: Vec3, q: Quat, lod: number, low?: boolean) => void;
118
112
  /**
119
113
  * Its collarbones on the chest joint (the user, 2026-11-15: standing out, an exoskeleton), in the
@@ -169,6 +163,12 @@ export declare const teeth: (out: Out, head: Vec3, q: Quat, lod: number) => void
169
163
  * the back, with a short branch off each; one along each side of the top. Half sunk in the skin.
170
164
  */
171
165
  export declare const veins: (out: Out, head: Vec3, q: Quat, lod: number) => void;
166
+ /**
167
+ * Striated tubes blended into the sides of its dome (the user, 2026-11-16), on the head joint: two
168
+ * each side running back from behind the face along the banana's lower flank, half sunk in it and
169
+ * sinking wholly at both ends.
170
+ */
171
+ export declare const hoses: (out: Out, head: Vec3, q: Quat, lod: number) => void;
172
172
  /** Its eyes, glowing slits at the back of the orbits in the team's `color`. */
173
173
  export declare const eyes: (out: Out, head: Vec3, q: Quat, color: number[], lod?: number) => void;
174
174
  /** A rigid piece made at the origin of its joint's frame, then only placed (store.ts). */
@@ -30,6 +30,12 @@ export declare const swingOf: (p: Pick<PlayerState, "cut" | "heavy">, table?: ty
30
30
  hp: number;
31
31
  hold: number;
32
32
  };
33
+ /**
34
+ * The health a xenomorph's swing `p` takes: the claws and the specials their own `hp`; the tail
35
+ * TAIL_HP[0] let go before a charge, up to TAIL_HP[1] for a heavy release of a full one (`charge`
36
+ * stays through the release, gun.ts).
37
+ */
38
+ export declare const sting: (p: Pick<PlayerState, "cut" | "heavy" | "charge">) => number;
33
39
  /**
34
40
  * The enemies the cut of `p` (`p.cut`, `p` the state after the step that struck) hits, of `foes`
35
41
  * (as he saw them): each within CUTS reach of his centre less PLAYER_R on the floor plane, inside
@@ -216,8 +216,8 @@ export declare const BLOW: {
216
216
  readonly CLAW_L: 4;
217
217
  readonly CLAW_R: 5;
218
218
  };
219
- /** A swipe of the claws: XENO_CLAW health (the user, 2026-11-16: they hurt). */
220
- export declare const XENO_CLAW = 4;
219
+ /** A swipe of the claws: XENO_CLAW health (the user, 2026-11-16: they hurt; then 4 was too much). */
220
+ export declare const XENO_CLAW = 2;
221
221
  export declare const PUNCHES: {
222
222
  ticks: number;
223
223
  strike: number;
@@ -231,12 +231,18 @@ export declare const PUNCHES: {
231
231
  * The xenomorph's tail (the user, 2026-11-16: it fights as the katana does, slower, and its sting
232
232
  * kills). The right button (KEY.BLADE, input.ts) starts a strike by the keys as cutOf() reads them:
233
233
  * a STAB ahead with FORWARD, a SWEEP across from LEFT or RIGHT, else a LASH down from above. Held at
234
- * the top of its wind-up (`hold`) it charges as a cut does (HEAVY, swingOf()). A double click of the
235
- * right button (KEY.SPECIAL with it) is its special: a sweep's is the SPIN, the tail whipped all
236
- * round the body; the stab's and the lash's the LEAP, up TAIL_LEAP m/s and down on the foe as it
237
- * lands. Whoever a strike reaches goes down (`hp` Infinity: through armour). The xenomorph's `cut`
238
- * reads this table: CLAW_L and CLAW_R are its claws, at their place in it.
234
+ * the top of its wind-up (`hold`) it charges as a cut does (HEAVY, swingOf()), and the strike takes
235
+ * more the longer it charged (TAIL_HP, sting()). A double click of the right button (KEY.SPECIAL
236
+ * with it) is its special: a sweep's is the SPIN, the tail whipped all round the body; the stab's
237
+ * and the lash's the LEAP, up TAIL_LEAP m/s and down on the foe as it lands; each takes its own
238
+ * `hp`. The xenomorph's `cut` reads this table: CLAW_L and CLAW_R are its claws, at their place in it.
239
239
  */
240
+ /**
241
+ * The tail's strike (the user, 2026-11-16, after Aliens versus Predator, 1999: held, it charges; let
242
+ * go, it strikes as hard as it charged; full, it hurts a lot but kills no one fresh): TAIL_HP[0]
243
+ * health let go before a charge (HEAVY_TAP), up to TAIL_HP[1] at a full one (HEAVY_MAX), under HP_MAX.
244
+ */
245
+ export declare const TAIL_HP: readonly [2, 6];
240
246
  export declare const STING: {
241
247
  readonly STAB: 0;
242
248
  readonly SWEEP_L: 1;
@@ -173,7 +173,7 @@ export declare class Room {
173
173
  * whole one. The PUNCH_STUN-th blow he takes with no more than PUNCH_MEMORY ticks between two, or
174
174
  * a blow with a `knock`, stuns him as a tackle does: a stumble thrown the way `p` faces (`knock`
175
175
  * times as hard), the flag dropped, `by` the puncher. The xenomorph's swings (TAILS) take their
176
- * whole `hp` and never stun: its claws XENO_CLAW, its tail all.
176
+ * whole `hp` and never stun: its claws XENO_CLAW, its tail as hard as it charged (sting()).
177
177
  */
178
178
  private punch;
179
179
  /**
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.181.0",
5
+ "version": "0.182.0",
6
6
  "type": "module",
7
7
  "files": [
8
8
  "dist"