@korial29/tiny-fps 0.102.0 → 0.104.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/README.md +1 -1
- package/dist/index.js +15 -14
- package/dist/local.js +1 -1
- package/dist/server.js +164 -31
- package/dist/types/client/armor.d.ts +41 -0
- package/dist/types/client/foley.d.ts +7 -0
- package/dist/types/client/helmet.d.ts +52 -8
- package/dist/types/client/mesh.d.ts +5 -0
- package/dist/types/client/moonbase.d.ts +7 -1
- package/dist/types/client/pack.d.ts +49 -0
- package/dist/types/client/render.d.ts +3 -2
- package/dist/types/client/sfx.d.ts +3 -0
- package/dist/types/client/skin.d.ts +6 -2
- package/dist/types/client/soldier.d.ts +5 -5
- package/dist/types/shared/moonbase.d.ts +20 -1
- package/dist/types/shared/world.d.ts +3 -1
- package/package.json +1 -1
|
@@ -11,7 +11,14 @@ export interface Foley {
|
|
|
11
11
|
* call, and the keys he holds at its wheel (0 for the rider): the engine, the skid, the landings.
|
|
12
12
|
*/
|
|
13
13
|
rover(r: Rover | undefined, dt: number, keys?: number): void;
|
|
14
|
+
/**
|
|
15
|
+
* The own player's breath in his space helmet, `dt` seconds after the last call: in and out,
|
|
16
|
+
* quicker and louder the harder he has been moving lately. None when down or without a player.
|
|
17
|
+
*/
|
|
18
|
+
breathe(p: PlayerState | undefined, dt: number): void;
|
|
14
19
|
}
|
|
20
|
+
/** A breath's cycle at rest and at the hardest effort (s), and where in it he breathes out. */
|
|
21
|
+
export declare const BREATH: number[];
|
|
15
22
|
/** The rover: a sideways slide from this speed (m/s) skids, and is at its loudest this much over it. */
|
|
16
23
|
export declare const SKID_FROM = 2.5;
|
|
17
24
|
export declare const createFoley: (a: Audio) => Foley;
|
|
@@ -1,27 +1,71 @@
|
|
|
1
1
|
import type { Vec3 } from './mesh';
|
|
2
2
|
import type { Quat } from './rig';
|
|
3
3
|
/**
|
|
4
|
-
* The shell,
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* The shell, a superellipsoid in the head joint's frame: its centre and half width, height and
|
|
5
|
+
* depth, its exponents across (square seen from above) and up (flat on top), and its rim, the
|
|
6
|
+
* height it is cut at under the chin. It holds the ellipsoid of the same half axes, which holds the
|
|
7
|
+
* head of the skin (skin.ts, 1.555 to 1.803 m, the head joint at 1.62) from the jaw up.
|
|
7
8
|
*/
|
|
8
9
|
export declare const SHELL: {
|
|
9
10
|
c: Vec3;
|
|
10
11
|
r: Vec3;
|
|
12
|
+
e: [number, number];
|
|
11
13
|
rim: number;
|
|
12
14
|
};
|
|
13
15
|
/**
|
|
14
|
-
* The visor's opening
|
|
15
|
-
*
|
|
16
|
-
* the
|
|
16
|
+
* The visor's opening, wrapped round the shell: a rounded band in (u, y), u the arc round the
|
|
17
|
+
* shell from the front (the turn times `WRAP`, metres-like, + to the right): its centre and half
|
|
18
|
+
* width and height. Across the eyes (at 0.07 over the head joint) and round to the sides, its lower
|
|
19
|
+
* edge curving up there by `rise` at its ends while its top stays level (the user, 2026-11-10:
|
|
20
|
+
* curved on the sides, then curved up). The visor is a plate on the shell `LIFT` over it; the rim
|
|
21
|
+
* round it stands out, most at the brow.
|
|
17
22
|
*/
|
|
18
23
|
export declare const VISOR: {
|
|
19
24
|
c: [number, number];
|
|
20
25
|
r: [number, number];
|
|
26
|
+
rise: number;
|
|
27
|
+
/** The notch in its lower edge where the guard comes up (the user: the mouth rises in the middle): how high, and the half widths of its flat top and of its foot. */
|
|
28
|
+
up: number;
|
|
29
|
+
notch: [number, number];
|
|
21
30
|
};
|
|
31
|
+
/**
|
|
32
|
+
* The whole helmet is drawn this much smaller than built, about the shell's middle (the user,
|
|
33
|
+
* 2026-11-10: a little smaller overall); the head still has room inside (its crown, the nearest,
|
|
34
|
+
* is at 0.89 of the shell).
|
|
35
|
+
*/
|
|
36
|
+
export declare const SCALE = 0.93;
|
|
37
|
+
/** A point of the helmet as built to where it is drawn, in the head's frame. */
|
|
38
|
+
export declare const shrunk: (p: Vec3) => Vec3;
|
|
39
|
+
/** Metres of u a radian of turn round the shell. */
|
|
40
|
+
export declare const WRAP = 0.125;
|
|
41
|
+
export type Spot = [Vec3, Vec3];
|
|
42
|
+
export declare const sub: (a: Vec3, b: Vec3) => Vec3;
|
|
43
|
+
export declare const cross: (a: Vec3, b: Vec3) => Vec3;
|
|
44
|
+
export declare const unit: (v: Vec3) => Vec3;
|
|
45
|
+
/** A signed power: the superellipse's |t|^p keeping t's sign. */
|
|
46
|
+
export declare const pow: (t: number, p: number) => number;
|
|
47
|
+
/**
|
|
48
|
+
* Triangles between the rows of points `rows`, each a closed ring of n (the first and the last may
|
|
49
|
+
* be one point), in `col` on `layer`; wound as the normals face. Triangles of no area are left out.
|
|
50
|
+
*/
|
|
51
|
+
export declare const sheet: (rows: Spot[][], col: number[], layer: number, out?: number[]) => number[];
|
|
52
|
+
/** A flat quad over the corners `q` (in turn round it), facing `m`, in `col` on `layer`. */
|
|
53
|
+
export declare const quad: (out: number[], q: Vec3[], m: Vec3, col: number[], layer?: number) => void;
|
|
54
|
+
/**
|
|
55
|
+
* A closed loft: `f(t, s)` the point at the turn t (0 to 1 round) of its ring s (0 to 1 along),
|
|
56
|
+
* `n` points round and the rows at `along`; the ends closed by a point at `ends` (its first and
|
|
57
|
+
* last). Normals by differences, away from the loft's middle line `mid(s)`.
|
|
58
|
+
*/
|
|
59
|
+
export declare const loft: (f: (t: number, s: number) => Vec3, mid: (s: number) => Vec3, n: number, along: number[], ends: [Vec3, Vec3], col: number[], out?: number[]) => number[];
|
|
60
|
+
/** Where `pt` on the shell is in (u, y) (see VISOR). */
|
|
61
|
+
export declare const uOf: (pt: Vec3) => number;
|
|
62
|
+
/** The visor's band at u: its middle height and half height, its lower edge rising to the sides and in the notch. */
|
|
63
|
+
export declare const band: (u: number) => [number, number];
|
|
64
|
+
/** Whether (u, y) is inside the visor's opening shrunk by `k`. */
|
|
65
|
+
export declare const inside: (u: number, y: number, k?: number) => boolean;
|
|
22
66
|
/**
|
|
23
67
|
* 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):
|
|
25
|
-
* the
|
|
68
|
+
* `at` turned by `q` (see solve() in rig.ts), in `rgb`, the team's colour (0 to 1): the strips on
|
|
69
|
+
* the ear plates, which glow. The far helmet is the shell and the visor.
|
|
26
70
|
*/
|
|
27
71
|
export declare const helmet: (out: number[], at: Vec3, q: Quat, rgb: number[], lod: number) => void;
|
|
@@ -15,6 +15,11 @@ export declare const STRIDE = 10;
|
|
|
15
15
|
* sky reflected in it, more at a grazing angle.
|
|
16
16
|
*/
|
|
17
17
|
export declare const SHINE = -1.25;
|
|
18
|
+
/**
|
|
19
|
+
* The layer of a glossy hard shell (the space helmet, its pack): lit like -1 with polished
|
|
20
|
+
* metal's sharp highlight, but none of its sky reflection, which would grey it under a black sky.
|
|
21
|
+
*/
|
|
22
|
+
export declare const GLOSS = -1.12;
|
|
18
23
|
/**
|
|
19
24
|
* Camera axes [right, up, forward]: forward is (-sin yaw cos pitch, sin pitch, -cos yaw cos pitch),
|
|
20
25
|
* y up at roll 0. A positive roll leans the camera right: up tilts toward right.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Brush } from '../shared/world';
|
|
1
|
+
import type { Brush, WorldDef } from '../shared/world';
|
|
2
2
|
import type { Vec3 } from './mesh';
|
|
3
3
|
/** A model whose length runs up (y): the frame place() takes. */
|
|
4
4
|
export declare const UP: Vec3[];
|
|
@@ -22,3 +22,9 @@ export declare const LINTELS: Brush[];
|
|
|
22
22
|
export declare const INDOORS: number[];
|
|
23
23
|
/** Red's half of the base: the dome, its hall, the tubes and the modules, a metal floor in the last two, a lit frame in each of their doorways. */
|
|
24
24
|
export declare const moonbase: (o: number[]) => void;
|
|
25
|
+
/**
|
|
26
|
+
* The base's furnishing, both halves, which render.ts draws beside the scenery: the flags' daises
|
|
27
|
+
* (the ghosts with a team tint, shared/moon.ts) as the hall's fittings but in their tint, `keys`
|
|
28
|
+
* being the renderer's palette, then the dressing of red's half and its mirror for blue.
|
|
29
|
+
*/
|
|
30
|
+
export declare const furnishing: ({ brushes }: WorldDef, keys: string[]) => number[];
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { Vec3 } from './mesh';
|
|
2
|
+
import type { Quat } from './rig';
|
|
3
|
+
/**
|
|
4
|
+
* The pack's body in the chest joint's frame (at 1.30 m; the back of the trunk is about 0.12
|
|
5
|
+
* behind it), its front sunk a little in the back: its centre, half width, height and depth, and how square its corners are.
|
|
6
|
+
*/
|
|
7
|
+
export declare const PACK: {
|
|
8
|
+
c: Vec3;
|
|
9
|
+
r: Vec3;
|
|
10
|
+
e: number;
|
|
11
|
+
};
|
|
12
|
+
/** The hose: where it leaves the helmet (the head joint's frame) and the way it goes, where it enters the pack (the chest's) and its way in, its radius. */
|
|
13
|
+
export declare const HOSE: {
|
|
14
|
+
from: Vec3;
|
|
15
|
+
out: Vec3;
|
|
16
|
+
to: Vec3;
|
|
17
|
+
r: number;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Appends the pack at level of detail `lod` on the chest joint at `at` turned by `q` (see solve()
|
|
21
|
+
* in rig.ts); its light strips glow in `rgb`, the team's colour.
|
|
22
|
+
*/
|
|
23
|
+
export declare const pack: (out: number[], at: Vec3, q: Quat, rgb: number[], lod: number) => void;
|
|
24
|
+
/**
|
|
25
|
+
* Appends the hose from the helmet on the head joint (`head`, `hq`) to the pack on the chest joint
|
|
26
|
+
* (`chest`, `cq`), at level of detail `lod`: a Bezier leaving the helmet out and down and entering
|
|
27
|
+
* the pack's port from above, ribbed close up. None far.
|
|
28
|
+
*/
|
|
29
|
+
export declare const hose: (out: number[], head: Vec3, hq: Quat, chest: Vec3, cq: Quat, lod: number) => void;
|
|
30
|
+
/**
|
|
31
|
+
* The shoulder pads (the user, 2026-11-10: white and glossy, then worked, less of a shell, cut a
|
|
32
|
+
* third of the way in from the neck, smaller): a plate over each shoulder, flat on top and rounded
|
|
33
|
+
* to its rim, which turns down; two grooves along its outer edge; its inner third, toward the
|
|
34
|
+
* neck, cut off straight. On the arm's joint so it goes with the arm. For the right one (the left
|
|
35
|
+
* is mirrored): its middle from the joint, the way it faces, its half length along the shoulder
|
|
36
|
+
* and half width across it, its height, and the cut (a share of the half length, from the middle
|
|
37
|
+
* toward the neck).
|
|
38
|
+
*/
|
|
39
|
+
export declare const PAD: {
|
|
40
|
+
at: Vec3;
|
|
41
|
+
out: Vec3;
|
|
42
|
+
r: [number, number];
|
|
43
|
+
h: number;
|
|
44
|
+
cut: number;
|
|
45
|
+
};
|
|
46
|
+
/** Appends both shoulder pads at level of detail `lod` on the arm joints (`arms`: the left's and the right's place and turn), in `plate` (white when absent). */
|
|
47
|
+
export declare const shoulders: (out: number[], arms: [Vec3, Quat][], lod: number, plate?: number[]) => void;
|
|
48
|
+
/** Appends the crotch cup at level of detail `lod` on the pelvis joint at `at` turned by `q`, in `plate` (white when absent). */
|
|
49
|
+
export declare const crotch: (out: number[], at: Vec3, q: Quat, lod: number, plate?: number[]) => void;
|
|
@@ -38,8 +38,9 @@ export declare const FOV: number;
|
|
|
38
38
|
export declare const ROVER_NEAR: number, ROVER_MID: number;
|
|
39
39
|
/**
|
|
40
40
|
* Blinn-Phong strength and exponent: a row per TEX id in order (brick, tile, lava, stone, metal, wood,
|
|
41
|
-
* moss, grate, concrete, glass, steel, paint, rock), then the flat bodies, then polished metal (SHINE)
|
|
42
|
-
* and glows never get here: they
|
|
41
|
+
* moss, grate, concrete, glass, steel, paint, rock), then the flat bodies, then polished metal (SHINE),
|
|
42
|
+
* then a glossy shell (GLOSS: broader, so it shows on the armour). Lava and glows never get here: they
|
|
43
|
+
* light themselves.
|
|
43
44
|
*/
|
|
44
45
|
export declare const SPEC: number[][];
|
|
45
46
|
export declare const FRAG: string;
|
|
@@ -85,6 +85,9 @@ export declare const SOUND: {
|
|
|
85
85
|
readonly THUD: 41;
|
|
86
86
|
/** The rover's tyres sliding sideways over the dust, looped: louder as it drifts wider. */
|
|
87
87
|
readonly SKID: 42;
|
|
88
|
+
/** Breathing in a space helmet (the user, 2026-11-10), in then out: air drawn through the regulator, and let out with its valve's hiss. */
|
|
89
|
+
readonly INHALE: 43;
|
|
90
|
+
readonly EXHALE: 44;
|
|
88
91
|
};
|
|
89
92
|
/**
|
|
90
93
|
* The sounds of the game: one entry per sound, its voices layered, in SOUND order. A low-passed
|
|
@@ -4,8 +4,12 @@ import type { Vec3 } from './mesh';
|
|
|
4
4
|
export declare const hairOf: (id: number) => number[];
|
|
5
5
|
/** An iris colour for the runner `id`, as hairOf(). */
|
|
6
6
|
export declare const eyesOf: (id: number) => number[];
|
|
7
|
-
/** Jacket, its darker trim, trousers (the suit's legs, darker), skin, hair, boots, sole, gloves, the whites of the eyes and their irises, the lips, the skin in its folds (nostrils, the mouth, the ears' hollows), the brows, between the hair and the skin, the shaved beard's shadow and its edge, the line between the lips (as the folds), the light caught in the eyes, which glows, and the cut's cauterized face, which glows too. */
|
|
8
|
-
|
|
7
|
+
/** Jacket, its darker trim, trousers (the suit's legs, darker), skin, hair, boots, sole, gloves, the whites of the eyes and their irises, the lips, the skin in its folds (nostrils, the mouth, the ears' hollows), the brows, between the hair and the skin, the shaved beard's shadow and its edge, the line between the lips (as the folds), the side stripe on the jacket and on the trousers and the belt (the jacket's and the trousers' own colours but on a space suit), the light caught in the eyes, which glows, and the cut's cauterized face, which glows too. */
|
|
8
|
+
/**
|
|
9
|
+
* With `suit` (the moon's, the user 2026-11-10), a dark grey space suit under white armour: the
|
|
10
|
+
* team's colour only in a stripe down each side, black gloves, boots and belt.
|
|
11
|
+
*/
|
|
12
|
+
export declare const palette: (jacket: number[], hair?: number[], iris?: number[], suit?: boolean) => number[][];
|
|
9
13
|
/** The ring where the eye's sleeve ends in the glove, which body.ts starts the palm on, and its sides: the close ones (the eye's body is close). A thin wrist (3.2 cm until the user, 2026-11-09). */
|
|
10
14
|
export declare const CUFF: number[];
|
|
11
15
|
export declare const CUFF_SIDES: number;
|
|
@@ -4,7 +4,7 @@ import type { Gait, Seat } from './gait';
|
|
|
4
4
|
import type { Tracer } from './beams';
|
|
5
5
|
import type { Piece } from './limbs';
|
|
6
6
|
import type { Vec3 } from './mesh';
|
|
7
|
-
import type { Pose } from './rig';
|
|
7
|
+
import type { Pose, Quat } from './rig';
|
|
8
8
|
import type { Trail } from './trail';
|
|
9
9
|
/** What a runner keeps between frames. */
|
|
10
10
|
export interface Runner {
|
|
@@ -67,7 +67,7 @@ export declare const dissolve: (out: number[], from: number, k: number) => void;
|
|
|
67
67
|
export declare const stance: (r: Runner) => {
|
|
68
68
|
s: {
|
|
69
69
|
pos: Vec3[];
|
|
70
|
-
rot:
|
|
70
|
+
rot: Quat[];
|
|
71
71
|
};
|
|
72
72
|
sink: number;
|
|
73
73
|
yaw: number;
|
|
@@ -75,14 +75,14 @@ export declare const stance: (r: Runner) => {
|
|
|
75
75
|
} | {
|
|
76
76
|
s: {
|
|
77
77
|
pos: Vec3[];
|
|
78
|
-
rot:
|
|
78
|
+
rot: Quat[];
|
|
79
79
|
};
|
|
80
80
|
sink: number;
|
|
81
81
|
yaw: number;
|
|
82
82
|
carry: [Vec3, Vec3[]] | undefined;
|
|
83
83
|
};
|
|
84
84
|
/** Draws the runner and gives back its solved skeleton, or nothing once a bolt has burnt it away. */
|
|
85
|
-
export declare const soldier: (out: number[], r: Runner, color: number[], lod?: number, helmets?: boolean) => {
|
|
85
|
+
export declare const soldier: (out: number[], r: Runner, color: number[], lod?: number, helmets?: boolean, armored?: boolean) => {
|
|
86
86
|
pos: Vec3[];
|
|
87
|
-
rot:
|
|
87
|
+
rot: Quat[];
|
|
88
88
|
} | undefined;
|
|
@@ -38,8 +38,27 @@ export declare const MOUTHS: number[][];
|
|
|
38
38
|
* What stands in the hall, about the dome's centre: ghosts, since client/moonbase.ts draws them
|
|
39
39
|
* with the hall (the sun's shadow map is 64 m wide, a brush across the hall would be drawn sunlit).
|
|
40
40
|
* The mezzanine 3.5 m up along the walls (not over the door), the stairs up to it facing the door,
|
|
41
|
-
* a console and two parapets on it, three crates on the floor.
|
|
41
|
+
* a console and two parapets on it, three crates on the floor clear of the flag's dais (moon.ts).
|
|
42
42
|
*/
|
|
43
43
|
export declare const FIT: Brush[];
|
|
44
|
+
/** The kinds of lab kit client/moonbase.ts draws. */
|
|
45
|
+
export declare const KIND: {
|
|
46
|
+
BENCH: number;
|
|
47
|
+
SAMPLES: number;
|
|
48
|
+
RACKS: number;
|
|
49
|
+
SCOPE: number;
|
|
50
|
+
ANALYSER: number;
|
|
51
|
+
PLANTS: number;
|
|
52
|
+
LOCKERS: number;
|
|
53
|
+
SUIT: number;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* The lab kit in red's half: kind, x0, z0, x1, z1, y0, y1, and the way its front looks (0 +x, 1
|
|
57
|
+
* +z, 2 -x, 3 -z). Its box is a ghost, drawn by client/moonbase.ts as the hall's fittings are.
|
|
58
|
+
* Each stands flush on a wall or more than a body away from it (no crack to stick in), what stands
|
|
59
|
+
* under the mezzanine leaves a body room on top or reaches up to it, and none stands by the middle
|
|
60
|
+
* of a module's wall: vision.ts would band its top as a ledge.
|
|
61
|
+
*/
|
|
62
|
+
export declare const KIT: number[][];
|
|
44
63
|
/** Red's half of the base. */
|
|
45
64
|
export declare const BASE: Brush[];
|
|
@@ -57,8 +57,10 @@ export interface WorldDef {
|
|
|
57
57
|
gravity?: number;
|
|
58
58
|
/** 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. */
|
|
59
59
|
scenery?: 'city' | 'moon';
|
|
60
|
-
/** Whether the runners wear space helmets. */
|
|
60
|
+
/** Whether the runners wear space helmets, with the pack on the back, its hose and the breath. */
|
|
61
61
|
helmets?: boolean;
|
|
62
|
+
/** Whether the runners wear armour over a grey suit: white with space helmets, else in the team's colour. */
|
|
63
|
+
armor?: boolean;
|
|
62
64
|
/** Ground that is not flat (relief.ts), round the brushes: the moon's crater floor. Absent: none. */
|
|
63
65
|
relief?: ReliefDef;
|
|
64
66
|
/** Where the rovers (rover.ts) are parked, each as a spawn: the middle of its wheels on the ground and the yaw of its nose. Absent: none. */
|
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.
|
|
5
|
+
"version": "0.104.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"files": [
|
|
8
8
|
"dist"
|