MCPcopy Create free account
hub / github.com/dailydotdev/apps / createWorldEngine

Function createWorldEngine

packages/webapp/components/world/engine/world.js:41–10742  ·  view source on GitHub ↗
(options)

Source from the content-addressed store, hash-verified

39 one world would, and there is only ever one world on a page.
40 ========================================================================== */
41export function createWorldEngine(options) {
42const { container, onState, lite } = options;
43
44/* ============================================================= the two tiers
45 A phone is not a small desktop. It has a tile-based GPU with a fraction of
46 the bandwidth, a screen with three times the pixels per CSS unit, and a
47 thermal budget that a frame costing three passes over the scene will spend
48 in about ninety seconds — after which the whole device is throttled, not
49 just this page.
50
51 So `lite` is one decision, taken by the page before this engine exists (it
52 configures a WebGL context, which cannot be reconfigured afterwards), and it
53 is spent in exactly two places: the resolution the frame is drawn at, and
54 how many times the scene is drawn for it. Nothing about the WORLD changes —
55 the same land, the same buildings, the same look. */
56const LITE = !!lite;
57/* 2 is already a cap rather than the truth: a modern phone reports 3, and the
58 difference between 2 and 3 is invisible at arm's length and 2.25x the
59 fragments. On a handheld the same argument keeps going down one more step. */
60const dprCap = () => Math.min(devicePixelRatio, LITE ? 1.5 : 2);
61
62/* ============================================================================
63 THE ART, and what it is arguing.
64
65 The GROWTH machinery is the first pass's and is untouched, because it was
66 never the part that was wrong:
67
68 1. A district is NOT one building that gets taller. It is a PLACE that gets
69 bigger, busier and better tended. Land area is the attention channel —
70 "the more I read, the more land, the more life". Height is a supporting
71 voice, not the melody.
72 2. Twelve levels, not five. A five-level ladder saturates hard on real data
73 (a four-year veteran reads a wall of 23 citadels), so the top of it
74 carries no information. Twelve steps keep separating people all the way up.
75 3. Everything is generated from (niche, level) — no models, no textures, no
76 network. Two knobs, and the whole place re-composes.
77
78 What the second pass changed is the LOOK. The first derived every realm's
79 materials from daily.dev tokens by mixing, which kept the palette on-brand
80 and made all six realms siblings of the same pastel family. The concept art
81 per realm says something louder — each realm is its own WORLD, with its own
82 light, its own rock and its own weather:
83
84 4. REALM MATERIALS COME FROM THE CONCEPT ART (`C` in taxonomy), not from
85 token mixes. DISTRICT ACCENTS STAY ON TOKENS: the realm is the place, the
86 district is the subject, and the subject is daily.dev's. Brand rides the
87 accent — lodestone band, roof trim, lamps, banners — where it is legible
88 and where it does not fight the light.
89 5. THE UNDERSIDE IS REALM IDENTITY. Every island floats, and in every concept
90 image the bottom is the tell: crystal, wrapped roots, basalt columns, wet
91 crag, icicles, clay. One keel cone for all six threw that away.
92 6. EVERY REALM GETS A LANDFORM, standing at L1 before a single building is.
93 Three realms used to have terrain of their own and three had only props,
94 which left half the set unreadable until L3.
95 ==========================================================================*/
96
97/* ---------------------------------------------------------------- helpers */
98const clamp=(v,a,b)=>v<a?a:v>b?b:v;

Callers 1

WorldViewFunction · 0.90

Calls 15

lookFromPresetFunction · 0.90
mixTokFunction · 0.90
$Function · 0.85
dprCapFunction · 0.85
paintSkyFunction · 0.85
postLampFunction · 0.85
handReleaseFunction · 0.85
handArmFunction · 0.85
unpossessFunction · 0.85
pickFunction · 0.85
pinchStepFunction · 0.85
clampTargetFunction · 0.85

Tested by

no test coverage detected