What it does
The loading page (@nanoforge-dev/loader-website) is what players see while the game loads. The
client loader serves it at /. It downloads the game files into a cache in the
browser, so the next visit downloads only what changed, then starts the game.
Loading steps
The text under the logo shows the current step:- Fetching manifest: it asks
/manifestfor the list of files, with their hash and size. - Cleaning cache game files: on the first visit (or after you clear the site’s data), it empties the cache.
- Verifying application integrity: it compares each file with the cached copy. Files no longer in the list are removed from the cache.
- Download n / total: [file]: it downloads only the new or changed files, with a progress bar.
- It imports
main.jsfrom the cache and fetches/env. - Starting game: it calls the
mainfunction ofmain.js, then fades the loading screen out.
What your client’s main receives
The loading page calls themain export of the client’s main.js with one object:
The
main.ts that nf new generates passes this object to app.init, so you rarely read it
yourself.
Secure context
The cache uses the browser’s Origin Private File System, which only works in a secure context:http://localhost:3000works;http://192.168.1.20:3000orhttp://my-server:3000does not;- any
https://address works.