Ruleset Modeling Language - Discussions
September 07, 2010, 01:03:58 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: The new website and forum are up.  Beware that they are still teething however.
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Databases  (Read 223 times)
Cayle
Not Normal
Administrator
Hero Member
*****
Offline Offline

Posts: 2042



View Profile WWW
« on: January 21, 2009, 12:36:01 AM »

Up until now, I've pretty much ignored databases in the development of Angela.  Even if you have thousands of templates, the table structure is simple enough that a python dict will do the job in finding what you need.  With entities, things get more complex.  I see two separate issues:

1 - Templates are static and need not be persistent across resets.  We can just re-read from the XML file on server start.  Entities do get changed from their initial state and do need to be saved to a DB.  That state should constantly be kept updated.

2 -  Transactional data regarding entity updates should probably stored in its own DB table (or tables) along with metadata about the parent action, subject agent, controllers, etc.  This way, if you have crystal reports or something similar - or know how to wield pivot tables in Excel - you can extract daily reports (good for GMs to peruse; especially for identifying exploits) or data mine the world to see what is actually happening


Both of these scenarios are shown in the sequence diagram in EntityUpdate.pdf.  The general idea is that whenever an entity change is made, the changing method drops a fire and forget message into two queue objects.  One updates the persistent database version of the entity repo, which also contains persistent entities that are not currently logged in.  The other goes to the queue for tracking changes. 

I have an interesting quandary with entities.  Specifically, entities can freely take other entities in as members.  Currently, if I want to see if an orc is carrying a goldCoin object, I'd use the getMemberEntiesByType() method on the orc (he is an Entity object).  If I wanted simply to know whether he had a gold coin directly in his endocontainer inventory, I'd iterate over the things in his inventory (i.e. member entities) and take a peek at their parent meme IDs.  Now if we set drillDown = True, we are telling getMemberEntiesByType() to look inside the inventories of all of those objects and so forth.  Can this be done better and faster using SQL trickery?  If this is so, how should we do it?
Logged

The Ruleset Modeling Language - A project for making it easier to design virtual worlds.
Edward
Project Angela Team
Sr. Member
***
Offline Offline

Posts: 443


View Profile
« Reply #1 on: January 21, 2009, 02:11:40 AM »

Both of these scenarios are shown in the sequence diagram in EntityUpdate.pdf. 

Could you provide a link?
Logged
Cayle
Not Normal
Administrator
Hero Member
*****
Offline Offline

Posts: 2042



View Profile WWW
« Reply #2 on: January 21, 2009, 02:53:46 AM »

oops!  my bad  Lips sealed

It is attached.  In addition, EntityMemberSearch.pdf shows the possible outline of an approach calling on the DB to find all of the coins on an orc with drilldown turned on.
Logged

The Ruleset Modeling Language - A project for making it easier to design virtual worlds.
technikhil
Have Posted
*
Offline Offline

Posts: 5


View Profile WWW
« Reply #3 on: January 27, 2009, 04:38:04 AM »

Hi David,
   I haven't finished reading through the entire spec draft yet but one challenge would be representing recursive entities in teh database - the challenge would not be so much storing the structure but retrieving it in a performant manner - you might want to look into a memory cache or object stores. I will find some links - Lucene is one that comes immediately to mind.
Logged
Cayle
Not Normal
Administrator
Hero Member
*****
Offline Offline

Posts: 2042



View Profile WWW
« Reply #4 on: January 28, 2009, 10:56:56 PM »

I split my long post from last night off onto a seperate topic as it was OT and worthy of its own dicussion.
Logged

The Ruleset Modeling Language - A project for making it easier to design virtual worlds.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!