@korial29/tiny-fps 0.91.1 → 0.92.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.
@@ -38,10 +38,17 @@ export declare const shrug: (q: Pose, s: Solved, j: number, at: Vec3) => void;
38
38
  /** Where a fist holds a handle, from the wrist: along the fingers, and toward the palm. */
39
39
  export declare const FIST: number[];
40
40
  /**
41
- * The left fist on the katana's grip, 8 mm further along and 6 mm nearer the palm: the grip runs
42
- * through its curled fingers, not over them, seen from the eye (the user, 2026-11-09).
41
+ * The left fist on the katana's grip: 8 mm further along the fingers and 6 mm nearer the palm than
42
+ * FIST, so the grip runs through its curled fingers (the user, 2026-11-09).
43
43
  */
44
44
  export declare const KATANA_LEFT: number[];
45
+ /**
46
+ * How far the left fist's fingers lean toward the blade, as [sin, cos] (the right's is [S, C], 0.55
47
+ * rad): the grip runs across its palm on the slant and its wrist comes from under the grip, not
48
+ * beside it, seen from the eye (the user, 2026-11-09). The arms are still solved for a hand held as
49
+ * the right (clasp()); the left wrist then cocks by the difference, a set angle.
50
+ */
51
+ export declare const KATANA_TILT: number[];
45
52
  /**
46
53
  * Puts the arm of shoulder joint `j` (ARM_R or ARM_L) of `q` on a handle running along the unit
47
54
  * `g`, the hand round the point `at`, the elbow toward `pole`; `solved` is q solved. The shoulder
@@ -51,7 +58,9 @@ export declare const KATANA_LEFT: number[];
51
58
  * allow. The elbow is a hinge, and the forearm's turn about itself goes half to the elbow and half
52
59
  * to the wrist, as a forearm's twist does. Out of reach the hand stops short.
53
60
  */
54
- export declare const wield: (q: Pose, solved: Solved, j: number, at: Vec3, g: Vec3, pole: Vec3, held?: Vec3, [reach, palm]?: number[]) => void;
61
+ export declare const wield: (q: Pose, solved: Solved, j: number, at: Vec3, g: Vec3, pole: Vec3, held?: Vec3, [reach, palm]?: number[], [S, C]?: number[],
62
+ /** The forearm on `held`'s line, not the hand's: the wrist cocked by the hand's own tilt. */
63
+ bent?: boolean) => void;
55
64
  /**
56
65
  * The katana and both fists as one rigid piece, the wrists straight, so that a cut is the arms'
57
66
  * alone (the user, 2026-11-07): the right hand round the grip, the left BEHIND it, each turned a
@@ -0,0 +1,27 @@
1
+ import type { Vec3 } from './mesh';
2
+ import type { Quat } from './rig';
3
+ /**
4
+ * The shell, an ellipsoid in the head joint's frame: its centre and half width, height and depth.
5
+ * The head of the skin (skin.ts, 1.555 to 1.803 m, the head joint at 1.62) lies inside it from the
6
+ * jaw up; its rim is where the shell is cut, under the chin.
7
+ */
8
+ export declare const SHELL: {
9
+ c: Vec3;
10
+ r: Vec3;
11
+ rim: number;
12
+ };
13
+ /**
14
+ * The visor's opening on the front of the shell: an ellipse across x and y (centre, half width and
15
+ * height) from the brow to under the nose. The visor is a plate on the shell's curve, `SINK` under
16
+ * the rim's top and `LIFT` over the shell; the rim is a bevel around it.
17
+ */
18
+ export declare const VISOR: {
19
+ c: [number, number];
20
+ r: [number, number];
21
+ };
22
+ /**
23
+ * Appends the helmet at level of detail `lod` (0 far, 1 near, 2 and up close) on the head joint at
24
+ * `at` turned by `q` (see solve() in rig.ts), in `rgb`, the team's colour (0 to 1): its crest and
25
+ * the beads on the ear pods, which glow. The far helmet is the shell, the visor and the crest.
26
+ */
27
+ export declare const helmet: (out: number[], at: Vec3, q: Quat, rgb: number[], lod: number) => void;
@@ -19,6 +19,8 @@ export interface Hud {
19
19
  match(m: Pick<Snapshot, 'score' | 'clock' | 'over' | 'flags'>, who: (id: number) => string): void;
20
20
  /** The markers of this frame (see marks.ts), in the order given; the ones before are removed. */
21
21
  marks(list: Mark[]): void;
22
+ /** The dark rim of a space helmet's visor around the screen: on while the own player wears one, off otherwise. */
23
+ visor(on: boolean): void;
22
24
  /** The red vignette of a tackle, 0 (none) to 1 (full). */
23
25
  hurt(level: number): void;
24
26
  /**
@@ -6,6 +6,8 @@ export interface TinyFpsOptions {
6
6
  url?: string;
7
7
  /** Any WebSocket-like socket, e.g. localSocket('room') from '@korial29/tiny-fps/local'. */
8
8
  socket?: SocketLike;
9
+ /** The map's key: 'highline' (the default) or 'tranquility'. It has to be the room's. */
10
+ map?: string;
9
11
  }
10
12
  export type TinyFpsEvent = 'roster' | 'open' | 'close';
11
13
  export interface TinyFps {
@@ -0,0 +1,3 @@
1
+ import type { WorldDef } from '../shared/world';
2
+ /** The moon's scenery vertices, in the renderer's format. */
3
+ export declare const moonscape: (_def: WorldDef) => number[];
@@ -85,7 +85,7 @@ export declare const level: (world: World) => number[];
85
85
  export declare const daylight: ({ sky: [zenith, horizon] }: WorldDef) => Vec3[];
86
86
  /** The world as it is drawn: its buildings down to the street, and a city around them. The physics knows only `world`. */
87
87
  export declare const city: (world: World) => World;
88
- /** All the map's vertices, drawn once: the city, the brushes, the street under them, the parks' trees, the runner's red and the team zones. */
88
+ /** All the map's vertices, drawn once: the city (on the moon, its scenery instead), the brushes, the street under them, the parks' trees, the runner's red and the team zones. */
89
89
  export declare const scenery: (world: World) => number[];
90
90
  /** The height the fog layer is anchored at: the lowest top of the world, so that at a roof the layer is a few percent of the haze at most. */
91
91
  export declare const fogRef: ({ brushes }: WorldDef) => number;
@@ -75,7 +75,7 @@ export declare const stance: (r: Runner) => {
75
75
  carry: [Vec3, Vec3[]] | undefined;
76
76
  };
77
77
  /** Draws the runner and gives back its solved skeleton, or nothing once a bolt has burnt it away. */
78
- export declare const soldier: (out: number[], r: Runner, color: number[], lod?: number) => {
78
+ export declare const soldier: (out: number[], r: Runner, color: number[], lod?: number, helmets?: boolean) => {
79
79
  pos: Vec3[];
80
80
  rot: import("./rig").Quat[];
81
81
  } | undefined;
@@ -14,7 +14,7 @@ export interface Use {
14
14
  export declare const uses: ({ brushes, floor }: WorldDef, b: Brush) => Use;
15
15
  /** One face of the box min..max (flat on `axis` when min and max agree there) as two triangles, pushed in the map's vertex format. */
16
16
  export declare const face: (out: number[], min: Vec3, max: Vec3, axis: number, up: number, layer: number, rgb: number[]) => void;
17
- /** The red of every use in the world, in the map's vertex format (layer -2 glows, -1 is lit). */
17
+ /** The red of every use in the world, in the map's vertex format (layer -2 glows, -1 is lit). Not on ghosts: nothing shows them. */
18
18
  export declare const vision: (def: WorldDef) => number[];
19
19
  /** A square on each team's roof around its base, lit paint of the team's colour: pale inside, a strong frame. */
20
20
  export declare const zones: ({ teams }: WorldDef) => number[];
@@ -0,0 +1,6 @@
1
+ import type { WorldDef } from './world';
2
+ export declare const MAPS: Record<string, WorldDef>;
3
+ /** The map of a key; an unknown or missing one is HIGHLINE. */
4
+ export declare const mapOf: (key?: string) => WorldDef;
5
+ /** The key of a known map, else 'highline'. */
6
+ export declare const mapKey: (key?: string) => string;
@@ -0,0 +1,25 @@
1
+ import type { WorldDef } from './world';
2
+ type Vec3 = [number, number, number];
3
+ /** The crater is 280 m long: a point at z has its twin at ZED - z. */
4
+ export declare const ZED = 280;
5
+ /**
6
+ * The west long jump: the rille is 16 m wide, the spurs of the lip leave this much open. At half
7
+ * gravity (GRAVITY 20 becomes 10) a jump of 7 m/s rises 2.45 m and hangs 1.4 s: a run flies 8.4 m,
8
+ * a sprint 12.6 m, a dash adds about 1.2 m and more. At full gravity those are 4.2 and 6.3 m.
9
+ */
10
+ export declare const WEST_GAP = 13.5;
11
+ /** A box by its corners. */
12
+ interface Bx {
13
+ min: Vec3;
14
+ max: Vec3;
15
+ }
16
+ export declare const LAYOUT: {
17
+ domes: number[][];
18
+ pads: number[][];
19
+ shuttles: Bx[];
20
+ modules: Bx[];
21
+ tubes: Bx[];
22
+ masts: number[][];
23
+ };
24
+ export declare const MOON: WorldDef;
25
+ export {};
@@ -15,6 +15,7 @@ export type ServerText = {
15
15
  t: 'roster';
16
16
  you: number;
17
17
  players: PlayerInfo[];
18
+ map?: string;
18
19
  } | {
19
20
  t: 'full';
20
21
  }
@@ -16,8 +16,10 @@ export declare class Room {
16
16
  private gone;
17
17
  /** The plasma balls in flight, and the ones that burst since the last snapshot, which sends them once more. */
18
18
  private balls;
19
- /** Missing rules fall back to RULES. */
20
- constructor(rules?: Partial<Rules>, map?: WorldDef);
19
+ /** The key of the map being played, which the roster tells the clients. */
20
+ private mapName;
21
+ /** Missing rules fall back to RULES. The map is the rules' one, unless a definition is given. */
22
+ constructor(rules?: Partial<Rules>, def?: WorldDef);
21
23
  /** Number of joined players. */
22
24
  get size(): number;
23
25
  /** A peer opened. Nothing is sent until it joins. */
@@ -351,6 +351,8 @@ export interface Rules {
351
351
  scoreLimit: number;
352
352
  /** Seconds a match lasts: the team with more captures wins, a tie is a draw. */
353
353
  timeLimit: number;
354
+ /** The map's key in MAPS (maps.ts); an unknown one plays 'highline'. */
355
+ map?: string;
354
356
  }
355
357
  /**
356
358
  * The subset of WebSocket the client relies on. A real WebSocket (with
@@ -9,6 +9,8 @@ export interface Brush {
9
9
  side: number;
10
10
  /** Colour of its ambient light, linear RGB 0 to 1. Absent: white. */
11
11
  tint?: Vec3;
12
+ /** Collided with but not drawn: the shape under a drawn-only mesh (the moon's domes). */
13
+ ghost?: boolean;
12
14
  }
13
15
  /** Feet x, y, z (standing on a top) and the yaw to face. */
14
16
  export type Spawn = [x: number, y: number, z: number, yaw: number];
@@ -50,6 +52,12 @@ export interface WorldDef {
50
52
  sky: [zenith: Vec3, horizon: Vec3];
51
53
  /** Fog colour and density per metre. Absent: none. */
52
54
  fog?: [r: number, g: number, b: number, density: number];
55
+ /** The share of GRAVITY that pulls the players down. Absent: 1. */
56
+ gravity?: number;
57
+ /** What is drawn around the play area: the city (street, towers, parks, traffic) or the moon (crater rim, base, stars, the Earth). Absent: the city. */
58
+ scenery?: 'city' | 'moon';
59
+ /** Whether the runners wear space helmets. */
60
+ helmets?: boolean;
53
61
  }
54
62
  /** A world ready for physics and drawing: the definition and a grid of brushes on the floor plane. */
55
63
  export interface World {
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.91.1",
5
+ "version": "0.92.0",
6
6
  "type": "module",
7
7
  "files": [
8
8
  "dist"