Performance issues...

For discussion about the NBOS Character Sheet Designer and Viewer.

Performance issues...

Postby mmacmartin » Thu Dec 10, 2009 7:47 pm

Hi, I'm new here on the boards, and I'm new to using the NBOS Character Sheet designer.

I've recently got obsessed with the Mutant Chronicles RPG, and figured that this would be a good way to put the Character Sheet Designer through its paces. The game has each skill having a number of "picks", and the total skill value being a function of that and the linked attribute. In keeping with the way that the official Mutant Chronicles sheets look, I wanted to have a checkbox per pick - for a total of 16 per skill, plus a mod box, plus stat mod box, plus an "Uncapped?" box, plus a final total box.

Anyway, after a lot of copy and pasting, I ended up with at template (attached) which is done to the end of "skills". Now, there's an issue with it: because the character sheet designer seems to run all updates after editing any values, and the fact that my skill update function seems to be processor intensive, this causes the viewer to slow down to the point of near unusability.

I have no idea if I can speed up my function in any way. I would very much like to be able to call the checkboxes SkillName.Picks[i], but the designer does not seem to like that. I would also very much like to be able to have an OnChange function (preferably for an object "class": i.e. call each checkbox of SkillName an UpdateBox<SkillName> and have things set up so that it knows what to do). Having an OnChange event would allow for significant run-time speed ups. If it is there already in the program, it is hidden away and not in the brief tutorial.

Anyway, I would appreciate if anything could be done about performance issues: either help me write a more efficient template in this style, or if it could be looked into on the application end.

Thank you
Attachments
mctest.csd
(344.9 KiB) Downloaded 160 times
mmacmartin
Torch Bearer
 
Posts: 1
Joined: Thu Dec 10, 2009 7:38 pm

Re: Performance issues...

Postby nortain » Tue May 28, 2013 6:13 pm

If you go under the Sheet tab->Document Setup-> Script Configuration. There are 4 script events you can add functions to. If you have a large character sheet I'd recommend using something like On Open and On Update to call a driver function that executes everything in the character sheet. Using individual fields to be updated (i.e. calling and modifying source values directly) runs at an O(n^2) speed. If you're not familiar with O notation just know that's about as bad as it gets. It sounds like (4 some odd years ago) you were experiencing the brunt of that. For readers coming across this post, make sure to use on open and/or on update for anything but a simple character sheet. The speed of the application will be the difference between being useless and being usable.
nortain
Torch Bearer
 
Posts: 6
Joined: Fri Apr 12, 2013 4:12 am

Re: Performance issues...

Postby christooley » Mon May 19, 2014 4:29 pm

Is this still pertinent if the sheet doesn't have much JavaScript?
My Magic World sheet is nearly all look-ups, but each field takes 10-20 seconds to update. Even if the field has no code, like "Character Name".
Takes a long time to do anything. Any help would be hot!
https://www.dropbox.com/s/yn81v7q04k3mmn6/Magic%20World%20test%20finished.csd
christooley
Torch Bearer
 
Posts: 15
Joined: Thu Dec 19, 2013 10:52 am

Re: Performance issues...

Postby Ed_NBOS » Wed May 21, 2014 12:39 pm

I took a look at the sheet last night. You still have a lot of calculations in places like the skills section. Moving the 'Field Sources' for those fields to calculations in an OnUpdate function should improve the speed a lot. The lookups shouldn't be involved in the update speed, other than they trigger an update when a selection changes.

The next version of the CS viewer has a new scripting engine built in, and is an order of magnitude faster. That will be built into The Keep v2 when it comes out.
Ed_NBOS
Site Admin
 
Posts: 603
Joined: Wed Jul 08, 2009 12:16 am

Re: Performance issues...

Postby christooley » Wed May 21, 2014 1:12 pm

So instead of the calculations being done in the field I need to change them all to a function in JavaScript then have the OnUpdate call for that function. Ugh. I suck at JavaScript! But will suffer through it if it makes this useable.
Ed, I REALLY appreciate you taking the time to look at the sheet! And the suggested fixes. You, sir, rock!
christooley
Torch Bearer
 
Posts: 15
Joined: Thu Dec 19, 2013 10:52 am


Return to Character Sheet Designer General

Who is online

Users browsing this forum: No registered users and 1 guest

cron