If you find this article contains errors or problems rendering it unreadable (missing images or files, mangled code, improper text formatting, etc) please contact the editor so corrections can be made. Thank you for helping us improve this resource
© 2000 - Zachary Booth Simpson. Copied with permission from http://www.mine-control.com/zack. If you find any of this work useful, please sign Zack's guest book: http://www.mine-cont...i/gbook-zbs.cgi. Intent
Render the visible Models given a P.O.V. Problem
Renderers are often the most custom part of any game; they often define the game''s technology and determine the envelope of design. Thus, not surprisingly, extreme optimizations are common often at the expense of organization or maintainability. Solution
The View reads the Model Database via a Spatial Index but does not modify either. Thus, typically: Structure
The communication between a Spatial Index and a View is often the determining factor in game performance and deserves great attention. Not uncommonly, the spatial index and the view are so intimately related that the index is considered View code. However, one may argue that a spatial index more properly belongs in the model domain due to its read-write status. (See Spatial Index – Implementation.)
- Model is read-only by View.
- Spatial Index is read-only by View.
- View is invisible to Model and Spatial Index.
Most View implementations translate a model "state" into an "appearance". For example, a model instance "orc1" is de-referenced and is found to be type==ORC_TYPE and frame==10. The View then finds an artwork pointer via type and frame and draws.
The translation from "state" to "appearance" often has exceptions which clot the render code. (See Render Delegation and Appearance Map.)
There are frequently more than one View implementation per game. For example, there may be a custom rear-view mirror in a driving game, or an overhead-view mini-map in a strategy game. However, there is usually one View implementation which predominates.
None at this time. Examples
None at this time. Issues and Risks
None at this time. Related Patterns
Views renders Models that it looked-up in the Model Database via a Spatial Index.
Views often derive artwork pointers from a Type Database.
Views may choose to defer customized drawing via Render Delegation.
Views may translate a model''s state to its appearance via an Appearance Map.
Note: Please offer only positive
comments - we are looking to promote a positive atmosphere where collaboration is valued above all else.