Expand description
The ResourceSystem
provides standardized interface to load data asynchronously from various
filesystem, and some utilities for modules to implement their own local resource management.
To understand how to properly manage data in crayon, its important to understand how crayon identifies and serializes data. The first key point is the distinction between _asset_s and _resource_s.
Asset
An asset is a file on disk, such like textures, 3D models, or audio clips. Since assets might be be modified by artiest continuous, its usually stored in formats which could producing and editing by authoring tools directly. Its always trival and error-prone to load and managet assets directly at runtime.
Resource
A resource is a abstraction of some piece of data
that are fully prepared for using at runtime.
We are providing a command line tool crayon-cli that
automatically compiles assets into resources for runtime.
UUID
An asset can produces multiple resources eventually. For example, FBX
file can have multiple
models, and it can also contains a spatial description of objects. For every resource that an
asset might produces, a universal-uniqued id (UUID) is assigned to it. UUIDs are stored in .meta
files. These .meta files are generated when crayon-cli first imports an asset, and are stored
in the same directory as the asset.
Virtual Filesystem (VFS)
The ResourceSystem
allows load data asynchronously from web servers, the local host
filesystem, or other places if extended by pluggable VFS
.
The VFS
trait has a pretty simple interface, since it should focus on games that load
data asynchronously. A trival Directory
is provided to supports local host filesystem.
And it should be easy to add features like compression and encrpytion.
Manifest
Every VFS should have a Manifest
file which could be used to locate resources in actual path
from general UUID or readable identifier. The Manifest
file is generated after the build
process of crayon-cli
.
Modules
Structs
Functions
Request
object immediatedly,
its user’s responsibility to store the object and frequently check it for completion.Request
object immediatedly,
its user’s responsibility to store the object and frequently check it for completion.