PDA

View Full Version : Ruleset Loading Speed!!!!



Visvalor
July 26th, 2010, 14:52
Sorry, I know I posted something similiar to this question here:

https://www.fantasygrounds.com/forums/showthread.php?p=93943#post93943

However I didn't name the title clearly and I didn't get a satisfactory answer. My ruleset takes me 12 seconds to load, my gamers it takes 40 seconds to 5 minutes to load.

I tried converting it into a pak file, that makes it where it takes me 109 seconds to load, and I'm not even going to ask my gamers to try.

Is anyone experienced available to take a peak at my ruleset and tell me what the problem is? It just makes no sense to me that XML would take so long to load, even considering how many variables and pages I use.

Is there a trick to reducing loading speed? Can I put everything on less XML sheets to reduce loading? Is there a way to call variables faster? Is there anything in the LUA I can screw with that will help this?

Any help is appreciated. Thanks.

Visvalor
July 26th, 2010, 15:26
I think I figured it out, I think it's loading the global_lookups.lua each time I reference the globals individually >_<

Why wouldn't it just load the variables all at once and go from there?

Visvalor
July 26th, 2010, 15:28
Yea I make this reference; <script file="scripts/global_lookup.lua" />

Roughly 852 times. It looks like it's loading the goddamn thing each time individually >_<

Zeus
July 26th, 2010, 15:30
Huh? Converting to a .PAK shouldn't have caused a 5 fold increase in load time, something's definitely wrong. I see a significant improvement in load times for the 4E ruleset when comparing .PAK instances to app data/ruleset expanded versions.

I'm sorry I can't be of more use to you but I am struggling to see what the problem can be unless its related to the ruleset itself that your using.

Some more questions:

1)In your campaign, have you set any modules to auto-load at startup (each module will have the lightning bolt icon as opposed to just a tick)?

2)What version of FGII are you running, if its 2.6.5, have you tried the latest test release 2.7.0? 2.7.0 introduces several optimisations which tidy up memory usage and reduce the overall footprint required.

EDIT Just seen your last posts, no you don't have to repeat load it, once is enough!

Visvalor
July 26th, 2010, 15:39
But the thing is the script calls for it each time :P so it knows where to look. Would you mind looking at my ruleset for me XP I'm 99% sure it's the ruleset and no it doesn't have any modules or images to slow it down.

Zeus
July 26th, 2010, 15:48
Just sent you a PM.

In summary, there's nothing wrong with using a script multiple times throughout your ruleset but 852 times seems a bit excessive!

Is this script supporting a windowcontrol, windowclass, windowlist? Or is it a global variables script acting as some sort of global store?

If its supporting a particular control or windowlist, you might be better off considering the use of a template. That way you can reference the script once and still call the template to instantiate multiple objects.

Visvalor
July 26th, 2010, 15:56
I just replied, and for the sake of anyone else that might be curious or want to find out answers too. I'll post a copy of the PM here :P


"Oh boy. Ok this is when the lag started.

https://www.talesofvortura.com/Jay/TW.pak Here is the ruleset it's a WIP roughly 20% complete.

Ok I have a tab on my character sheet called "spells"

When you click spells it brings you to a currently blank window which displays 18 black square across the bottom.

Those squares are generic control buttons that display subwindows (just like tabs) but currently the graphics guy is being lazy. So I'm using black squares.

Clicking one of those will bring you to a magic sub-window. Each subwindow also has 10 other sub-windows in it for magics 1-10

Clicking one of those subwindows will bring you to a page that displays the magic listing. You'll have 5 spell slots in each level.

If you look at the spell slot you'll see a place for a name (No big) a drop down menu for spell effect and a drop down menu for spell action. Also to the right of that will be a die score for the spell effect DC and a die score for the spell action damage (or healing, whichever)

Now the big thing I'm betting that causes the lag (Other than sheer size) is that each level of each spell calls for the globallookups.lua thing 5 times. Once for each spell slot.

Well currently there are 17 diffeent styles of magic, each with 10 levels and each with 5 spells lots.

EG 850 lookup calls. I don't know how else to do this with a drop down menu. I just copied the same dropdown menu as I used for my racial selection (As you'll see on the front page there are drop down menus for char creation that automatically set stats etc)

Like I said, the whole thing is a mess and a WIP but I really REALLY need to get this loading thing fixed so my gamers can play without crashes and etc :3 any help is greatly appreciated <3!

~V "

Visvalor
July 26th, 2010, 15:57
Also I should note that all of this is for creating custom spells for the users to cast during games. I have an EXP system that allows them to make their own spells :P and it's pretty versatile as to what all can be done.

Zeus
July 26th, 2010, 16:08
And for the benefit of anyone else reading this thread, here's a copy of the PM I sent in response to Visvalor's PM request.

-------

OK. I'll take a look as soon as I can.

From your description, its sounds like you could optimize the spell sheet to make use of templates for the subwindow and spell description controls.

You reference the global script in the template once, then on the charsheet spells tab you instantiate multiple versions of the templated controls one for each black box you want. Then reference the spell templated control within each.

This would be a better approach for getting the performance your seeking out of FGII without overloading its engine.

In the meantime, I would also suggest downloading the 2.7.0 test release and taking a look at how JPG manages common controls through the use of templates. Check out charsheet_main.xml and templates_charsheet.xml and their supporting LUA scripts.

Zeus
July 26th, 2010, 17:04
OK.

I just grabbed 10 mins to take a quick look. On first load it took 5 minutes to load up the campaign, I created a character and opened the charsheet and got quite a few console errors:


Script Error: [string "scripts/template_dropdown.lua"]:68: attempt to index global 'li' ( a nil value)


and


Ruleset Warning: Could not load script file scripts/global_lookup.lua

I unpacked the ruleset and took a quick look.

The first error relates to the fact your not checking to make sure the control is created and exists before making use of it (line 68 of template_dropdown.lua). I didn't have time to trace the condition this happens under but thats the cause of the error.

The second is a filename error. The scripts folder has a file called global_lookups.lua whilst your XML files are all referencing global_lookup.lua with the exception of base.xml which correctly references global_lookups.lua

I renamed global_lookups.lua to global_lookup.lua and changed the reference in base.xml. I then reloaded the campaign. It took less than 5 seconds.

Can you try it out and test with one of your players. I'll be back a bit later on to have another look.

Visvalor
July 26th, 2010, 18:19
PROBLEM SOLVED XP!! Thanks to DrZuess.

Ok first, if you're going to reference something, make sure you type it properly. EX global_lookups not global_lookup <--- No s = problems :P

Secondly, you don't have to call your script every time you use it

<script file="scripts/global_lookup.lua" />

I had that referenced 852 times :P

XD Wooo!