Game Development Reference
In-Depth Information
youwanttohavecodemorelikethis:
AssetManager.LoadBundle("character/tex", OnAlbedoLoaded);
...
void OnAlbedoLoaded(AssetBundle bundle)
{
Texture2D albedo = (Texture2D)bundle.Load("albedo");
//Do something with albedo
}
2.1.3 Asset Requests
In general, asset download requests can be divided into four categories: blocking
requests, active requests, queued requests, and passive requests.
Blocking requests. Blocking requests are requests for assets which are necessary
for the game to proceed and therefore take the highest priority. While a blocking
request is being processed, the player is looking at a loading screen. An example
ofablockingrequestwouldbeiftheplayerclickedanoptioninamenuandthe
graphics for the next menu have not been loaded yet. The next menu cannot be
displayed until those assets have been downloaded. Subsequent download requests
are therefore blocked until the blocking request has finished.
Active requests. Active requests are requests for assets which have a high priority,
but the absence of these assets is not impeding the game's progress. For example,
in a game lobby with 3D avatars walking around and chatting, the assets for the
players' avatars would be downloaded through active requests. The avatars are
important to this area of the game, but the absence of the avatar assets does not
stop the players from being able to chat while the avatars are downloaded. If an
active download request is made and there are no blocking requests currently being
processed, then the active requests can begin. It's up to the developer whether to
submit all requests simultaneously or to issue them sequentially.
Queued requests. Queued requests are requests for low-priority assets. Queued
requests are often used for loading superfluous props or effects. As the name sug-
gests, queued requests are stored insideofaqueuewhileanyactiverequestsare
being processed. Once all active requests have completed, then the asset manager
begins processing the queue.
Passive requests. Passive requests are downloads for assets that have not yet
been requested by the game code. Passive requests are initiated whenever the
asset manager is sitting idle. Any time that the game is not actively downloading
assets is wasted time, which may show up in a loading screen later, so, until all
Search WWH ::




Custom Search