'preloadtex' question / suggestions

All about writing scripts for Celestia in Lua and the .cel system
Topic author
DoubleAught
Posts: 4
Joined: 01.03.2005
With us: 19 years 8 months

'preloadtex' question / suggestions

Post #1by DoubleAught » 28.05.2008, 20:26

I've searched all forums regarding "preloadtex" and still can't definitively answer a question about the 'wait' duration.

At the beginning of a script, I essentially pre-load all the textures I believe I'll use......
(i.e.
preloadtex {object "Sol"}
preloadtex {object "Sol/Earth"}
preloadtex {object "Sol/Earth/Moon"}
....this list usually exceeds 30 entries...)

I'm unclear on whether I should implement a 'wait' instruction after EACH 'preloadtex' command,
or if just one at the end of the list is sufficient.

The references to 'wait' duration in relation to 'preloadtex' seem to be arbitrary at best....
I've used the 'Shift+`' keycombo to bring up the console display and the results vary
and, unfortunately, doesn't illuminate the process(es) clearly.

With a ' wait{duration 0.25}' after EACH 'preloadtex', a reasonably readable process is iterated,
(albeit somewhat quick due to the short duration of the 'wait' instruction)

With a SINGLE 'wait' instuction of longer duration at the end of all the 'preloadtex's
only the last 5 texture loads are shown on the console display.

Question .........Did all textures load or only the last five ???

I think a lengthier (longer , taller ???) index would be an improvement.
Even better, the ability to pipe the output of the control display (Shift+`) to a text/log file,
for those of ME who can't read screen output as fast as it's generated.

I'm trying (unsuccessfully) to implement an old DOS routine whereby CON is "|" to PRN or LPT1...
......and yes, I AM Methusala, and yes, I AM 900+ years old !!!

Any suggestions from those intuitive enough to decipher my rambling/babbling would be appreciated.

-RJ

Avatar
Adirondack M
Posts: 528
Joined: 01.03.2004
With us: 20 years 8 months

Re: 'preloadtex' question / suggestions

Post #2by Adirondack » 29.05.2008, 10:45

DoubleAught,

you have to implement a 'wait' instruction after each 'preloadtex' command!
The 'duration' depends on the size of the image.

But be aware that you do not preload too much images!

Adirondack
We all live under the same sky, but we do not have the same horizon. (K. Adenauer)
The horizon of some people is a circle with the radius zero - and they call it their point of view. (A. Einstein)

Topic author
DoubleAught
Posts: 4
Joined: 01.03.2005
With us: 19 years 8 months

Re: 'preloadtex' question / suggestions

Post #3by DoubleAught » 29.05.2008, 10:58

Thank you for the reply.
I'm fortunate enough to have built myself a respectable rig,
and Celestia runs infinitely better than my old rigs would allow,
which predicates the need to see how much I can ratchet up
Celestia to bog this one down.

Thanks again for the tip, and if you happen to see a puff of smoke,
it was probably me trying to pre-load one too many textures !!!!

Avatar
LordFerret M
Posts: 737
Joined: 24.08.2006
Age: 68
With us: 18 years 2 months
Location: NJ USA

Re: 'preloadtex' question / suggestions

Post #4by LordFerret » 08.06.2008, 06:51

Adirondack wrote:DoubleAught,

you have to implement a 'wait' instruction after each 'preloadtex' command!
The 'duration' depends on the size of the image.

But be aware that you do not preload too much images!

Adirondack
I somehow missed that entirely when reading the .cel scripting guide. 8O I now see how this can affect the resulting behavior of my script. :oops:

preloadtex
object <String> (no default)

Pre-load the specified texture file from disk into memory.


object The name of the object who's texture is to be pre-loaded into graphics card memory.

Depending on the file size of the texture being loaded, you may want to follow this command with a wait command. If you are preloading multiple textures, or large textures, you should definitely use a wait command. The wait duration will depend on the size of the texture file(s) and may require some testing to get it just right.

This example pre-loads the texture file for Mars:
preloadtex { object "mars" }

But now I'm wondering... Ok, I've got the timing down for my system - but now I pass my script on to someone else... I don't see the timing being the same on theirs. :?

Avatar
Adirondack M
Posts: 528
Joined: 01.03.2004
With us: 20 years 8 months

Re: 'preloadtex' question / suggestions

Post #5by Adirondack » 08.06.2008, 22:58

LordFerret,

when the machine of someone else is slower (e.g. slower CPU, less GRAM and so on) than yours,
the script doesn't work as it does on yours since Celestia has not the time to preload all textures.
If you want to make sure that your script runs on other (slower) machines too, make sure to increase
the duration of the wait command.

If you set wait {duration 1.5} after each preloadtex (since this works on your machine) and the machine
of someone else needs 3 seconds to load each texture, than this will not work.

Adirondack
We all live under the same sky, but we do not have the same horizon. (K. Adenauer)

The horizon of some people is a circle with the radius zero - and they call it their point of view. (A. Einstein)


Return to “Scripting”