@korial29/tiny-fps 0.119.0 → 0.120.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
@@ -7,6 +7,8 @@ var PLAYER_H = 1.8;
7
7
  var EYE = 1.6;
8
8
  /** Pitch is clamped to ±MAX_PITCH radians, just short of straight up or down. */
9
9
  var MAX_PITCH = 1.55;
10
+ /** A floor at most this much higher is walked onto; a higher one needs a jump. */
11
+ var STEP_H = .5;
10
12
  /** Height of the cylinder when sliding or crouching, and the eye in it. */
11
13
  var LOW_H = .9;
12
14
  var LOW_EYE = .7;
@@ -3115,7 +3117,7 @@ var stairs = (axis, a, b, w0, w1, y, top) => {
3115
3117
  * The mezzanine 3.5 m up along the walls (not over the door), the stairs up to it facing the door,
3116
3118
  * a console and two parapets on it, three crates on the floor clear of the flag's dais (moon.ts).
3117
3119
  */
3118
- var FIT = [
3120
+ var FIT$1 = [
3119
3121
  ...turns([[
3120
3122
  12,
3121
3123
  -D1,
@@ -3363,7 +3365,7 @@ var BASE = [
3363
3365
  TZ0 - DOME[1]
3364
3366
  ]
3365
3367
  ].map((p) => ghost(p, 0, BANDS[1])),
3366
- ...FIT,
3368
+ ...FIT$1,
3367
3369
  ...KIT.map(([, x0, z0, x1, z1, y0, y1]) => ({
3368
3370
  ...box(x0, y0, z0, x1, y1, z1, STEEL$1),
3369
3371
  ghost: true
@@ -3870,22 +3872,15 @@ var at$1 = (x, z) => {
3870
3872
  if (k > 1) w = (w + (k - 1) * 60 * (Math.abs(2 * noise(x / 45, z / 45, 5) - 1) - .5)) * (1 + (k - 1) * (1.2 * noise(x / 90, z / 90, 7) - .6)) * (1 - sm((k - 1.25) / .4));
3871
3873
  return Math.max(h, -14.5) + w;
3872
3874
  };
3873
- /** Five bearings a fifth of a turn apart, as unit vectors: no Math.cos in what the host and the clients must agree on. */
3874
- var FIFTHS = [
3875
- [1, 0],
3876
- [.309, .951],
3877
- [-.809, .588],
3878
- [-.809, -.588],
3879
- [.309, -.951]
3880
- ];
3875
+ /** How high a rock's middle is over the ground: three tenths of its height, and 0.6 m or half its height if less. Its widest is there, its flank steep down to the ground: a body is stopped at its foot. */
3876
+ var rockMid = (H) => Math.max(.3 * H, Math.min(.5 * H, .8));
3881
3877
  /**
3882
3878
  * The form of a boulder of radius R and height H from a seed: how far it reaches from its middle
3883
- * (a quarter of its height over the ground) along a unit vector. One to three lobes, each a block
3884
- * cut by five leaning planes round it and a nearly level one on top, its corners rounded by an
3885
- * ellipsoid: a main mass, a shoulder beside it half as high from 1.3 m of radius, a low one from
3886
- * 3.2 m. One plane cuts under a side (an overhang), and the whole swells and shrinks by 6 % with
3887
- * the bearing. Only + - * /, Math.sqrt and the hash: the boxes below come from it on every side.
3888
- * `tops` are the lobes' middles (x, z) and the height of their top over the rock's middle.
3879
+ * (rockMid() over the ground) along a unit vector. A rounded solid, no plane in it:
3880
+ * an ellipsoid stretched unevenly on its three axes and turned by the seed, upright under its
3881
+ * middle (it stands in the regolith, as wide at the ground as at its middle) and a dome over it, swollen and shrunk by two low octaves
3882
+ * of noise with the bearing (large soft lobes), with one gentle hollow and one flatter side. Only
3883
+ * + - * /, Math.sqrt and the hash: the boxes below come from it on every side.
3889
3884
  */
3890
3885
  var rockOf = (s, R, H) => {
3891
3886
  const h = (k) => hash(s, k, 131);
@@ -3894,168 +3889,219 @@ var rockOf = (s, R, H) => {
3894
3889
  const l = Math.sqrt(a * a + b * b) || 1;
3895
3890
  return [a / l, b / l];
3896
3891
  };
3897
- const lobes = [
3892
+ const [cx, sx] = flat(1);
3893
+ const [a, b] = [R * (.9 + .25 * h(3)), R * (.68 + .22 * h(4))];
3894
+ const lean = .3 * h(9) - .15;
3895
+ const [hx, hz] = flat(5);
3896
+ const [fx, fz] = flat(7);
3897
+ const swell = (u) => {
3898
+ const n = .8 + .28 * noise(1.1 * u[0] + s, 1.1 * u[2] + .9 * u[1], s) + .1 * noise(2.3 * u[0] - s, 2.3 * u[2] + 1.7 * u[1], s + 1);
3899
+ const hollow = c1((.8 * (u[0] * hx + u[2] * hz) + .6 * u[1] - .55) / .45);
3900
+ const side = c1((.954 * (u[0] * fx + u[2] * fz) + .3 * u[1] - .4) / .6);
3901
+ return n * (1 - .14 * hollow * hollow) * (1 - .16 * side * side);
3902
+ };
3903
+ const cu = (H - rockMid(H)) / swell([
3898
3904
  0,
3899
3905
  1,
3900
- 2
3901
- ].slice(0, R < 1.3 ? 1 : R < 3.2 ? 2 : 3).map((k) => {
3902
- const [fx, fz] = flat(20 * k + 1);
3903
- const [off, rad] = [[
3904
- .1,
3905
- .45,
3906
- .42
3907
- ][k] * R, [
3908
- .8,
3909
- .75,
3910
- .65
3911
- ][k] * R];
3912
- const o = [fx * off, fz * off];
3913
- const top = [
3914
- H,
3915
- (.5 + .15 * h(20 * k + 3)) * H,
3916
- .34 * H
3917
- ][k] - .25 * H;
3918
- const tilt = Math.min(.06, .06 / rad);
3919
- const [tx, tz] = [(2 * h(20 * k + 4) - 1) * tilt, (2 * h(20 * k + 5) - 1) * tilt];
3920
- const tl = Math.sqrt(tx * tx + 1 + tz * tz);
3921
- return {
3922
- o,
3923
- rad,
3924
- top,
3925
- planes: [[
3926
- tx / tl,
3927
- 1 / tl,
3928
- tz / tl,
3929
- (tx * o[0] + top + tz * o[1]) / tl
3930
- ], ...FIFTHS.map(([px, pz], j) => {
3931
- const [ax, az] = [px + h(20 * k + 6 + j) - .5, pz + h(20 * k + 11 + j) - .5];
3932
- const l = Math.sqrt(ax * ax + az * az);
3933
- const y = -.15 + .5 * h(20 * k + 16 + j);
3934
- const c = Math.sqrt(1 - y * y);
3935
- const [nx, nz] = [c * ax / l, c * az / l];
3936
- return [
3937
- nx,
3938
- y,
3939
- nz,
3940
- nx * o[0] + nz * o[1] + rad * (.72 + .22 * h(20 * k + 21 + j))
3941
- ];
3942
- })]
3943
- };
3944
- });
3945
- const [ux, uz] = flat(91);
3946
- const under = [
3947
- .866 * ux,
3948
- -.5,
3949
- .866 * uz,
3950
- .72 * R
3951
- ];
3906
+ 0
3907
+ ]);
3908
+ const deep = rockMid(H) + .7 * H;
3952
3909
  const reach = (u) => {
3953
- let far = 0;
3954
- for (const { o, rad, planes } of lobes) {
3955
- const [a, c] = [1.2 * rad, 1.15 * H];
3956
- const A = (u[0] * u[0] + u[2] * u[2]) / (a * a) + u[1] * u[1] / (c * c);
3957
- const B = -2 * (u[0] * o[0] + u[2] * o[1]) / (a * a);
3958
- const C = (o[0] * o[0] + o[1] * o[1]) / (a * a) - 1;
3959
- let t = (-B + Math.sqrt(B * B - 4 * A * C)) / (2 * A);
3960
- for (const [nx, ny, nz, d] of [...planes, under]) {
3961
- const k = u[0] * nx + u[1] * ny + u[2] * nz;
3962
- t = k > 1e-9 ? Math.min(t, d / k) : t;
3963
- }
3964
- far = Math.max(far, t);
3910
+ if (u[1] < 0) {
3911
+ const l = Math.sqrt(u[0] * u[0] + u[2] * u[2]);
3912
+ return l < 1e-6 ? deep : Math.min(reach([
3913
+ u[0] / l,
3914
+ 0,
3915
+ u[2] / l
3916
+ ]) / l, deep / -u[1]);
3965
3917
  }
3966
- return far * (.94 + .12 * noise(1.5 * u[0] + s, 1.5 * u[2] + 2 * u[1], s));
3967
- };
3968
- return {
3969
- reach,
3970
- tops: lobes.map(({ o, top }) => [
3971
- o[0],
3972
- o[1],
3973
- top
3974
- ])
3918
+ const x = (u[0] * cx + u[2] * sx - lean * u[1]) / a;
3919
+ const z = (u[2] * cx - u[0] * sx - (.15 - lean) * u[1]) / b;
3920
+ const q = u[1] * u[1] / (cu * cu);
3921
+ const [D, E] = [x * x + z * z + .65 * q, .35 * q * q];
3922
+ const T = E < 1e-12 ? 1 / D : (Math.sqrt(D * D + 4 * E) - D) / (2 * E);
3923
+ return Math.sqrt(T) * swell(u);
3975
3924
  };
3925
+ return { reach };
3976
3926
  };
3977
3927
  /**
3978
- * The boxes inside a boulder, one for each lobe, each x0, y0, z0, x1, y1, z1 round its middle
3979
- * (y from the middle's height): the widest box under the lobe's top, standing from `foot` under
3980
- * the middle, whose corners and the middles of its sides are all in the rock at its foot, half
3981
- * way up and on top. A body is stopped a little inside what is drawn, never outside it.
3928
+ * The boxes a boulder collides with, x0, y0, z0, x1, y1, z1 round its middle: what stops a body is
3929
+ * where the rock is drawn. From `lo` (the ground round it) to its top it is cut in layers: up to
3930
+ * `band` (a body's height over the ground) a layer ends where the rock has moved in or out by
3931
+ * FIT[0] on a bearing, or at 0.9 m; over it by FIT[1], or at 1.5 m; none thinner than 0.25 m. In
3932
+ * each a grid of points says where the rock is at the layer's foot and top (a box may stand 7 cm
3933
+ * out of it), and boxes are picked on it one after the other: the largest first, then the one
3934
+ * that brings the most of the outline within FIT[2] (FIT[3] over the band) of a box, overlapping
3935
+ * one already there, until the whole outline is. No crack between them.
3982
3936
  */
3983
- var inside = ({ reach, tops }, R, foot) => {
3984
- const holds = (x, y, z, slack = .09) => {
3985
- const l = Math.sqrt(x * x + y * y + z * z);
3986
- return l < 1e-6 || l <= reach([
3987
- x / l,
3988
- y / l,
3989
- z / l
3990
- ]) + slack;
3991
- };
3992
- const grid = [
3993
- -1,
3994
- 0,
3995
- 1
3996
- ];
3997
- /** A box of half sides p and q round (cx, cz) from the foot up to t: in the rock at its foot, half way up and on top, and with no rock 0.2 m over its top (what stands on it is not in the rock). */
3998
- const fits = (cx, cz, p, q, t) => [
3999
- foot + .05,
4000
- (foot + t) / 2,
4001
- t
4002
- ].every((y) => grid.every((i) => grid.every((j) => holds(cx + i * p, y, cz + j * q)))) && grid.every((i) => grid.every((j) => !holds(cx + i * p, t + .2, cz + j * q, 0)));
4003
- return tops.flatMap(([ox, oz, top], k) => {
4004
- let best = [
4005
- 0,
4006
- 0,
4007
- 0,
3937
+ /** How far over the ground a rock's first layer of boxes goes: more than a body steps up, from ground a little higher. */
3938
+ var WALL = STEP_H + .2;
3939
+ var FIT = [
3940
+ .16,
3941
+ .3,
3942
+ .16,
3943
+ .3
3944
+ ];
3945
+ var fitted = ({ reach }, R, lo, band, foot) => {
3946
+ /**
3947
+ * The rock's outline at a height: how far it goes from its axis on 8 m bearings, m to each side
3948
+ * of a square round it (no Math.cos), 7 cm out of it; then whether a point is in that outline.
3949
+ */
3950
+ const outline = (y, m) => {
3951
+ const o = new Float64Array(8 * m);
3952
+ const u = [
4008
3953
  0,
4009
3954
  0,
4010
3955
  0
4011
3956
  ];
4012
- const l = Math.sqrt(ox * ox + oz * oz) || 1;
4013
- for (const a of k ? [
4014
- .1,
4015
- .3,
4016
- .5
4017
- ] : [
4018
- -.15,
4019
- 0,
4020
- .15
4021
- ]) for (const b of [
4022
- -.15,
4023
- 0,
4024
- .15
4025
- ]) {
4026
- const [cx, cz] = k ? [ox + (a * ox - b * oz) * (R / l), oz + (a * oz + b * ox) * (R / l)] : [ox + a * R, oz + b * R];
4027
- let t = 0;
4028
- for (let y = top + .1; !t && y > foot + .3; y -= .1) t = fits(cx, cz, .08 * R, .08 * R, y) ? y : 0;
4029
- let [p, q] = [.08 * R, .08 * R];
4030
- for (const [fa, fb] of t ? [
4031
- [1, 1],
4032
- [1, 0],
4033
- [0, 1]
4034
- ] : []) for (let step = .5 * R; step > .03; step /= 2) [p, q] = fits(cx, cz, p + fa * step, q + fb * step, t) ? [p + fa * step, q + fb * step] : [p, q];
4035
- if (t && p * q * (t - foot) > best[0]) best = [
4036
- p * q * (t - foot),
4037
- cx,
4038
- cz,
4039
- p,
4040
- q,
4041
- t
3957
+ for (let k = 0; k < 8 * m; k++) {
3958
+ const t = (k % (2 * m) + .5) / m - 1;
3959
+ const side = Math.floor(k / (2 * m));
3960
+ const l = Math.sqrt(1 + t * t) * (side > 1 ? -1 : 1);
3961
+ const dx = (side % 2 ? -t : 1) / l;
3962
+ const dz = (side % 2 ? 1 : t) / l;
3963
+ let p = 0;
3964
+ let q = 1.6 * R;
3965
+ for (let it = 0; it < 8; it++) {
3966
+ const r = (p + q) / 2;
3967
+ const d = Math.sqrt(r * r + y * y);
3968
+ u[0] = r * dx / d;
3969
+ u[1] = y / d;
3970
+ u[2] = r * dz / d;
3971
+ if (d <= reach(u) + .07) p = r;
3972
+ else q = r;
3973
+ }
3974
+ o[k] = p;
3975
+ }
3976
+ return o;
3977
+ };
3978
+ const within = (o, x, z) => {
3979
+ const m = o.length / 8;
3980
+ const wide = Math.abs(x) >= Math.abs(z);
3981
+ if (Math.abs(x) + Math.abs(z) < 1e-9) return true;
3982
+ const side = wide ? x > 0 ? 0 : 2 : z > 0 ? 1 : 3;
3983
+ const f = ((wide ? z / x : -x / z) + 1) * m - .5 + side * 2 * m;
3984
+ const k = Math.floor(f);
3985
+ const r = o[(k + 8 * m) % (8 * m)] * (1 - (f - k)) + o[(k + 1) % (8 * m)] * (f - k);
3986
+ return x * x + z * z <= r * r;
3987
+ };
3988
+ const top = reach([
3989
+ 0,
3990
+ 1,
3991
+ 0
3992
+ ]) - .1;
3993
+ const c = Math.max(.07, Math.min(.12, R / 12));
3994
+ const out = [];
3995
+ const wall = band - PLAYER_H + WALL;
3996
+ const cuts = [lo];
3997
+ for (let a = lo; a < top - 1e-9;) {
3998
+ const shift = a < band - 1e-9 ? FIT[0] : FIT[1];
3999
+ const base = outline(a + .03, 2);
4000
+ let b = Math.min(a === lo && wall < top - .3 ? wall : a + .25, top);
4001
+ while (b < top && b - a < .9 && outline(Math.min(b + .1, top), 2).every((r, k) => Math.abs(r - base[k]) <= shift)) b = Math.min(b + .1, top);
4002
+ a = top - b < .15 ? top : b;
4003
+ cuts.push(a);
4004
+ }
4005
+ const lines = cuts.map((y, k) => outline(k ? y : y + .03, 8));
4006
+ for (let l = 0; l + 1 < cuts.length; l++) {
4007
+ const [a, b] = [cuts[l], cuts[l + 1]];
4008
+ const near = a < band - 1e-9 ? FIT[2] : FIT[3];
4009
+ const n = Math.ceil(Math.min(Math.max(...lines[l]), Math.max(...lines[l + 1])) / c) + 1;
4010
+ const N = 2 * n + 1;
4011
+ const inl = new Uint8Array(N * N);
4012
+ for (let i = 0; i < N; i++) for (let j = 0; j < N; j++) {
4013
+ const [x, z] = [(i - n) * c, (j - n) * c];
4014
+ inl[i + j * N] = within(lines[l], x, z) && within(lines[l + 1], x, z) ? 1 : 0;
4015
+ }
4016
+ const NEAR = Math.max(1, Math.round(near / c));
4017
+ const on = (i, j) => i >= 0 && i < N && j >= 0 && j < N && inl[i + j * N] > 0;
4018
+ const edge = new Uint8Array(N * N);
4019
+ for (let i = 0; i < N; i++) for (let j = 0; j < N; j++) edge[i + j * N] = on(i, j) && !(on(i - 1, j) && on(i + 1, j) && on(i, j - 1) && on(i, j + 1)) ? 1 : 0;
4020
+ const rects = [];
4021
+ const all = new Uint8Array(N);
4022
+ const hop = N > 48 ? 2 : 1;
4023
+ for (let i0 = 0; i0 < N; i0 += hop) {
4024
+ all.fill(1);
4025
+ for (let i1 = i0; i1 < N; i1++) {
4026
+ let any = false;
4027
+ for (let j = 0, from = 0; j <= N; j++) {
4028
+ all[j] = j < N && all[j] && inl[i1 + j * N] ? 1 : 0;
4029
+ if (!all[j]) {
4030
+ if (j - 1 - from >= 2 && i1 - i0 >= 2 && (i1 - i0) % hop === 0) rects.push([
4031
+ i0,
4032
+ from,
4033
+ i1,
4034
+ j - 1
4035
+ ]);
4036
+ any ||= j - 1 > from;
4037
+ from = j + 1;
4038
+ }
4039
+ }
4040
+ if (!any) break;
4041
+ }
4042
+ }
4043
+ const sum = new Int32Array((N + 1) * (N + 1));
4044
+ const count = (i0, j0, i1, j1) => {
4045
+ const [a0, b0, a1, b1] = [
4046
+ Math.max(i0, 0),
4047
+ Math.max(j0, 0),
4048
+ Math.min(i1, N - 1) + 1,
4049
+ Math.min(j1, N - 1) + 1
4042
4050
  ];
4051
+ return sum[a1 + b1 * (N + 1)] - sum[a0 + b1 * (N + 1)] - sum[a1 + b0 * (N + 1)] + sum[a0 + b0 * (N + 1)];
4052
+ };
4053
+ const picked = [];
4054
+ for (let k = 0; k < 40 && rects.length; k++) {
4055
+ for (let j = 0; j < N; j++) for (let i = 0; i < N; i++) sum[i + 1 + (j + 1) * (N + 1)] = edge[i + j * N] + sum[i + (j + 1) * (N + 1)] + sum[i + 1 + j * (N + 1)] - sum[i + j * (N + 1)];
4056
+ let [best, score] = [-1, 0];
4057
+ for (let m = 0; m < rects.length; m++) {
4058
+ const q = rects[m];
4059
+ if (k && !picked.some((p) => q[0] < p[2] && p[0] < q[2] && q[1] < p[3] && p[1] < q[3])) continue;
4060
+ const area = (q[2] - q[0]) * (q[3] - q[1]);
4061
+ const gain = k ? count(q[0] - NEAR, q[1] - NEAR, q[2] + NEAR, q[3] + NEAR) : 2;
4062
+ const v = k ? gain * 1e6 + area : area;
4063
+ if (gain >= 2 && v > score) [best, score] = [m, v];
4064
+ }
4065
+ if (best < 0) break;
4066
+ const [i0, j0, i1, j1] = rects[best];
4067
+ picked.push(rects[best]);
4068
+ for (let i = Math.max(i0 - NEAR, 0); i <= Math.min(i1 + NEAR, N - 1); i++) for (let j = Math.max(j0 - NEAR, 0); j <= Math.min(j1 + NEAR, N - 1); j++) edge[i + j * N] = 0;
4069
+ out.push([
4070
+ (i0 - n) * c,
4071
+ l ? a : foot,
4072
+ (j0 - n) * c,
4073
+ (i1 - n) * c,
4074
+ b,
4075
+ (j1 - n) * c
4076
+ ]);
4043
4077
  }
4044
- const [, cx, cz, p, q, t] = best;
4045
- return Math.min(p, q) < (k ? .25 : 0) ? [] : [[
4046
- cx - p,
4047
- foot,
4048
- cz - q,
4049
- cx + p,
4050
- t,
4051
- cz + q
4052
- ]];
4053
- });
4078
+ }
4079
+ return out;
4080
+ };
4081
+ /** The ground as it is walked on: at()'s 4 m lattice, each square two triangles, as ground() in relief.ts reads it. */
4082
+ var walked = (x, z) => {
4083
+ const [i, j] = [Math.floor(x / 4), Math.floor(z / 4)];
4084
+ const [fu, fv] = [x / 4 - i, z / 4 - j];
4085
+ const h = (u, v) => at$1(4 * (i + u), 4 * (j + v));
4086
+ const [a, d] = [h(0, 0), h(1, 1)];
4087
+ return fu >= fv ? a + (h(1, 0) - a) * fu + (d - h(1, 0)) * fv : a + (h(0, 1) - a) * fv + (d - h(0, 1)) * fu;
4054
4088
  };
4055
4089
  /** A rock of the map: where its middle is over the ground (x, the ground's height, z), its radius, height and seed, and the boxes it collides with (x0, y0, z0, x1, y1, z1), inside what rockOf() draws. */
4056
- var crag = (x, z, R, H, s, deep = 0) => {
4057
- const g = at$1(x, z);
4058
- const y = g + .25 * H;
4090
+ var crag = (x, z, R, H, s) => {
4091
+ const g = walked(x, z);
4092
+ const y = g + rockMid(H);
4093
+ const span = [
4094
+ -3,
4095
+ -2,
4096
+ -1,
4097
+ 0,
4098
+ 1,
4099
+ 2,
4100
+ 3
4101
+ ].map((k) => .4 * R * k);
4102
+ const round = span.map((u) => span.map((v) => walked(x + u, z + v)));
4103
+ const lo = Math.max(Math.min(...round.flat()), g - .55 * H);
4104
+ const band = Math.max(...round.flat()) + PLAYER_H;
4059
4105
  return {
4060
4106
  at: [
4061
4107
  x,
@@ -4065,12 +4111,9 @@ var crag = (x, z, R, H, s, deep = 0) => {
4065
4111
  R,
4066
4112
  H,
4067
4113
  s,
4068
- parts: inside(rockOf(s, R, H), R, -.25 * H).filter((b, k, l) => {
4069
- const gap = Math.max(b[0] - l[0][3], l[0][0] - b[3], b[2] - l[0][5], l[0][2] - b[5]);
4070
- return !k || gap <= 0 || gap > 1.2;
4071
- }).map(([x0, , z0, x1, y1, z1]) => [
4114
+ parts: fitted(rockOf(s, R, H), R, lo - y, band - y, lo - .5 - y).map(([x0, y0, z0, x1, y1, z1]) => [
4072
4115
  x + x0,
4073
- deep,
4116
+ y + y0,
4074
4117
  z + z0,
4075
4118
  x + x1,
4076
4119
  y + y1,
@@ -4081,7 +4124,7 @@ var crag = (x, z, R, H, s, deep = 0) => {
4081
4124
  /** Red's rocks: in the arena the field's stones (as wide as their old box was long, a fifth higher) and the boulders along the walls, then the boulder field's. */
4082
4125
  var CRAGS = {
4083
4126
  arena: [...STONES.map(([x, z, w, d, h], i) => crag(x + w / 2, z + d / 2, .31 * (w + d), 1.15 * h, i + 61)), ...BOULDERS.map(([x, z, r], i) => crag(x, z, r, .8 * r, i))],
4084
- field: FIELD.map(([x, z, r], i) => crag(x, z, r, .75 * r, i + 100, at$1(x, z) - 6))
4127
+ field: FIELD.map(([x, z, r], i) => crag(x, z, r, .75 * r, i + 100))
4085
4128
  };
4086
4129
  var ghosts = (l) => l.flatMap((c) => c.parts).map(([x0, y0, z0, x1, y1, z1]) => ({
4087
4130
  ...box(x0, y0, z0, x1, y1, z1, STONE),
@@ -34,18 +34,18 @@ export declare const MOUND: number, RISE: number;
34
34
  */
35
35
  export declare const FLATS: number[][];
36
36
  type V3 = [number, number, number];
37
+ /** How high a rock's middle is over the ground: three tenths of its height, and 0.6 m or half its height if less. Its widest is there, its flank steep down to the ground: a body is stopped at its foot. */
38
+ export declare const rockMid: (H: number) => number;
37
39
  /**
38
40
  * The form of a boulder of radius R and height H from a seed: how far it reaches from its middle
39
- * (a quarter of its height over the ground) along a unit vector. One to three lobes, each a block
40
- * cut by five leaning planes round it and a nearly level one on top, its corners rounded by an
41
- * ellipsoid: a main mass, a shoulder beside it half as high from 1.3 m of radius, a low one from
42
- * 3.2 m. One plane cuts under a side (an overhang), and the whole swells and shrinks by 6 % with
43
- * the bearing. Only + - * /, Math.sqrt and the hash: the boxes below come from it on every side.
44
- * `tops` are the lobes' middles (x, z) and the height of their top over the rock's middle.
41
+ * (rockMid() over the ground) along a unit vector. A rounded solid, no plane in it:
42
+ * an ellipsoid stretched unevenly on its three axes and turned by the seed, upright under its
43
+ * middle (it stands in the regolith, as wide at the ground as at its middle) and a dome over it, swollen and shrunk by two low octaves
44
+ * of noise with the bearing (large soft lobes), with one gentle hollow and one flatter side. Only
45
+ * + - * /, Math.sqrt and the hash: the boxes below come from it on every side.
45
46
  */
46
47
  export declare const rockOf: (s: number, R: number, H: number) => {
47
48
  reach: (u: V3) => number;
48
- tops: number[][];
49
49
  };
50
50
  /** A pit: PIT_R in radius, cut in a square of half side PIT_S of its crater's terrace, its floor at PIT_FLOOR, 7 m over the kill floor; a flight of PIT_STEPS steps up its east wall. */
51
51
  export declare const PIT_R: number, PIT_S: number, PIT_FLOOR: number, PIT_STEPS: number;
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.119.0",
5
+ "version": "0.120.0",
6
6
  "type": "module",
7
7
  "files": [
8
8
  "dist"