Drawing and Updating in the 2D Iso Client

The client maintains a collection of entities, which have relationships between each other (all entities have a 'parent', containers have a list of children). This collection is updated by some mechanism as the player moves, etc.

Every entity has a bounding box (in 3D); now for every entity, we can calculate the projection of this bounding box onto the 2D viewing plane. The projection is a hexagon, with lots of regular features; eg the slope of all the edges is fixed by the isometric view ratio (eg 1:1 or 2:1), etc. Basically these regular features can be exploited for speed :)

Fundamentally, when we want to update an area of the screen, we test the projected bounding hexagons of entities against the area to update; if they overlap, we draw that entity. Furthermore, we can store the projected hexagons, so these do not need to be recalculated each frame. A variety of structures COULD be used to accelerate the overlap-testing process, but these are not required.

Where an entity is a container, when it is drawn we can first check the bounding boxes of each child, and draw them if necessary. Actually the testing process should be seperated, so that at some stage we have a list of all the entities we need to draw to update the area, with all containers broken down into their children. This is done for the following step, ordering.

Whenever the projected hexagons of two entities overlap, we can define an ordering relation between them. Basically we calculate which is drawn first, using some depth-calculation algorithm. Again, this informaton does not need to be re-calculated every frame, it can (OPTIONALLY) be stored in some structure. There is an assumption that between two 'atomic' entities (i.e an entity drawn by a simple image), then this will produce the correct result. (I.e two pixel images can never partially cover each other, which requires some kind of per-pixel algorithm)

This ordering process will build a temporary structure (probably a linked list) which express the order in which the entities must be draw; at this point we can then use the information in the entity to draw it; this will usually mean blitting an image, but might mean drawing some textured terrain.

James Turner