Been pondering the data design for my little test app… thinking about running with a relational database (prolly MySQL) to handle “relationships” between objects, then switching to XML docs for detail data.
For example, there might be three tables, say Characters, Equipment, and Holders, in the database, with the following structures:
|CharID||int*||Primary Key for character|
|AcctID||int||Account ID, identifies owning player account|
|XMLPath||string||Full path to XML doc describing character|
|ItemID||int*||Primary Key for item|
|HolderID||int||identifies current holder/location|
|XMLPath||string||Full path to XML doc describing item|
|HolderID||int*||Primary Key for item|
|HolderType||int||identifies type of holder: Character (held/worn), Item (container), etc.|
|RefID||int||relates back to Character or Item table, based on above|
This is hardly a final version of anything… not sure I want to handle containers this way, just trying to step through the thought process. Anyway, the XML docs referenced would have all the detail info about the character (attributes, etc.) or the item (encumbrance, properties, etc.), which might work better for OOP, while the relational DB framework does its thing by allowing relatively quick access via query to who is holding what.
That makes it easy to adjust details about how equipment is described, for example. If I need to add an element, I just do so in the appropriate subset of files… no potentially messy table updates, and if I happen to miss one, no major errors (tho I’ll need to be sure of default values to fall back on occasionally, I’d imagine)…
That’s the basic concept at least… not sure how well it would scale, amongst other concerns.
Given the fact that this is an after-hours solo endeavor at present, I really don’t want to spend the effort (and probably cash) that would be necessary to get an Object Database up and running as suggested by Ben Zeigler in a post earlier this year at his blog (mainly because I’ve never used one before)… otherwise, that would be my first choice for the way to go, I think. (A good overview of some of the challenges of “translating” between OOP and RDB structures was recently referred to by this TerraNova post.)
I’ll probably give it a try, at least, see how it flies (or flops)…