NFSU.cc / Guides

Hosting a 2 GB PC game on Cloudflare R2: 32 MB to the main menu

A hard drive answers a read in a few milliseconds; a server far away answers in tens. The game does not know the difference, and it reads a lot. Three things make that work over the internet.

Driving through Olympic City after the game finished loading
The first visit downloads only what the game reads; the rest waits until you drive there.

The whole game, music included

The public pack is about 2 GB: the recompiled program, the game's data, every licensed song and the movies. Nothing is cut. The program, speed.wasm, is 70 MB and travels as 11.1 MB of brotli. A cold first visit reaches the game's main menu after 32.6 MB in 108 requests; tracks and cars arrive when the game asks for them.

Where it is hosted

Why it loads fast

The loader is host/files.c and the pieces are cut by tools/data_chunks.py. To see the result, open the game.

In the repo: host/files.c · tools/build_public.py · tools/data_chunks.py · docs/re/hosting.md

More guides