WFRP4e-FoundryVTT
WFRP4e-FoundryVTT copied to clipboard
Reduce number of HTTP request caused by .txt files when loading a world
Is your feature request related to a problem? Please describe.
When starting a game world, multiple txt files used by the name generator are being loaded. In the case of a freshly created world with core, altdorf, rnhd and starter set modules enabled, more than 10% of HTTP requests are caused by these txt files:
Describe the solution you'd like Consolidate multiple txt files into JSON files or load them when needed, not during world initialisation.
I don't think consolidating them is that important. I would suggest that loading them on demand (when opening the character creator) would be better.
But I think the best way to change this would be to do these two things:
- Change the
NameGenWfrp._loadNames();
call frominit
hook toready
hook. - Change the
NameGenWfrp._loadNames();
method from synchronous to asynchronous.
So it would still be already preloaded in case someone wants to create a character and the app would open without the lag, but it would not load them synchronously on init
, which is what can slow down loading.
Unless I'm mistaken how Foundry handles hooks. In that case disregard my comment.