Loading and caching crosshair and hud files?

For test results, bug reports, announcements of new builds etc.

Moderators: another_commander, winston, Getafix

Post Reply
User avatar
Wildeblood
---- E L I T E ----
---- E L I T E ----
Posts: 2276
Joined: Sat Jun 11, 2011 6:07 am
Location: Western Australia

Loading and caching crosshair and hud files?

Post by Wildeblood »

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?
User avatar
cim
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 4072
Joined: Fri Nov 11, 2011 6:19 pm

Re: Loading and caching crosshair and hud files?

Post by cim »

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.
Wildeblood wrote:
Will changing PS.crosshairs more than once like that actually load all the definitions, or only the last named?
Should be fine. I think you should be able to do this in the startUp event where it'll be even less noticeable.
Post Reply