@korial29/tiny-fps 1.9.0 → 1.10.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/assets/{room-DNdwMAUE.js → room-BPH05sFp.js} +203 -34
- package/dist/index.js +6 -5
- package/dist/local.js +1 -1
- package/dist/room.js +1 -1
- package/dist/server.js +1 -1
- package/dist/types/client/render/shader.d.ts +9 -2
- package/dist/types/shared/bot.d.ts +13 -1
- package/dist/types/shared/ctf.d.ts +2 -0
- package/dist/types/shared/room.d.ts +5 -0
- package/dist/types/shared/valet.d.ts +54 -0
- package/package.json +1 -1
package/dist/room.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { n as MAPS, r as RULES, t as Room } from "./assets/room-
|
|
1
|
+
export { n as MAPS, r as RULES, t as Room } from "./assets/room-BPH05sFp.js";
|
package/dist/server.js
CHANGED
|
@@ -33,6 +33,10 @@ export interface Variant {
|
|
|
33
33
|
p: WebGLProgram;
|
|
34
34
|
u: Record<string, WebGLUniformLocation>;
|
|
35
35
|
sent: Map<string, unknown[]>;
|
|
36
|
+
/** The kind it was made for (fragOf()), to make its twin with the vision's code. */
|
|
37
|
+
kind: string;
|
|
38
|
+
/** For a program with the vision's code (VISION): the one without it that it stands in for. */
|
|
39
|
+
base?: Variant;
|
|
36
40
|
}
|
|
37
41
|
export type Setter = Extract<keyof WebGL2RenderingContext, `uniform${string}`>;
|
|
38
42
|
/** The most boxes the mirrors are tested against: a reflected pixel loops over all of them. */
|
|
@@ -53,9 +57,12 @@ export declare const mirrors: (brushes?: readonly Brush[]) => boolean;
|
|
|
53
57
|
* colour's registers kept every shadow map's pixels from running as many at once); with none, all of it. Left in where it never runs,
|
|
54
58
|
* code still costs every pixel through the shader's registers: the moon 2.4 ms of GPU a frame on
|
|
55
59
|
* Highline, the ninja's 1.9 ms on three astronauts at 3 m on the moon. `rock` is the GLSL of the
|
|
56
|
-
* map's rocks under BEACH (Decor.rock: Landfall's granite, from its chunk).
|
|
60
|
+
* map's rocks under BEACH (Decor.rock: Landfall's granite, from its chunk). `sight` adds the
|
|
61
|
+
* vision's filter and its glowing prey (VISION), for a frame in a xenomorph's or the Hunter's
|
|
62
|
+
* vision: its loop and palettes were 4.6 ms a frame on Highline with none ever drawn, 1.4 on
|
|
63
|
+
* Tranquility and none on Landfall, through the registers they take from every pixel.
|
|
57
64
|
*/
|
|
58
|
-
export declare const fragOf: (def: Pick<WorldDef, "scenery" | "seam" | "relief" | "helmets"> & Partial<Pick<WorldDef, "brushes">>, kind?: string, rock?: string) => string;
|
|
65
|
+
export declare const fragOf: (def: Pick<WorldDef, "scenery" | "seam" | "relief" | "helmets"> & Partial<Pick<WorldDef, "brushes">>, kind?: string, rock?: string, sight?: boolean) => string;
|
|
59
66
|
/** A map whose ground takes footprints (createPrints): Landfall's sand, the moon's regolith. */
|
|
60
67
|
export declare const printed: (def: Pick<WorldDef, "scenery" | "relief">) => boolean;
|
|
61
68
|
/** A map with the moon's sky: its globe, stars and craters. Not the beach, whose sand is a relief too. */
|
|
@@ -2,7 +2,7 @@ import type { Vec3 } from './nav';
|
|
|
2
2
|
import type { Flying } from './plasma';
|
|
3
3
|
import type { Errand } from './sortie';
|
|
4
4
|
import type { Kit } from './kit';
|
|
5
|
-
import type { FlagState, PlayerState } from './types';
|
|
5
|
+
import type { FlagState, PlayerState, Rover } from './types';
|
|
6
6
|
import type { World } from './world';
|
|
7
7
|
/** A player as a bot sees him: the host's own state, no rewind. */
|
|
8
8
|
export interface Seen {
|
|
@@ -22,6 +22,8 @@ export interface Sight {
|
|
|
22
22
|
balls?: readonly Flying[];
|
|
23
23
|
/** What the room asks of it at the orbital station (sortie.ts). */
|
|
24
24
|
errand?: Errand;
|
|
25
|
+
/** The free rover within its walk, or the one it drives (valet.ts). */
|
|
26
|
+
car?: Rover;
|
|
25
27
|
/** The numbers of its class (kit.ts): the marine's when absent. */
|
|
26
28
|
kit?: Kit;
|
|
27
29
|
/** Its team's roles this tick, worked out once by the room (squad()); else its own reckoning. */
|
|
@@ -78,6 +80,8 @@ export interface Persona {
|
|
|
78
80
|
lead: number;
|
|
79
81
|
/** The share of a target's change of speed it catches up with a tick. */
|
|
80
82
|
track: number;
|
|
83
|
+
/** The share of the cars within its walk that it takes on a long way (valet.ts). */
|
|
84
|
+
ride: number;
|
|
81
85
|
}
|
|
82
86
|
/** The character of the bot `id` in a room of this skill. */
|
|
83
87
|
export declare const personaOf: (id: number, skill?: number) => Persona;
|
|
@@ -160,6 +164,9 @@ export declare class Bot {
|
|
|
160
164
|
private weighed;
|
|
161
165
|
/** Its errand to the orbital station, when it has one. */
|
|
162
166
|
private sortie;
|
|
167
|
+
/** Its rides in a rover, and whether it was at the wheel last tick. */
|
|
168
|
+
private valet;
|
|
169
|
+
private riding;
|
|
163
170
|
/**
|
|
164
171
|
* Whether it jumps unlike the marine the routes were flown with (the ninja, the xenomorph): it
|
|
165
172
|
* steers every leap in the air to come down on its point, as the moon's (`land`).
|
|
@@ -194,6 +201,11 @@ export declare class Bot {
|
|
|
194
201
|
private goalOf;
|
|
195
202
|
/** The guard's point: round its flag, a stop at each point, one way or the other by its id. */
|
|
196
203
|
private patrol;
|
|
204
|
+
/**
|
|
205
|
+
* Its rides (valet.ts): to a free rover on a long way, at its wheel along its own way, out where
|
|
206
|
+
* the way turns to a leg. None when it is on foot and goes its way.
|
|
207
|
+
*/
|
|
208
|
+
private ride;
|
|
197
209
|
private urgent;
|
|
198
210
|
private plan;
|
|
199
211
|
/**
|
|
@@ -67,6 +67,8 @@ export declare class Ctf {
|
|
|
67
67
|
frag(id: number): number;
|
|
68
68
|
/** The room is empty: the next match starts from scratch. */
|
|
69
69
|
reset(): void;
|
|
70
|
+
/** Ticks the match has run (it counts down from the time limit). */
|
|
71
|
+
elapsed(): number;
|
|
70
72
|
/** The part of a snapshot that is the match's. */
|
|
71
73
|
wire(): Pick<Snapshot, 'score' | 'clock' | 'over' | 'flags'>;
|
|
72
74
|
/**
|
|
@@ -354,6 +354,11 @@ export declare class Room {
|
|
|
354
354
|
* errand goes home.
|
|
355
355
|
*/
|
|
356
356
|
private errands;
|
|
357
|
+
/**
|
|
358
|
+
* The rover a bot may drive: the one at whose wheel it sits, or the nearest empty one within its
|
|
359
|
+
* walk (valet.ts), never a ship (the station's errand flies those).
|
|
360
|
+
*/
|
|
361
|
+
private carOf;
|
|
357
362
|
/** The bots' map of the world, built when it loads rather than in the tick of a bot's first plan. */
|
|
358
363
|
private guide;
|
|
359
364
|
/** The players the bots fill the room up to: none with no human. */
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { PlayerState, Rover } from './types';
|
|
2
|
+
import type { World } from './world';
|
|
3
|
+
type Vec3 = [number, number, number];
|
|
4
|
+
export type Intent = {
|
|
5
|
+
keys: number;
|
|
6
|
+
yaw: number;
|
|
7
|
+
pitch: number;
|
|
8
|
+
};
|
|
9
|
+
/** The ride's numbers: metres. */
|
|
10
|
+
export declare const RIDE: {
|
|
11
|
+
/** The shortest way worth a car, and the farthest car it walks to. */
|
|
12
|
+
LONG: number;
|
|
13
|
+
NEAR: number;
|
|
14
|
+
/** The point of its way it steers for is at least this far ahead; it gets out this close to the end of the way. */
|
|
15
|
+
LOOK: number;
|
|
16
|
+
END: number;
|
|
17
|
+
/** Metres ahead it looks for a drop, and the fall that stops it. */
|
|
18
|
+
AHEAD: number;
|
|
19
|
+
DROP: number;
|
|
20
|
+
/** Ticks it walks to a car before it gives up, drives at the longest, and stands still before it gets out. */
|
|
21
|
+
WALK: number;
|
|
22
|
+
DRIVE: number;
|
|
23
|
+
STUCK: number;
|
|
24
|
+
/** Ticks before it thinks of a car again after it got out or gave up. */
|
|
25
|
+
PAUSE: number;
|
|
26
|
+
};
|
|
27
|
+
/** The bot's memory of a ride. */
|
|
28
|
+
export declare class Valet {
|
|
29
|
+
/** Where it walks to on the ground to board, for its own way finding; none when it is not boarding. */
|
|
30
|
+
board: Vec3 | undefined;
|
|
31
|
+
private since;
|
|
32
|
+
private idle;
|
|
33
|
+
private index;
|
|
34
|
+
private asleep;
|
|
35
|
+
private walked;
|
|
36
|
+
/**
|
|
37
|
+
* Whether it wants this car now, on foot: it has a long way to go, the car is close and free, and
|
|
38
|
+
* it is of a driving mind this once (`take` the share of the cars it takes, `rnd` its dice).
|
|
39
|
+
* Decided once a PAUSE, then kept for the walk to the car.
|
|
40
|
+
*/
|
|
41
|
+
wants(p: PlayerState, car: Rover | undefined, goal: Vec3, t: number, take: number, rnd: () => number): boolean;
|
|
42
|
+
/** On foot toward the car `car`: walks to it, then presses USE beside it. */
|
|
43
|
+
approach(p: PlayerState, car: Rover, t: number): Intent | undefined;
|
|
44
|
+
/** Called when it sits at the wheel: the ride begins. */
|
|
45
|
+
start(t: number): void;
|
|
46
|
+
/**
|
|
47
|
+
* One tick at the wheel of `car` on its `way` (the points of its path before the first leg; the
|
|
48
|
+
* goal when none): the keys and look, or a press of USE to get out.
|
|
49
|
+
*/
|
|
50
|
+
drive(car: Rover, way: readonly Vec3[], w: World, t: number): Intent;
|
|
51
|
+
}
|
|
52
|
+
/** Whether `p` is seated at the wheel of `car`. */
|
|
53
|
+
export declare const driver: (p: PlayerState, car: Rover | undefined, id: number) => car is Rover;
|
|
54
|
+
export {};
|
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": "1.
|
|
5
|
+
"version": "1.10.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"files": [
|
|
8
8
|
"dist"
|