PDA

View Full Version : Modifying the CoreRPG ruleset



Trenloe
March 10th, 2014, 15:56
This thread is a place to put info regarding modifications to the Fantasy Grounds (FG) 3.0 CoreRPG ruleset. It's not meant to be a step-by-step guide, but a resource for people to get info that *might* help them get started on modifying a ruleset or answer some questions they may have, or give info they may never have known.

As always, the guides in the library section of the FG site are good places to start:

Ruleset modification guide: https://www.fantasygrounds.com/modguide/
Anatomy of a ruleset : https://www.fantasygrounds.com/filelibrary/community/Anatomy_of_a_Ruleset.pdf A bit dated now, but a lot of things are still relevant.
Ruleset Reference: https://www.fantasygrounds.com/refdoc/


Always keep in mind that your best resource for examples is the ruleset itself! If you see something in your game that you think "wouldn't something similar be cool in window XYZ" then look in the ruleset how the functionality is coded and see about using that code for your modification.

Note: This thread freqently refers to the <FG App Data Folder> - this is a directory on your hard drive where Fantasy Grounds stores all of its data. It can be reached by clicking the "Open data folder" icon in the top right of the main FG startup screen (above the version number).

A few steps to do before getting started:
Get the CoreRPG.pak file from the Fantasy Grounds <FG App Data Directory>\rulesets directory. Rename to .zip and extract to the same directory (<FG App Data Directory>\rulesets directory) so that you have a CoreRPG directory. Rename this to something like CoreRPG_DEV. This will allow you to create a new campaign, with the ruleset name CoreRPG_DEV and so you can modify the files in this ruleset and test, without impacting the normal CoreRPG rules. Do not leave the directory called CoreRPG as this will result in you still using this folder even after future updates to Fantasy Grounds.
If you don't already have a preferred good text editor (that includes syntax highlighting for XML and LUA, and has a find in files function) download Notepad++ (free) and add the XML plugin: https://notepad-plus-plus.org/ You can use this for modifying both XML and LUA files - and check the XML syntax with the XML plugin. Also, "Find in Files" is your friend for working out where things are in the ruleset.
Have a look at the Ruleset Modification Guide - available in the Developer Guides section of the Wiki: https://www.fantasygrounds.com/wiki/index.php/Developer_Guides.
Check some of the XML resources mentioned in the FG library: https://www.fantasygrounds.com/modguide/introduction.xcp
Check the LUA resources too: https://www.fantasygrounds.com/modguide/scripting.xcp


Many links provided in the developer guide Wiki page: https://www.fantasygrounds.com/wiki/index.php/Developer_Guide

Whichever text editor you use, make sure you utilise "find in files" all of the time, for the whole of the ruleset directory - this is your best way to find all references to specific functionality and to find XML template definitions that are being used. FG XML definitions frequently use nested templates, so make sure you search for all definitions within the ruleset to discover what they are actually defining!

Directly modifying a CoreRPG_DEV ruleset as mentioned in point 1 above is a "quick-and-dirty" way to change code. In the long run, you'll want to package your changes as an extension or layered ruleset - so keep track of all of the files you modify so you can put these in an extension once complete. You can usually work out which files you modify by the date changed timestamp in your operating system File Explorer.

Also - it is a good idea to comment any modifications you make in the XML or LUA files - so you know what changes you have made from the base code and why. Just a simple "Modified for XYZ" is a good start.

Additional details on actions (dice rolls) here: https://www.fantasygrounds.com/forums/showthread.php?35531-Fantasy-Grounds-v3-X-CoreRPG-based-Actions-(dice-rolling)

Trenloe
March 10th, 2014, 15:56
A few pointers where "stuff" is in the ruleset. This is the high level directories - most contain XML files (usually GUI objects and their layout) and associated LUA scripts in the underlying \scripts directory :

campaign - XML and LUA to do with the campaign side of things, i.e. Characters, Story, Maps & Images, NPCs, Encounters, Items, parcels, tables, etc.. Basically, the main icons along the right side of the FG desktop. The record_char_XXX.xml files contain the definitions for the PC character sheets: record_char.xml is the top level and record_char_main.xml, record_char_inventory.xml and record_char_notes.xml define the individual tabs (subwindows).
common - commonly used template and scripts. Buttons, lists, toolbars, etc..
ct - the Combat Tracker.
desktop - stuff that is on the desktop: chat window, dice tower, modifier stack, etc.
graphics - all of the graphics used within the ruleset.
ps - the Party Sheet.
ref - XML and LUA to do with the library reference (displaying library modules) and the different windows that can be displayed for library reference entries.
scripts - data_common.lua (contains a lot of 3.5E and Pathfinder relevant data - like skills, effects, abilities, conditions, energy types, immune types, damage types, bonus types, etc., etc.). Also has "manager" scripts - the main code that handles specific functionality within FG - like damage, attacks, initiative, exporting, spells, targeting, etc., etc..
strings - The string resources that are used throughout Fantasy Grounds. These files help to facilitate translations of Fantasy Grounds.
utility - basically the "stuff" hanging off the small grey icons in the top right of the FG desktop - calendar, character list, effects list, tokens, modifiers, options, exporting.

Trenloe
March 10th, 2014, 15:56
Custom Dice Rolling and/or Actions

See how to create custom actions (the main background process used by CoreRPG for rolling dice and other processes) here: https://www.fantasygrounds.com/forums/showthread.php?35531-Fantasy-Grounds-v3-X-CoreRPG-based-Actions-(dice-rolling)


LUA resources

A good beginners guide to LUA programming: https://www.amazon.com/Beginning-Lua-Programming-Kurt-Jung/dp/0470069171

Nickademus
March 10th, 2014, 16:59
Yesterday you linked to a post containing information on ruleset layering (https://www.fantasygrounds.com/forums/showthread.php?19530-Ruleset-layering-summary) that I didn't see in your posts. Might want to splice it in until we get official documentation on merging.

Good stuff by the way. Feel free to delete this post to make room for more.

Blacky
March 10th, 2014, 17:29
Too bad this seems to be about (or will be about) modifying CoreRPG. Unless very specific needs and knowledge, most things should be done via the new layering/cascading capability aren't they? Or will that go into placeholder 2 ? :)

Trenloe
March 10th, 2014, 17:33
Too bad this seems to be about (or will be about) modifying CoreRPG. Unless very specific needs and knowledge, most things should be done via the new layering/cascading capability aren't they? Or will that go into placeholder 2 ? :)
I haven't yet decided exactly what will be included in this thread (if at all) as it is meant to be a "get started modifying a ruleset" primer. I do mention in post #1:


Directly modifying a CoreRPG_DEV ruleset as mentioned in point 1 above is a "quick-and-dirty" way to change code. In the long run, you'll want to package your changes as an extension or layered ruleset
I think most people who are new to ruleset modification struggle with the extension/layering concept, so for initial minor changes/playing around I think changes directly in the ruleset are a good way to get going and avoid confusion. Once the budding ruleset modifier/developer gets more familar with the ruleset layout they can think about taking the next step and making their changes as part of an extension or layered ruleset.

Bidmaron
March 11th, 2014, 00:36
Seems like this should be sticky'd.

damned
March 29th, 2015, 12:54
Too bad this seems to be about (or will be about) modifying CoreRPG. Unless very specific needs and knowledge, most things should be done via the new layering/cascading capability aren't they? Or will that go into placeholder 2 ? :)


I haven't yet decided exactly what will be included in this thread (if at all) as it is meant to be a "get started modifying a ruleset" primer. I do mention in post #1:


I think most people who are new to ruleset modification struggle with the extension/layering concept, so for initial minor changes/playing around I think changes directly in the ruleset are a good way to get going and avoid confusion. Once the budding ruleset modifier/developer gets more familar with the ruleset layout they can think about taking the next step and making their changes as part of an extension or layered ruleset.

So there are advantages to modifying CoreRPG and not building an extension or layered ruleset. The biggest advantage is that changes to CoreRPG cant break your new ruleset as its a new fork.
Otherwise - yeah Id go with an Extension or Layered Ruleset to ensure you continue to receive Moon Wizards largesse!
In my experience - looking at a really basic Extension - like the Themes - helps to understand how the layering works.
The advantage of a Ruleset over an Extension is that a Ruleset will always load after CoreRPG but an Extension may load before or after another extension and thus give potentially unexpected results....


https://www.fg-con.com/wp-content/uploads/2015/01/fg-con-6-150-9.jpg (https://www.fg-con.com/events/)
FG Con 6 – April 17-19th 2015 - register at www.fg-con.com (https://www.fg-con.com/) for all the latest info.

ShotGun Jolly
November 6th, 2015, 10:47
Damned,

After our chat the other day, I was thinking and I have another suggestion for you to think about. First of all, I tried to do it myself, but I cant get the code to work right, as I am missing something.

But right now, we have two pages on the character sheet, "abilities" and "inventory" Both pages support the drag and drop option, but the "abilities" page only supports the drag and drop option for the title of what ever it is you are adding there. If you click on the little info box on the side, the description is blank. But if you drag and drop an item to the "inventory" page, the info box supports what ever is in the description.

If we could make the ability page, work the same as the inventory page. People with limited knowledge on how all this works, (like me) we can still make pretty good library mods, by using inventory items as skills, spells, special abilities, and be able to drag and drop items where ever we want.

I am not sure if what I am saying is making any sense, but I attached the screen shot, and hopefully it will give you the idea of what I am trying to suggest.

11676

damned
November 6th, 2015, 12:13
You want to be able to have a Library of Skills that you can drag and drop?
Is that what you are saying? The quickest way to do this for you right now would be to have a dummy PC with the full list of skills and you can drag them from there on to other PCs.
If the library is what you are saying you want - I will have a look and see if I can work that out...

ShotGun Jolly
November 6th, 2015, 13:57
Yeah,

I guess that is what I am saying..

If I can create a library of items to drag and drop to the inventory page, we should be able to make it so I can drag and drop skills to an ability page..

But the way I do everything now in my games, as it stands, is ill create all my items, skills and abilities and and name them something like this, [SKILL] Baking 30% or [Ability] Night Vision or what ever, using what is in the brackets as key words in my Items section. Then export it to a library.

Then when players join, they can open up the library page and use the Search function and find and read all the [SKILL]s or all the [Ability]'s with out having to ask me or use multiple windows to read a rule or something.

I can still drag and drop these items to any "inventory" page, but it would be nice to be able to drag and drop it to a ability page and still have access to the description.

I tried just to duplicate the inventory page and rename the sections and remove the Weight sections. But, as of right now, having trouble getting the tabs to align to each other, so I took a break from it and figured I would ask around.

Thanks

LordEntrails
June 13th, 2017, 21:34
I hope no one minds me resurrecting an old thread...

So, I'm looking to build a custom character sheet. This thread has helped a great deal, but I'm still in way over my head. I've found the resources, have read the relevant sections of the developer guides (such as on window_class), but I'm still confused by what I see in the xml files.

First, if there is a primer on building windows or character sheets that would be appreciated

For instance, I've noticed the character sheet is built from a bunch of files, and for instance, the note tab comes from record_char_notes.xml and record_notes.xml But I'm having trouble figuring out what comes where (I've figured out the includefile in build.xml and the links/calls in record_char.xml). I can move existing windows around, but have errors if I delete one or try to create a new one.

I guess specifically, what's the difference between a windowclass, frame, frame_char? Sometimes it seems windows are built with multiple windowclass es, other times with a single windowclass with multiple frame_char s. Is there a best practice? Are there use cases for each? Or am I reading the xml wrong?

EDIT: and I forgot about windowinstance, what are those!?

Trenloe
June 13th, 2017, 21:58
Read about frames here: https://www.fantasygrounds.com/modguide/resources.xcp
Read about windows and control here: https://www.fantasygrounds.com/modguide/windowing.xcp and here windows here: https://www.fantasygrounds.com/refdoc/windowinstance.xcp and windowclasses here: https://www.fantasygrounds.com/refdoc/windowclass.xcp and controls here: https://www.fantasygrounds.com/refdoc/windowcontrol.xcp
Read about templates here: https://www.fantasygrounds.com/modguide/templates.xcp

This is old, but still relevant: https://www.fantasygrounds.com/filelibrary/community/Anatomy_of_a_Ruleset.pdf It might give you some of the FG basics. The main issue is that it doesn't relate to current ruleset architecture.

LordEntrails
June 14th, 2017, 02:09
I will try reading them again. The problem with the developer guides is they are written for developers :) Not for those of us who don't understand the language or already know the basics (if I knew what basics, I could go figure out how to learn those first).

LordEntrails
June 14th, 2017, 04:35
...
This is old, but still relevant: https://www.fantasygrounds.com/filelibrary/community/Anatomy_of_a_Ruleset.pdf It might give you some of the FG basics. The main issue is that it doesn't relate to current ruleset architecture.
THIS is what I was looking for :) Only 1/3 of the way into it at the moment, but I can tell this is what I needed. THANK YOU!

Jedrious
May 6th, 2018, 14:56
I would also like to know if there has been any progress on Shotgun Jolly's suggestion for a library for Skills and Abilities

Trenloe
May 6th, 2018, 15:19
I would also like to know if there has been any progress on Shotgun Jolly's suggestion for a library for Skills and Abilities
CoreRPG is pretty much vanilla and allows a base for people to do their own rulesets or basic setup. As such, there is no library of skills and abilities as there would have to be a different one for each of the many different RPG systems.

You can make your own library of skills/abilities - but you have to do this by manually creating the XML.

Or, you could create a Story entry and make links to various abilities - using this as a library of sorts. You can drag abilities to a story entry from a character sheet - so set up the abilities in the character sheet and drag/drop them in a story entry. Although you'll need to keep the character sheet in the campaign, as the link will refer to that character sheet.

Quite a few people create character sheets for the specific RPG system they play - and use these as templates or sources of drag/drop data. There are lots of example character sheets here: https://www.fantasygrounds.com/forums/showthread.php?23138-Share-Game-System-Character-Sheets

Or, you may want to look at MoreCore - this has the concept of custom "rolls" that you can create with descriptions (and rolling mechanics if needed). These can be exported to a module. Find MoreCore here: https://www.fantasygrounds.com/forums/showthread.php?34860-MoreCore-Ruleset

Jedrious
May 6th, 2018, 22:43
CoreRPG is pretty much vanilla and allows a base for people to do their own rulesets or basic setup. As such, there is no library of skills and abilities as there would have to be a different one for each of the many different RPG systems.

You can make your own library of skills/abilities - but you have to do this by manually creating the XML.

Or, you could create a Story entry and make links to various abilities - using this as a library of sorts. You can drag abilities to a story entry from a character sheet - so set up the abilities in the character sheet and drag/drop them in a story entry. Although you'll need to keep the character sheet in the campaign, as the link will refer to that character sheet.

Quite a few people create character sheets for the specific RPG system they play - and use these as templates or sources of drag/drop data. There are lots of example character sheets here: https://www.fantasygrounds.com/forums/showthread.php?23138-Share-Game-System-Character-Sheets

Or, you may want to look at MoreCore - this has the concept of custom "rolls" that you can create with descriptions (and rolling mechanics if needed). These can be exported to a module. Find MoreCore here: https://www.fantasygrounds.com/forums/showthread.php?34860-MoreCore-Ruleset

I understand that every system would require a different library, but does that really preclude us having an empty library with the functionality to drag and drop to the character sheet, similar to how Items is empty, but I can populate it and drag items to individual character sheets' inventories

Trenloe
May 6th, 2018, 23:10
I understand that every system would require a different library, but does that really preclude us having an empty library with the functionality to drag and drop to the character sheet, similar to how Items is empty, but I can populate it and drag items to individual character sheets' inventories
Yep, I agree - I was just giving you work arounds to be able to do this now.

If you want this in a future release of CoreRPG, please add your request to the FG wishlist here: https://fg2app.idea.informer.com/

Your text should have something along the lines of: In CoreRPG please add the "ability" class type to the campaign data lists so that a list of abilities can be created that can be dragged to the Character Sheet Abilities section and exported to a library module."

In the meantime, you can use MoreCore which I linked to in my previous post - I've just checked it and it has this functionality built in. It also has a lot more functionality I'm sure you'll find very useful when compared to CoreRPG on it's own.

Jedrious
May 6th, 2018, 23:19
Yep, I agree - I was just giving you work arounds to be able to do this now.

If you want this in a future release of CoreRPG, please add your request to the FG wishlist here: https://fg2app.idea.informer.com/

Your text should have something along the lines of: In CoreRPG please add the "ability" class type to the campaign data lists so that a list of abilities can be created that can be dragged to the Character Sheet Abilities section and exported to a library module."

In the meantime, you can use MoreCore which I linked to in my previous post - I've just checked it and it has this functionality built in. It also has a lot more functionality I'm sure you'll find very useful when compared to CoreRPG on it's own.

Except, I'm using DORCore, which Damned and Delux_OZ have not yet been able to combine with MoreCore, there are several features of DORCore that MoreCore does not provide that are essential to the system that I am prepping for

Jedrious
May 6th, 2018, 23:27
Also, while MoreCore does provide this functionality for Abilities, Attributes/Skills is still not available, my system has several hundred skills, I would really prefer to not require my players to have to choose between either hand typing for each character and manually deleting several hundred unpicked skills

Trenloe
May 6th, 2018, 23:35
Except, I'm using DORCore, which Damned and Delux_OZ have not yet been able to combine with MoreCore, there are several features of DORCore that MoreCore does not provide that are essential to the system that I am prepping for


Also, while MoreCore does provide this functionality for Abilities, Attributes/Skills is still not available, my system has several hundred skills, I would really prefer to not require my players to have to choose between either hand typing for each character and manually deleting several hundred unpicked skills

OK, thanks for providing a bit more info on your exact requirements.

I suggest you either contact the respective authors of the ruleset you want to use, or add the full request to the FG wishlist and hope that comes at sometime soon. Things just mentioned in threads have a good chance of being missed by the developers. If this request had been added to the wishlist when it was first mentioned 2 years ago, it might well be in CoreRPG now. I know that doesn't help you right now, but please add your request to the wishlist, so others can benefit in the future. Thanks.

shadelon
May 7th, 2018, 05:02
Except, I'm using DORCore, which Damned and Delux_OZ have not yet been able to combine with MoreCore, there are several features of DORCore that MoreCore does not provide that are essential to the system that I am prepping for

What features exactly? Cause all of the DOE extensions can be dowloaded separately and used with MoreCore. That's kinda why they haven't combined them, probably, cause you already kinda can if you wanted to. Unless you mean the features that aren't in a DOE, like the Universal Dice Roller.

Jedrious
May 7th, 2018, 05:04
What features exactly? Cause all of the DOE extensions can be dowloaded separately and used with MoreCore. That's kinda why they haven't combined them, probably, cause you already kinda can if you wanted to. Unless you mean the features that aren't in a DOE, like the Universal Dice Roller.

Actually, exactly the Universal Dice Roller

shadelon
May 7th, 2018, 05:10
And MoreCore's rolls features can't do it?

Jedrious
May 7th, 2018, 05:16
No, my group has tried, but MoreCore doesn't like multiplying partial dice expression

damned
May 9th, 2018, 08:31
Jedrious you are welcome to pinch the code from MoreCore that allows drag and drop and export abilities and create a DORCore extension.

You could also spell out your roll requirements in detail and I can see if it can be done.

Jedrious
May 9th, 2018, 15:04
Jedrious you are welcome to pinch the code from MoreCore that allows drag and drop and export abilities and create a DORCore extension.

You could also spell out your roll requirements in detail and I can see if it can be done.
I've been trying to find code, but life keeps interrupting. I'll give the most outrageous dice pool that I've seen in the system: 1d6x100+6d4x8+38, it's really just needing to be able to multiply partial dice expressions that is needed.

esmdev
December 30th, 2019, 22:28
Hi. Sorry to necro-post but this seemed like the place to ask this question.

Would I be correct to assume that effects like those seen in 2E and 5E are part of the specific ruleset and not part of CoreRPG out of the box?

damned
December 30th, 2019, 22:36
Effects are part of CoreRPG but the effects you refer to in 5E are built around other code in 5E.
You can view all the code in 5E. Some 5E effects are quite complex.

Trenloe
December 30th, 2019, 23:31
Would I be correct to assume that effects like those seen in 2E and 5E are part of the specific ruleset and not part of CoreRPG out of the box?
Correct. As @damned mentions - the base effect coding (CT, durations, etc.) is in CoreRPG. However, rulesets have their own effect manager for things specific to that ruleset (e.g. RESIST coding, damage types, etc.) - usually in scripts\manager_effect_<ruleset>.lua. Then, each action manager (the code that runs when an action is made - damage, attack, saving throw, initiative, etc.) has code within that checks for active effects that are relevant to that action and applies the relevant adjustment/modifier. So, look in the 2E or 5E scripts\manager_action_XXX.lua files

esmdev
December 30th, 2019, 23:33
Great, thanks. :)

Felderburg
November 2nd, 2023, 02:08
Are the links at the start of this stickied thread still valid? They look like they're from the old wiki; I thought everything was at the atlassian site now. I assume a lot is still applicable, but especially with the change to Unity since the last post here, I want to make sure I read the most up-to-date stuff.

Trenloe
November 2nd, 2023, 10:17
Are the links at the start of this stickied thread still valid? They look like they're from the old wiki; I thought everything was at the atlassian site now. I assume a lot is still applicable, but especially with the change to Unity since the last post here, I want to make sure I read the most up-to-date stuff.
The links are for FG Classic. For FG Unity refer to the Developer Guide section of the new Wiki here: https://fantasygroundsunity.atlassian.net/wiki/spaces/FGCP/pages/996644285/Developer+Guide