Asset Service

API Documentation mv3d.server.asset.AssetService.

The Asset Service is responsible for answering queries for assets and asset groups along with storing the data for them. It's possible to have an Asset Service that doesn't actually store any data locally and only caches requested assets. This is typically the case with Asset Services that are running on player facing servers.

On the other hand, Asset Services that store data fit into the normal Directory Server model where Directory Servers point to clusters that host each Asset Group. These clusters contain shards which point to Redundant Pools that actually store assets. Asset Groups are actually Clusters.

There are multiple types of Assets which can be used for different purposes. Some Assets point to models, others sounds, and others even point to excutable code. Some of the base types of Assets are:

  • ImageAsset? - Used for storing images.
  • MaterialAsset? - Materials are a combination of texture images and settings or shaders.
  • MeshAsset? - Holds 3D meshes.
  • CodeAsset? - This points to executable code.
  • SoundAsset? - Used for basic sounds such as .ogg files.
  • FileAsset? - A generic Asset type which can point to any other type of file.

In addition to Asset types based on what type of data they point to, there's also types for how the assets are acquired. The most common method of acquiring Assets is by UrlAsset?. This is a subtype of Asset that includes a URL from which the actual data is downloaded from. Assets also contain CRC check data which can be used to verify that the locally downloaded Asset is the most up to date version.

Going up the chain a bit to Asset Groups. There's only one type of Asset Group and generally, one single group is enough to hold all the Assets for a project of pretty much any size. The Asset Group does actually store some data such as a name, description, copyright information. Individual Assets also store similar information.

Typically, when downloading Assets, the client (and server) store them locally user ~/.mv3d. Specifically, there is an Extern directory created there. In that directory are subdirectories for each Asset Group. They are numbered to match up with the ID of the Asset Group. For example, ~/.mv3d/Extern/Group203. Assets within the group can be stored anywhere under that folder or subfolders of it and no two Assets in the same group can have the same filename (including directory).