Preloader()

Status
Not open for further replies.
Level 8
Joined
Jul 10, 2008
Messages
353
What can Preloader() preload? Can it be used to preload resources directly from the map or just from local wc3 directory?
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,285
It preloads asset files. To understand why this is important one needs some basic knowledge about computer science.
  • Reading files from disks, especially mechanical ones, is extremely slow with respect to the CPU. One is looking at milliseconds and not nanoseconds.
  • Data is often encrypted and compressed. CPU time and memory bandwidth must be used to transform the data into a usable form. Often in the order of microseconds.
  • For a good play experience a game must try to comply with real time system requirements on scheduling frames and updating game state. If it fails to meet the frame scheduling deadline a frame is dropped which is a noticeable visual artefact that degrades the user experience.
  • To render a fame, the data for all required assets must be in memory.
One can see how a few of these are contradictory and cause a problem. To render a frame all assets are required, but loading an asset potentially takes milliseconds to read in and then additional microseconds to prepare. If this exceeds the real time scheduling of the game, eg at 60 FPS that is ~16 milliseconds, then a fame has to be dropped which ruins the play experience.

Preloading allows one to load assets before they are required to render a frame. Ideally this should happen asynchronously so as to not interfere with the game, but in the worst case one can spread out preloading such that it has minimal impact on the game frame rate, eg 1 asset every few frames.

Generally preloading is done for models. I suspect it works on textures as well. I do not think one can use it to preload abilities, instead those must be loaded by being placed on a unit. I would imagine it can preload sounds, but others have provided contradictory evidence.

An exploit allows Preload to perform some sort of file IO. Often used by modern RPG maps to store save codes to disc avoiding the need for someone to write or type them down.
 
Level 8
Joined
Jul 10, 2008
Messages
353
Ty for the info, but what am asking is if Preloader() ( not to be confused with Preload() ) can preloads stuff that are located in the w3x file (the actual map). And if so, what type of resources can it preload (again talking about the Preloader() not Preload() )
 
Last edited:
Level 8
Joined
Jul 10, 2008
Messages
353
@Dr Super Good There are 2 preload.

Preloader() and Preload() as far as I can tell 1 preload preloads objects and preloader preloads scripts. What am wondering is if I can dynamically use Preloader() to run stuff on demand that are not located in the main script but still located in the map not locally. In fact what am looking for is a quide to Preloader() for max utilization.
 
Status
Not open for further replies.
Top