2/22/2008

the protoDbMgr is almost here...

Photobucket


The 'protoDbMgr', the latest concoction, is capable of saving the basic attributes of Sprite instances via a combination of a shelf for storing complex data conveniently and a buzhug database for sorting data in large populations. The buzhug db, however is limited as far as to what types of data can be stored.

To 'convert' the Sprite instance into a format that can be inserted into the database, the shadowSprite class copies all the attributes of interest from a Sprite. The dbMgr can then take those formatted attributes and insert them into the database. Similarly, records can be read by shadowSprites and then the data may be initialized into a new Sprite (or other class) instance.

The shelf is responsible at this point for retaining the id numbers of the objects as the value to the game_id key of the object. The databases can be nested, so it is important to have a global dict of the ids of the objects (though this is not fully implemented yet).

So far, the protoDbMgr is capable of:
  • creating unique databases, referenced by a name (and path)
  • adding, updating, sorting, and deleting of records
  • storing and retrieving groups of Sprites (can filter arbitrarily)
Eventually, the dbMgr will hopefully be able to store and load complex Sprites, with attached children, etc. This is why each db has its own directory but there is only one rec_ids dict. That way, all the objects can be accounted for and accessed easily, but at the same time be nested using record fields that reference other dbs.

No comments:

Blog Archive