Container hierarchy example


Here is an example of a small container hierarchy (not complete).  Each node represents an object instance (not a class).  The class of each object is shown in parenthesis beneath the object name.

In this example the world consists of two areas - the pub and the hotel.  The pub contains two squares (or Places).  The first one is empty, but the second one (2@3) contains two objects - Joe and a bottle.  Joe is wearing a helmet and boots, and holding a Sword.

There is more to this than meets the eye, though.  Joe is controlled by Jochen, a player account.  Thus Jochen is logged on right now somewhere, and controlling Joe via a client program.  The sword that Joe is holding is in fact possessed!  It has a Soul!  It is controlled by me (that's why my account is a child of the sword)!  Julio also has an account, but he is not logged on - that's why his character Ronaldo is in the PCStorage waiting for Julio to log on.

In order for the world to keep track of all accounts and who is doing what right now it maintains an explicit index pointing out all the accounts (hence the blue arrows, showing that the relationship has nothing to do with the container hierarchy).


Henrik Kniberg

Last updated: