Resource Contexts

When the contents of the resource model are stored on the hard disk of a PC or on a CDROM, the amount of available memory is relatively flexible when compared to the limited amount of memory on the playback device. Even on an XBOX360, the amount of storage memory greatly exceeds the system memory. You can store seven gigabytes of data on ten CDROMS. An XBOX360 has 512 megabytes of memory. Thus an inherent difference exists between the resources in a storage context and resources in a display context.

While there are numerous variables with respect to context flexibility, the key variables are as follows:

  1. Memory
  2. Processing Power
  3. Rendering Bandwidth

The differences that exist between a storage context resource model and a display context resource model is called the context flexibility differential.

Storage Context

When the resource model exists on a hard disk or CDROM, it is in a storage context. The storage context resource model is basically a template that the display context device uses when it copies the resources into playback device memory and presents them to the user. Unlike the display context, memory is for all intents and purposes unlimited. Processing power and rendering bandwidth are not factors.

Display Context

The display context resource model is created by the display context device at runtime, using the storage context resource model as a template upon which the display context resource model is based. When the resource model exists in playback device memory, it is in a display context. The display context resource model is only a copy of the storage context resource model. Furthermore, due to the context flexibility differential, the display context resource model is probably only a very small subset of the whole storage context resource model, due to hardware limitations in the playback device, and because the user can only play one level at a time.

Resource Transformation

Transformation is the process of loading, activating, and displaying resources. The display context device user agent handles transformation. Transformation is complex, but we here can consider three primary stages: 1.] loading resources, 2.] running a simulation on those resources or with those resources, and 3.] displaying resources. The stages of simulation and display run in a loop, occurring at least once per frame, with intermittent resource load and unload. During the resource load stage, the display context device starts itself and transforms stored resources into memory on the playback device. During simulation, the display context device runs code that handles the simulation, and finally, the display context device displays the resources. These three phases are repeated again and again until the user decides to stop.

During transformation, data from a flexible storage context is copied into an inflexible display context. Remember, a number of common inflexibilities affect the display context. [Memory, processing power, and rendering bandwidth.] If little thought has been given to the design of the resource model, then a large, inflexible data structure has to be squeezed into an inflexible display context. If instead, the resource model has been carefully designed, then the transformation process involves processing flexible data so that it can fit into an inflexible display context. [Not that this process is without its own snags!]

Resource Transformation: Load Stage

During the load stage, the display context device copies resources from the storage context resource model into a display context resource model that resides in system memory on the playback device. As we have discussed, the amount of memory on the playback device is limited, and this difference is called the context flexibility differential. This means that the structure of the storage context resource model is extremely important because the display context device can only copy a limited amount of the storage context resource model into memory. Furthermore, if the storage context resource model consists primarily of monolithic [one piece] data structures, the process of optimizing resource copying via streaming techniques becomes difficult at best.

Resource Transformation: Simulate Stage

Core display context device functions are executed during simulation. Typically this stage begins with display context resource traversal and display context resource selection. Then, physics, collision detection, and artificial intelligence routines are performed for the selected display context resources. User inputs are also processed during the stage. The results of the simulation stage produce changes in the display context resource model. For example, the result of physics processing may cause a player to fall, which changes the position of the player. Or, the results of artificial intelligence processing may cause a resource that represents a non-player to move and fire a weapon. Again, storage context resource structure is extremely important because performance suffers if the simulation has to consider a significant quantity of unnecessary resources during this phase. This means long load times and precipitous performance penalties as huge quantities of data are copied in and out of playback device memory.

Resource Transformation: Display Stage

Last, the display context resource model is displayed through a process called rendering. The rendering process involves clipping polygons to the screen, calculating gradients, and finally, rasterization. The simulation and display stages run in a loop that occurs once per frame. This stage is probably most affected by the storage context resource structure. If the display context device is unable to create an optimal rendering list from the display context resource model, the frame rate drops. Remember, although the display context device doesn't render the storage context resource model, the display context resource model is a copy of the storage context resource model. The quality of the storage context resource model has a direct, absolute effect on the entire presentation process.

Conclusion

Since you can have any number of resources with any level of granularity, careful design of the resource model is important. In the next section, we'll continue to examine the resource model and introduce methods for resource design and quality analysis.