How Resources Work

MV3D has a concept of a resource. This can be any asset for the game. Some types of resources currently in use are:

  • Images
  • 3D Models
  • Sounds
  • Extra programming for objects

In addition to the different types of assets, there are also different ways of acquiring them. The only currently supported methods are HTTP download and loading on the local file system. In the future, other methods will be available such as SVN repositories, FTP, or SCP. All of the assets are organized into groups. Each group has a unique ID and each asset has an ID that is unique within its group. This follows the general basis for IDs in MV3D. Combining the group id with the asset id, we get a way of specifying a single asset. These IDs are expressed in the form of a tuple: (1, 23). That would specify asset #23 in asset group #1. MV3D's directory service is in charge of nowing which servers host a given asset group.

When a server requests an asset from a group that it does not host, it contacts its directory service (usually on a remote server). The directory service tells it which server hosts that asset group. The server can then contact the host of the asset group directly to query it for the asset. At this point, the asset here is just an object containing instructions on how to obtain the actual asset data it references. For an asset available via HTTP, it would include the URL for instance, and the acquire method would use some sort of HTTP client to retrieve the asset.

With the exception of local file assets, others are downloaded to a path within the "Extern" directory. Under this directory is a subdirectory for each asset group. Individual assets download their files in there, but have control over subdirectories of the group directory. All assets within a group must have unique downloaded filenames. In the future, MV3D may handle file names internally to prevent this from being an issue. The Extern directory can be deleted at any time MV3D is not running to clear up space or to force assets to be redownloaded.

Clients request assets from their configured asset server. This will likely change to requesting from their connected player server so that permissions can be applied to assets. The client downloads assets for things that are within its view range as soon as they enter its view range. When connecting for the first time (or after clearing the Extern directory), assets are downloaded before the player is given a view of the world.