We've got some new updates for you today hot off the presses. This update is pretty technical in nature, and focuses largely on giving sheet authors new tools to make character sheets more powerful and faster. If you're not a sheet author, your main takeaway should be that over the next few weeks as sheets are released with these new features, you should see some cool new improvements to your favorite sheet that make gaming even easier and more fun!
If you want the technical lowdown, read on...
Character Sheet Worker Scripts
One of the main highlights of today's update is a totally new feature that character sheet authors can take advantage of to really speed up the performance of calculation-heavy sheets.
Currently many sheets are using upwards of 5,000+ fields (many of which are auto-calculating fields) to allow some really cool automation and enhancement. However, the original auto-calculating field system was never really designed to handle so many fields at once, which has led to major slowdowns in games. That's because every time you open a Character Sheet, all of the auto-calculating fields have to be re-calculated using the "main" process, which leads to UI lag and freezing. Not only is it bad user experience, it's just a waste of CPU power since most of those fields don't change very often (the calculations are always returning the same results).
In addition, sheet authors have had to come up with some truly crazy workarounds to support some rule mechanics and the lack of things like if/then/else logic and some math functions in the dice engine (which, again, was never meant to be a full-fledged programming language).
So, today we're rolling out a totally new feature called Character Sheet Worker Scripts. These are pieces of Javascript that sheet authors can write that will be executed when events occur (for example, when the attribute of a Character changes, you can update other attributes that also need to change). The great thing about these workers is that they only run in response to events -- so rather than needing to re-calculate the entire sheet every time you look at it, we only re-calculate fields when they actually change. In addition, these workers run in a background process that is separate from the main UI process, so even if it takes a second or two for the calculations to take place, you won't notice any freezing or stuttering. Finally, since these workers run true Javascript, sheet authors can take advantage of the full power of a programming language to do conditions, more advanced math, etc. And since all that math happens in the background and spits out a simple answer at the end, there's no more need to have massive roll formulas that are the size of small novels just to figure out a character's roll mod.
This new feature works hand-in-hand with existing auto-calculating fields, and when utilized properly it's fully backward-compatible with existing sheet data, so all existing sheets and games will continue to function as-is. However, we're requesting that sheet authors take a look at the documentation for the Sheet Workers and go back and identify places where they can eliminate existing auto-calculating fields, instead moving that logic into the Sheet Workers, which will drastically improve performance. If you have questions on how that works or need help with your sheet, please feel free to ask, we're here to help! We're hoping to launch this feature into production in a couple of weeks, and we'd like to have as many sheets as possible converted to use the new system by then.
As an example, you can take a look at this newly-improved 13th Age sheet that our own developer Steve has converted to use the new Sheet Workers to get an idea of what that looks like: https://github.com/Roll20/roll20-character-sheets/... (available starting today in the community list of available sheets for all users as well!)
Documentation on how to integration Sheet Workers into your sheet can be found on the Wiki: https://wiki.roll20.net/Sheet_Worker_Scripts
Better Repeating Sections Support
Today we're introducing better support for repeating sections on character sheets in a number of ways:
- You can now drag-and-drop a roll button from a repeating section on a sheet into your Macro Quick Bar. The button will continue to function even if other rows in the same section are created/deleted.
- Repeating sections now fully support default values (they will appear correctly when rendering the sheet, and you can reference them the same as any default value in rolls, macros, etc.)
- We've made a change to the way that repeating section attribute names are created. Previously, we would create a name such as "repeating_spells_2_SpellName". The "2" was the identifier of the row. If you deleted the "1" row, the "2" row's attributes would all be renamed to be the "1" row. While this made some sense at the time, it led to an issue which prevented us from supporting repeating section attributes and rolls as first-class citizens in macros, rolls, etc. Now when a row is created in a repeating section it is assigned a unique ID that is shared among all attributes in that row. For example, "repeating_spells_-ABC123_SpellName". The ID of the row will now stay the same until the row is deleted.
- As a result of the above, you can now reference repeating section attributes reliably in macros, using the API, etc., without worrying that the attribute name will change. So if you you create a Fireball spell in the "Spell Level 2" section, and it has the ID -ABC456, you can reference that ID in the attributes, sheet rolls (e.g. %{CharName|repeating_spelllevel2_-ABC456_SpellAttack}), etc.
- Adds new support for @{repeating_spells_$1_SpellName} support. So instead of specifying a specific repeating section row ID, you can now specify the row index (so $0 is the first row, $1 is the second row, $2 is the third row, etc.). You may want to update any sheet buttons/rolls that used the old "repeating_spells_0_AttrName" syntax to this new syntax. It's supported both in auto-calc fields and in rolls/macros/etc.
- Finally, if you reference an attribute or sheet roll in a repeating section, and that roll or attribute contains nested attributes that are from the same repeating section, those attributes will now be correctly found and utilized.
Pop-Out Chat and Jukebox
Although you've previously been able to pop-out the chat box, it was an alpha-level feature that still had issues (such as roll templates not rendering correctly). We believe that this feature should now be finished, and we now fully support popping out the chat box.
In addition, you can now pop out the Jukebox tab and manage your playlists and tracks in a separate window.
New Roll Template Logic
Now you can use the negative logic with our helper functions. For example you can now check if a roll was NOT a critical by using:
{{#^rollWasCrit() <rollname>}}and closing it with:
{{/^rollWasCrit() }}Take note that the helper functions expect both the # and the ^ unlike basic exists/doesn't exist checking.
Miscellaneous
- Fixed a bug where the Master Volume slider was not saving correctly between sessions. It should now save.
- Added a new flag, &{noerror}, which when added will suppress any errors (such as variable not found errors) in a roll. Use with caution :-)
- Fixed a bug where if you put a blank space in the description box on the Game Details page you would be unable to edit the description.
- Fixed a bug where campaigns may occasionally go into an infinite-reload loop after kicking a player.
- Fixed a bug where you couldn't add new Tracks to the Jukebox when the Jukebox was popped out.
- Fixed a bug where popouts weren't closing properly when the main window was closed.
- Fixed a bug where API buttons weren't working in the Chat popout.
- Fixed an issue where 3D dice rolls without agency enabled sometimes didn't display all the 3D dice in the roll
- Rolltemplates can now be formatted with CSS differently depending on whether or not avatars are enabled. I.E. ".withoutavatars .sheet-rolltemplate-example"
- The game settings page will now only load in data and images for the sheet options when you pick each option (should drastically reduce load times and bandwidth usage for those of you who spend a lot of time on the Game Settings page messing with Character Sheet template code).
- Adjusted the in-game popup for first-time GMs and players to point to the tutorial instead of our outdated overview videos.
- Added an icon next to closed posts on the forums so you can easily tell they are closed.