PDA

View Full Version : Extention to add onto a campaign



tdewitt274
January 11th, 2011, 14:25
Hello All!

I was wondering if someone could point me in the right direction. I'm working on an Extention and I'm not sure how or if the approach I'm thinking of will work. The Extention itself is for Cards, but I'd like to keep it generic enough that it can be used for other things.

First, the basics. The Extention is an add-on game to any existing campaign. I'd like to be able to maintain it from session to session, as well as being able to scrap, or quit, the game and start a new one. However, be flexible enough to have multiple games available (ex, Poker and Runes). The game should contain itself within that campaign.

Looking at a couple of dbs, I think that it would be possible to contain the game within it's own "game" tag at the root of the XML db. Within the "game" tag it would contain references for players, the settings of the game, the "objects" it contains, as well as a new version of a combat tracker that works with the game.

I have a semi-working version using Lua Tables, but found that the tables are not able to be shared with the clients (yeah, stupid mistake ;)). But, in the long run, I have the structure thought out that, in theory, should work.

I'm starting to understand scripting, and I understand XML, but I don't know how to merge the two together. So, if someone can point me to another reference, preferably in a Ruleset, that could help me with the above I would be greatful! If anyone can suggest how set up an effective XML db for FG2, this would be appreciated as well.

Thanks in advance!

Moon Wizard
January 11th, 2011, 19:19
The 4E ruleset uses the database to store information on options. The options node in the database is shared with all the players, as they log in. This only works for GM controlled options, as client options are saved locally in the campaign registry. (see next paragraph)

One consideration is that the client can only make changes to the database sections that they own. In a card game scenario, you probably want to make changes to the game state, as well as have the database track who has which cards, etc. Since changing ownership of nodes on the fly turns out to be hard to manage, I found it easier to implement message passing. When the client wants to perform an action that modifies the database, it sends a special message to the host, and the host actually makes the modification to update the database, which will then update on the player's screen.

You may also want to shoot DrZ a note, since he developed a card game within the 4E ruleset. However, we couldn't get the publisher to let us make it available. (i.e. Wizards, not surprisingly)

Cheers,
JPG

Zeus
January 11th, 2011, 19:45
Happy to help if I can. As per moon's comments regarding database node ownership, client update and a client/server messaging framework, that's pretty much the approach I took.

I wrote a couple of simple message passing routines (using the messaging in 4E as a framework) and a handler and then used this when I needed the database to be updated as a result of a client action (e.g draw a card from the deck).

With regards to embedding LUA script in windowclass, controls or global packages, for FGII its relatively simple, take a look here (https://www.fantasygrounds.com/modguide/scripting.xcp#Using%20scripts) for a guide on how to reference/embed script blocks from within FGII's XML API. In addition, opening up any FGII ruleset (4E is good one) and examining any of the XML files will help get you started.

With regards to an extension using the campaign's db.xml to maintain state between sessions, your welcome to take a look at the Partysheet extension I wrote for the 4E ruleset (see my sig for a link to the resource site with the extensions). It creates two new root level nodes <partysheet> and <partysheet_props>, the former is used to store all party information and is the datasource for the main Partysheet and its associated subwindows, tabs and lists. The latter is used to maintain simple version information and constants.

tdewitt274
January 15th, 2011, 14:33
Haven't had a chance to really dig into this until now. Thanks for the info!


Since changing ownership of nodes on the fly turns out to be hard to manage,
I may not be opposed to this method, if it works. Since a person will be a dealer for some time period, I'm wondering if this method may have some usefulness. The game nodes can be handed over to the person that is the dealer with the ability for the host to take it back. Of course, having the message passing would be important as well.


I found it easier to implement message passing.
Do you have an example of this that I can reference?

Thanks again!

tdewitt274
January 15th, 2011, 14:39
Happy to help if I can.
You've done some great work for the community, but I've never really had a chance to look into the code. The "Lua code inspiration" just hit me recently, so I'm still waiting for the "Lua and XML inspiration" to strike ;) Any help is always appreciated!


I wrote a couple of simple message passing routines (using the messaging in 4E as a framework) and a handler and then used this when I needed the database to be updated as a result of a client action (e.g draw a card from the deck).
Can you give references to where this was done? I'm trying to keep it independant of the ruleset, so would all this need to be brought into the Extention?


With regards to embedding LUA script in windowclass, controls or global packages, for FGII its relatively simple, take a look here (https://www.fantasygrounds.com/modguide/scripting.xcp#Using%20scripts) ...
I've always had a problem learning something if there aren't examples. I'm sure the Library is well documented, but I need to see something "in action" for it to really click. Maybe a suggestion for future updates?


your welcome to take a look at the Partysheet extension I wrote for the 4E ruleset
Wow! That one's a monster! I'll have to wade through it.

Thanks again!