🗄️ FileKit

Improve loading time with partitioning and file-streaming.

FileKit is an important part of making games on Trail instantly playable. It allows your game to file-stream its assets so that the initial download can be reduced to the absolute minimum and launch as fast as possible. The rest of the assets can then be progressively downloaded while the user is already playing.

FileKit hides all the complexity of downloading and caching assets in the browser so that you can use it in mostly the same way you would when reading files from disk. However, it is still up to you to decide how to partition your game assets and when to download them.

Loading times matter!

Our aim is that users should be able to launch a game within 30 seconds or less. And by launching, we mean a fully interactive experience, not an in-game progress bar.

This is obviously not a trivial thing to achieve, and it depends highly on the particulars of your game. But a good place to start is to make sure that your game can launch without any assets. For example, on Unity games, this means launching an empty scene and making sure those Resources folders are as empty as possible.

Once launched, the game should download only the assets required for the first piece of content shown to the user (the main menu, the tutorial, etc). Afterward, it is a matter of finding good spots to download the rest of the assets as needed (loading screens, queuing for a match, etc).

Feel free to reach out to us, on email or on Discord, and we will be happy to help you out figure out what is the best strategy for your game.

FileKit also helps your game use less RAM

There is a subtle thing that goes on when you compile your game to WebGL (in fact, WebAssembly or asm.js), and that is that the compiler will, by default, handle file-access by emulating the filesystem in memory.

This has some major implications on RAM usage. For your game, it would mean that the entirety of your game's assets would need to be in RAM at all times, and every time the game engine would "load" an asset, it would, in fact, create a new copy, again wasting more RAM.

Considering that current browsers enforce a limit of 2GBs of RAM per tab, relying on the emulated in-memory filesystem is probably not a great idea. But by using FileKit, you can avoid this pitfall and make sure that your game gets as much RAM as possible.


📘

This article is incomplete

We are still working on finishing this article, we're aiming to have it ready by the end of August 2020.

For the time being, feel free to have a look at the relevant references below or reach out to our support or to our developers on Discord.

Updated 28 days ago

🗄️ FileKit


Improve loading time with partitioning and file-streaming.

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.