@korial29/tiny-fps 0.176.0 → 0.177.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
@@ -182,12 +182,8 @@ var [PUNCH_HITS, PUNCH_STUN, PUNCH_MEMORY] = [
182
182
  3,
183
183
  180
184
184
  ];
185
- var [POUNCE_MIN, POUNCE_MAX, POUNCE_PITCH] = [
186
- 9,
187
- 17,
188
- .3
189
- ];
190
- var [POUNCE_COOL, POUNCE_FLY] = [48, 40];
185
+ /** 1.4: a step of its burst stays under PLAYER_R, so it cannot tunnel through a thin brush (physics.ts). */
186
+ var XENO_DASH = 1.4;
191
187
  var [POUNCE_HP, POUNCE_STUN] = [2, 60];
192
188
  /**
193
189
  * The glory kill (the user, 2026-11-16, after DOOM 2016): an enemy with GLORY_HP health or less, up,
@@ -712,6 +708,7 @@ var MARINE = {
712
708
  double: 6,
713
709
  wallrun: 75,
714
710
  dashes: 1,
711
+ dash: 16,
715
712
  haste: 1,
716
713
  ammo: 60,
717
714
  rail: 240,
@@ -739,6 +736,7 @@ var KITS = [
739
736
  double: 6 * 1.3,
740
737
  wallrun: 150,
741
738
  dashes: 3,
739
+ dash: 16,
742
740
  haste: 2,
743
741
  ammo: 30,
744
742
  rail: 120,
@@ -763,6 +761,8 @@ var KITS = [
763
761
  sprint: 9 * XENO_PACE,
764
762
  jump: 7 * Math.SQRT2,
765
763
  double: 6 * Math.SQRT2,
764
+ dashes: 3,
765
+ dash: 16 * XENO_DASH,
766
766
  accel: XENO_PACE,
767
767
  ammo: 0,
768
768
  rail: 0,
@@ -1045,7 +1045,8 @@ var gap = (b, x, z) => [x - clamp$3(x, b.min[0], b.max[0]), z - clamp$3(z, b.min
1045
1045
  * A centre inside a footprint (it never gets there by walking, see below) leaves by the nearest
1046
1046
  * side. Returns the whole push, for the caller to take the speed into the wall away.
1047
1047
  *
1048
- * Tunnelling is impossible: a step is at most DASH_SPEED / TICK_HZ = 0.27 m, and each push leaves
1048
+ * Tunnelling is impossible: a step is at most the xenomorph's dash, DASH_SPEED * XENO_DASH / TICK_HZ
1049
+ * = 0.37 m (a man's 0.27), and each push leaves
1049
1050
  * the centre at least PLAYER_R = 0.4 m from the footprint of every box it started beside, so a
1050
1051
  * step of that size cannot bring the centre across one, however thin. The candidates come from
1051
1052
  * near() with twice PLAYER_R, enough for the one push of at most PLAYER_R that matters.
@@ -1584,9 +1585,11 @@ var clingTo = (p, w, c) => {
1584
1585
  return false;
1585
1586
  };
1586
1587
  /**
1587
- * On a wall: forward climbs and back goes down, the side keys go along it (as the look sees it);
1588
- * crouch lets go; a jump kicks off it, straight back when looking at it, else along the look. At a
1589
- * top under the head, climbing pulls it up onto the top (MODE.CLIMB); down on a floor, it stands.
1588
+ * On a wall, the wall is its floor (the user, 2026-11-16, to roam it freely): the look's heading
1589
+ * turned onto it is forward, so W climbs looking at the wall, goes along it looking along it and
1590
+ * down it looking away, S the other way, A and D across. Crouch lets go; a jump kicks off it,
1591
+ * straight back when looking at it, else along the look. At a top under the head, climbing pulls
1592
+ * it up onto the top (MODE.CLIMB); down on a floor, it stands.
1590
1593
  */
1591
1594
  var cling = (p, w, c) => {
1592
1595
  const [nx, nz] = TOWARD[p.wall];
@@ -1610,10 +1613,15 @@ var cling = (p, w, c) => {
1610
1613
  }
1611
1614
  return;
1612
1615
  }
1613
- const up = (c.keys & KEY.FORWARD ? 1 : 0) - (c.keys & KEY.BACK ? 1 : 0);
1616
+ const fw = (c.keys & KEY.FORWARD ? 1 : 0) - (c.keys & KEY.BACK ? 1 : 0);
1614
1617
  const s = (c.keys & KEY.RIGHT ? 1 : 0) - (c.keys & KEY.LEFT ? 1 : 0);
1615
1618
  const [tx, tz] = [-nz, nx];
1616
- const k = (tx * -c.fz + tz * c.fx >= 0 ? s : -s) * 8;
1619
+ const [hu, ha] = [c.fx * nx + c.fz * nz, c.fx * tx + c.fz * tz];
1620
+ const [wu, wa] = [fw * hu - s * ha, fw * ha + s * hu];
1621
+ const n = Math.sqrt(wu * wu + wa * wa);
1622
+ const v = n > 1 ? 8 / n : 8;
1623
+ const up = wu > .05 ? 1 : wu < -.05 ? -1 : 0;
1624
+ const k = wa * v;
1617
1625
  const { a, sign } = along(p, p.wall);
1618
1626
  if (up > 0 && hold.top < p.y + 1.8) {
1619
1627
  const land = hold.face + sign * CLIMB_INSET;
@@ -1627,7 +1635,7 @@ var cling = (p, w, c) => {
1627
1635
  }
1628
1636
  p.vx = tx * k;
1629
1637
  p.vz = tz * k;
1630
- p.vy = up > 0 && hold.top - p.y <= .45 ? 0 : up * 8;
1638
+ p.vy = up > 0 && hold.top - p.y <= .45 ? 0 : wu * v;
1631
1639
  const pull = Math.min(hold.gap, 4 * DT$2);
1632
1640
  p.x += nx * pull;
1633
1641
  p.z += nz * pull;
@@ -1638,36 +1646,6 @@ var cling = (p, w, c) => {
1638
1646
  p.ev |= EV.LAND;
1639
1647
  }
1640
1648
  };
1641
- /** Whether the xenomorph's swing is its tail's (TAILS), not its claws'. */
1642
- var tailing = (p) => !!p.swing && p.cut !== BLOW.CLAW_L && p.cut !== BLOW.CLAW_R;
1643
- /**
1644
- * The xenomorph's dash: DASH held on a floor or a wall, with the dash timer run out, charges a
1645
- * pounce (`charge`); let go, it leaps toward the keys held (the look with none: the user,
1646
- * 2026-11-16), at least POUNCE_PITCH up, faster the longer the charge. Anywhere else, or stumbling, the charge is lost.
1647
- */
1648
- var pounce = (p, c) => {
1649
- if (tailing(p)) return;
1650
- const ready = !c.stumble && p.dash === 0 && (onFloor(p.mode) || p.mode === MODE.CLING);
1651
- if (ready && c.keys & KEY.DASH) {
1652
- p.charge = Math.min((p.charge ?? 0) + 1, 36);
1653
- return;
1654
- }
1655
- if (ready && p.charge) {
1656
- const v = POUNCE_MIN + (POUNCE_MAX - POUNCE_MIN) * p.charge / 36;
1657
- const pitch = Math.max(p.pitch, POUNCE_PITCH);
1658
- const cp = Math.cos(pitch);
1659
- if (p.mode !== MODE.CLING) p.wall = SIDE$1.NONE;
1660
- p.ev |= p.mode === MODE.SLIDE ? EV.SLIDE_END : 0;
1661
- enter(p, MODE.AIR);
1662
- const [dx, dz] = c.wx || c.wz ? [c.wx, c.wz] : [c.fx, c.fz];
1663
- p.vx = dx * cp * v;
1664
- p.vz = dz * cp * v;
1665
- leap$1(p, Math.sin(pitch) * v);
1666
- p.dash = POUNCE_COOL;
1667
- p.ev |= EV.DASH;
1668
- }
1669
- p.charge = 0;
1670
- };
1671
1649
  /** Takes hold of a ledge: hang there. */
1672
1650
  var grab = (p, l, dashes) => {
1673
1651
  enter(p, MODE.HANG);
@@ -1687,7 +1665,7 @@ var free$1 = (p, w, c) => {
1687
1665
  const ground = p.mode === MODE.GROUND;
1688
1666
  const chain = c.kit.dashes > 1;
1689
1667
  if (chain && ground && p.dash === 0) p.dashes = c.kit.dashes;
1690
- if (!c.kit.xeno && c.dash && (p.dash === 0 || chain && p.dashes > 0 && p.dash <= 44) && (ground ? !chain || p.dashes > 0 : (p.mode === MODE.AIR || p.mode === MODE.WALLRUN) && p.dashes > 0)) {
1668
+ if (c.dash && (p.dash === 0 || chain && p.dashes > 0 && p.dash <= 44) && (ground ? !chain || p.dashes > 0 : (p.mode === MODE.AIR || p.mode === MODE.WALLRUN) && p.dashes > 0)) {
1691
1669
  const [dx, dz] = c.wx || c.wz ? [c.wx, c.wz] : [c.fx, c.fz];
1692
1670
  p.dashes -= +(ground && chain);
1693
1671
  if (!ground) {
@@ -1698,8 +1676,8 @@ var free$1 = (p, w, c) => {
1698
1676
  p.ev |= EV.WALLRUN_END;
1699
1677
  }
1700
1678
  }
1701
- p.vx = dx * 16;
1702
- p.vz = dz * 16;
1679
+ p.vx = dx * c.kit.dash;
1680
+ p.vz = dz * c.kit.dash;
1703
1681
  p.dash = 60;
1704
1682
  p.ev |= EV.DASH;
1705
1683
  }
@@ -1829,7 +1807,6 @@ var move = (p, i, w, team = 0, bodies = [], kit = KITS[0]) => {
1829
1807
  p.dash--;
1830
1808
  if (p.dash === 50) cap(p, 10);
1831
1809
  }
1832
- if (kit.xeno && p.mode !== MODE.HANG && p.mode !== MODE.CLIMB && !riding) pounce(p, c);
1833
1810
  if (p.mode === MODE.HANG) hang(p, w, c);
1834
1811
  if (p.mode === MODE.CLING) cling(p, w, c);
1835
1812
  if (p.mode === MODE.CLIMB) climb(p, w);
@@ -6278,10 +6255,10 @@ var reach$1 = (r, c) => {
6278
6255
  /** Whether the player's body is a weapon: in a slide, or in the burst of a dash. */
6279
6256
  var tackling = (p) => p.mode === MODE.SLIDE || p.dash > 50;
6280
6257
  /**
6281
- * Whether a xenomorph is in the strike of its pounce: in the air, the first POUNCE_FLY ticks of the
6282
- * dash timer it leapt with (POUNCE_COOL). Only for a xenomorph: another's dash runs through it too.
6258
+ * Whether a xenomorph is in the strike of its pounce: the burst of a dash. Only for a xenomorph:
6259
+ * another's dash runs through an enemy.
6283
6260
  */
6284
- var pouncing = (p) => p.mode === MODE.AIR && p.dash > POUNCE_COOL - POUNCE_FLY && p.dash <= POUNCE_COOL;
6261
+ var pouncing = (p) => p.dash > 50;
6285
6262
  /**
6286
6263
  * Whether the cylinders of `a` and `b` overlap, with TACKLE_REACH of reach on top: closer than
6287
6264
  * two radii and the reach on the floor plane, and their heights (low in a slide) overlap.
@@ -6432,7 +6409,7 @@ var step = (p, i, w, team, armed = true, bodies = [], kit = KITS[0]) => {
6432
6409
  [p.heavy, p.charge] = [true, 0];
6433
6410
  p.swing = swingOf(p, table).ticks;
6434
6411
  } else {
6435
- p.charge = top ? 0 : p.charge;
6412
+ p.charge = top || kit.xeno ? 0 : p.charge;
6436
6413
  const s = p.swing ?? 0;
6437
6414
  const c = swingOf(p, table);
6438
6415
  const blow = PUNCHES[p.cut ?? 0] ?? PUNCHES[0];
@@ -6546,7 +6523,7 @@ var step = (p, i, w, team, armed = true, bodies = [], kit = KITS[0]) => {
6546
6523
  * after a swipe's strike throwing the next at once (BLOW). The right button (KEY.BLADE) strikes with
6547
6524
  * the tail as FIRE cuts with the katana (TAILS): by the keys (cutOf()), its special with SPECIAL (a
6548
6525
  * double click), which also turns a strike just started into it within SPECIAL_LATE ticks. Not while
6549
- * a pounce charges, nor with the hands busy (a hang, a climb); on a wall they are free.
6526
+ * the tail charges, nor with the hands busy (a hang, a climb); on a wall they are free.
6550
6527
  */
6551
6528
  var beast = (p, i, fresh, busy) => {
6552
6529
  if (busy) return;
@@ -9024,8 +9001,8 @@ var Room = class {
9024
9001
  */
9025
9002
  tackle(p, view) {
9026
9003
  const me = p.state;
9027
- if (!me.down && pouncing(me) && this.kit(p).xeno) {
9028
- this.pin(p, view);
9004
+ if (this.kit(p).xeno) {
9005
+ if (!me.down && pouncing(me) && this.ticks - p.tackled >= 30) this.pin(p, view);
9029
9006
  return;
9030
9007
  }
9031
9008
  if (me.down || !tackling(me) || this.ticks - p.tackled < 30) return;
@@ -9041,9 +9018,9 @@ var Room = class {
9041
9018
  p.tackled = this.ticks;
9042
9019
  }
9043
9020
  /**
9044
- * A xenomorph's pounce `p` meets an enemy who is up, where `p` drew him: he is pinned, POUNCE_HP
9045
- * of health, his flag dropped and a stumble of POUNCE_STUN thrown the way it leapt. The pounce
9046
- * ends on him: it stops, its dash timer past the strike.
9021
+ * A xenomorph's dash `p` meets an enemy who is up, where `p` drew him: he is pinned, POUNCE_HP
9022
+ * of health, his flag dropped and a stumble of POUNCE_STUN thrown the way it went. The burst
9023
+ * ends on him, and the next pin waits TACKLE_COOLDOWN: three dashes in a row are not three pins.
9047
9024
  */
9048
9025
  pin(p, view) {
9049
9026
  const me = p.state;
@@ -9052,8 +9029,9 @@ var Room = class {
9052
9029
  if (!foe) return;
9053
9030
  const v = speedOf$1(me);
9054
9031
  const [dx, dz] = v > .001 ? [me.vx / v, me.vz / v] : forward(me.yaw);
9055
- me.dash = Math.min(me.dash, POUNCE_COOL - POUNCE_FLY);
9032
+ me.dash = Math.min(me.dash, 50);
9056
9033
  [me.vx, me.vz] = [me.vx * .2, me.vz * .2];
9034
+ p.tackled = this.ticks;
9057
9035
  me.hits = me.hits + 1 & 255;
9058
9036
  if (this.harm(foe, POUNCE_HP, p, FRAG.CLAW, felled(FALL$1.STRUCK, dx, dz))) return;
9059
9037
  this.drop(foe.info.id);
@@ -4,7 +4,7 @@ import type { Beat } from './beats';
4
4
  /** Seconds between two frags for them to count as a double kill, a multi kill and on. */
5
5
  export declare const MULTI = 4;
6
6
  /** The lines of the 2nd, 3rd, 4th, 5th frag in quick succession; the last for every one after. */
7
- export declare const QUICK: (16 | 14 | 18 | 17 | 15)[];
7
+ export declare const QUICK: (16 | 14 | 18 | 15 | 17)[];
8
8
  /** Frags without going down between two lines of a run; the last line for every SPREE after. */
9
9
  export declare const SPREE = 5;
10
10
  export declare const RUNS: (20 | 21 | 22 | 23 | 19)[];
@@ -58,6 +58,6 @@ drawn?: (id: number) => Vec3 | undefined,
58
58
  voice?: (id: number) => number,
59
59
  /** A player's own voice in the players' sprite (speakerOf()). */
60
60
  speaker?: (id: number) => number,
61
- /** Whether a player is a xenomorph: its own cries, its acid, its hiss and shriek at a pounce. */
61
+ /** Whether a player is a xenomorph: its own cries, its acid, its hiss at a tail's charge, its shriek at a dash. */
62
62
  beast?: (id: number) => boolean) => Combat;
63
63
  export {};
@@ -29,5 +29,5 @@ export declare const PAWS: number[];
29
29
  /** The rover: a sideways slide from this speed (m/s) skids, and is at its loudest this much over it. */
30
30
  export declare const SKID_FROM = 2.5;
31
31
  export declare const createFoley: (a: Audio,
32
- /** Whether a player is a xenomorph: chitin feet that click, and a shriek for its pounce. */
32
+ /** Whether a player is a xenomorph: chitin feet that click, and a shriek for its dash. */
33
33
  beast?: (id: number) => boolean) => Foley;
@@ -120,7 +120,7 @@ export declare const SOUND: {
120
120
  readonly STRIKE: 59;
121
121
  /**
122
122
  * The xenomorph's own (the user, 2026-11-16: not a runner's): a hiss with a growl under it as it
123
- * charges a pounce, a shriek as it leaps, its claws' swipe and the whip of its tail, a screech of
123
+ * charges its tail, a shriek as it dashes, its claws' swipe and the whip of its tail, a screech of
124
124
  * pain and a big roar going down, its footfall (claws, wet pad, weight) at each step, the sizzle of
125
125
  * its acid blood, a roar after a kill, and the heavier footfall of a landing.
126
126
  */
@@ -261,20 +261,18 @@ export declare const PUNCH_HITS: number, PUNCH_STUN: number, PUNCH_MEMORY: numbe
261
261
  * forward and the sprint held (MODE.CLING, physics.ts; the sprint since the user, 2026-11-16):
262
262
  * CLING_SPEED m/s up, down or along it (faster than a man runs, the user 2026-11-16: it was slow)
263
263
  * while the wall rises CLING_HOLD m over its feet; a jump kicks it off along the look at CLING_LEAP
264
- * m/s. DASH held on a floor or a wall charges a pounce for up to POUNCE_HOLD ticks
265
- * (PlayerState.charge); let go, it leaps POUNCE_MIN to POUNCE_MAX m/s toward the keys held (the
266
- * look with none), at least POUNCE_PITCH up, and the dash timer runs from POUNCE_COOL: the first
267
- * POUNCE_FLY ticks of it in the air, an enemy it reaches is pinned (room.ts): POUNCE_HP health, his
268
- * flag dropped, a stumble of POUNCE_STUN ticks. An enemy whose katana or fists hit it loses ACID_HP.
264
+ * m/s. It dashes as a man does, XENO_DASH times as fast so as far, three in a row (kit.ts; the
265
+ * user, 2026-11-16: no more charged pounce); an enemy its dash's burst reaches is pinned (room.ts):
266
+ * POUNCE_HP health, his flag dropped, a stumble of POUNCE_STUN ticks, once per TACKLE_COOLDOWN. An
267
+ * enemy whose katana or fists hit it loses ACID_HP.
269
268
  */
270
269
  export declare const XENO_HP = 12;
271
270
  export declare const CLING_SPEED = 8;
272
271
  export declare const CLING_FACING = 0.6;
273
272
  export declare const CLING_HOLD = 0.4;
274
273
  export declare const CLING_LEAP = 10;
275
- export declare const POUNCE_HOLD = 36;
276
- export declare const POUNCE_MIN: number, POUNCE_MAX: number, POUNCE_PITCH: number;
277
- export declare const POUNCE_COOL: number, POUNCE_FLY: number;
274
+ /** 1.4: a step of its burst stays under PLAYER_R, so it cannot tunnel through a thin brush (physics.ts). */
275
+ export declare const XENO_DASH = 1.4;
278
276
  export declare const POUNCE_HP: number, POUNCE_STUN: number;
279
277
  /**
280
278
  * The glory kill (the user, 2026-11-16, after DOOM 2016): an enemy with GLORY_HP health or less, up,
@@ -14,6 +14,8 @@ export interface Kit {
14
14
  wallrun: number;
15
15
  /** Dashes in a row before the full DASH_COOLDOWN; 1 is the old rule: one in the air, any on the ground. */
16
16
  dashes: number;
17
+ /** A dash's burst, m/s: its length goes with it, the burst's ticks being everyone's. */
18
+ dash: number;
17
19
  /** Swing ticks the katana runs down per step. */
18
20
  haste: number;
19
21
  /** What the racks fill and the packs top up to: the gun's shots, the rail gun's lightning, the rifle's rounds. */
@@ -41,7 +43,7 @@ export interface Kit {
41
43
  gear: boolean;
42
44
  /**
43
45
  * The xenomorph's body: claws and a tail for weapons (PUNCHES from BLOW.CLAW_L), clinging to the
44
- * walls (MODE.CLING), the dash a pounce charged on DASH held, acid for blood (room.ts).
46
+ * walls (MODE.CLING), a dash's burst that pins an enemy it reaches, acid for blood (room.ts).
45
47
  */
46
48
  xeno: boolean;
47
49
  }
@@ -105,8 +105,6 @@ export declare const floored: (p: Pick<PlayerState, "zap" | "stun">) => boolean;
105
105
  * two steps. The katana's shock calls it with its own ticks and knock.
106
106
  */
107
107
  export declare const stumble: (p: PlayerState, dx: number, dz: number, ticks?: number, knock?: number) => void;
108
- /** Whether the xenomorph's swing is its tail's (TAILS), not its claws'. */
109
- export declare const tailing: (p: Pick<PlayerState, "swing" | "cut">) => boolean;
110
108
  /**
111
109
  * Applies one input for 1 / TICK_HZ s, in place: yaw and pitch from the input (pitch clamped to
112
110
  * MAX_PITCH), then the step of the current mode (see the top of the file). Feet under the world's
@@ -104,9 +104,9 @@ export declare class Room {
104
104
  */
105
105
  private tackle;
106
106
  /**
107
- * A xenomorph's pounce `p` meets an enemy who is up, where `p` drew him: he is pinned, POUNCE_HP
108
- * of health, his flag dropped and a stumble of POUNCE_STUN thrown the way it leapt. The pounce
109
- * ends on him: it stops, its dash timer past the strike.
107
+ * A xenomorph's dash `p` meets an enemy who is up, where `p` drew him: he is pinned, POUNCE_HP
108
+ * of health, his flag dropped and a stumble of POUNCE_STUN thrown the way it went. The burst
109
+ * ends on him, and the next pin waits TACKLE_COOLDOWN: three dashes in a row are not three pins.
110
110
  */
111
111
  private pin;
112
112
  /** The class `p` plays on this map (kit.ts). */
@@ -2,8 +2,8 @@ import type { PlayerState } from './types';
2
2
  /** Whether the player's body is a weapon: in a slide, or in the burst of a dash. */
3
3
  export declare const tackling: (p: PlayerState) => boolean;
4
4
  /**
5
- * Whether a xenomorph is in the strike of its pounce: in the air, the first POUNCE_FLY ticks of the
6
- * dash timer it leapt with (POUNCE_COOL). Only for a xenomorph: another's dash runs through it too.
5
+ * Whether a xenomorph is in the strike of its pounce: the burst of a dash. Only for a xenomorph:
6
+ * another's dash runs through an enemy.
7
7
  */
8
8
  export declare const pouncing: (p: PlayerState) => boolean;
9
9
  /**
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.176.0",
5
+ "version": "0.177.0",
6
6
  "type": "module",
7
7
  "files": [
8
8
  "dist"