PDA

View Full Version : Client database



Bidmaron
December 28th, 2010, 03:43
What happens if code running on a client machine updates the database? Does it actually reach back to the host's database? Does the client have his own database (or just the cache)? Does the answer vary if the user is in local character mode?

Also, what happens on a client machine when a module is updated in code running on that machine? Does the module.xml get changed? This might vary again depending on whether the module is host, client, or shared, I suppose.

Moon Wizard
January 5th, 2011, 20:45
Here are the answers off the top of my head. If you have a detailed question about a specific part, I can look it up in the code.

* The host owns the master copy of the database.
* Any "shared" data is duplicated to any clients to which the data has been shared. (i.e. holder tag in database)
* Any "owned" data can be updated by the client; otherwise, the client has no access to change data.
* You can get race conditions if the host and the client attempt to update the same data at the same time.

* The client has its own copy of the database that receives updates from the host, or sends updates to the host if those nodes are owned and updated locally.

* In local mode, I believe that the client acts more like a host with regards to the database; but I'm a little fuzzier here.
* In local mode, the database hierarchy is currently different. (i.e. charsheet becomes the root.) This is something I want to change as it creates issues for ruleset developers.

* As far as I am aware, modules can not be owned on the client, thus they can not be edited by the client.
* Client and Common module data can not be edited.
* Host module data can be edited on the host, and the difference files are stored in the campaign directory as XML.

Hope that helps,
JPG

Bidmaron
January 8th, 2011, 08:36
Well, I have to disagree with your last points, as I am currently having the host edit a client.xml file successfully. It really blows that the client code can't update a client module, as my little external interapplication communication program was hoping to use that technique to perform events outside fg2. Since the cache is a private file format, I am going to have a heck of a time having things occur on the client's machine. I think I know how to work around this, but, man, it shouldn't have to be so hard....

Zeus
January 8th, 2011, 11:44
I agree with moon on this one Bidmaron, client.xml can not be edited directly by the host as module data is tagged as read only, this unless you have changed the module functionality in the ruleset your working on.

Changes made to modules by the host are usually stored in a module state file (XML) in the campaign/moduledb folder, whenever a module is opened I believe FGII checks for the state file first and applies changes as necessary. The XML within the module client.xml remains intact and unchanged.

Clients cannot edit module data, again as its tagged read only.

You need to be careful when applying changes on a client to the database on nodes that the client doesn't own as you will likely break the integrity of the database and crash FGII. I hit this when writing the 4E Three Dragon Ante prototype. You need to write an internal message passing system to get clients to request the host to make changes and for the host to perform the updates.

I am curious as to what the application your coding will do that requires the clients to update the database directly.