I've created an OXP that animates the crosshairs through a 16-step animation by switching the crosshairs files. The first time it happens it causes a noticeable stutter here. Afterwards it runs smoothly. I'm assuming it is because the crosshairs definitions are over there if unused, and are copied over here when they are first needed.
I'm considering pre-loading all 16 with a for loop on ship launch. Will changing PS.crosshairs more than once like that actually load all the definitions, or only the last named?
Is the whole thing in my imagination?
Loading and caching crosshair and hud files?
Moderators: winston, another_commander, Getafix
- Wildeblood
- ---- E L I T E ----
- Posts: 2453
- Joined: Sat Jun 11, 2011 6:07 am
- Location: Western Australia
- Contact:
Re: Loading and caching crosshair and hud files?
That's entirely possible - locating a particular file when there are many OXZs installed is a slow process, but once Oolite has found the file, it caches the location and extracting a file from a known ZIP is fast enough.
Crosshairs and HUDs have the disadvantage that they're in the Config folder - which isn't cached in the same way because usually its contents merge rather than overwriting - but can have arbitrary filenames like the contents of other folders.
Crosshairs and HUDs have the disadvantage that they're in the Config folder - which isn't cached in the same way because usually its contents merge rather than overwriting - but can have arbitrary filenames like the contents of other folders.
Should be fine. I think you should be able to do this in the startUp event where it'll be even less noticeable.Wildeblood wrote:Will changing PS.crosshairs more than once like that actually load all the definitions, or only the last named?