• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Preload natives

Status
Not open for further replies.
Level 12
Joined
Mar 13, 2012
Messages
1,121
I would like to gather all available info on those natives. If possible with examples to make it comprehensible. This, this, this, this and ofc Nestharus' IO system have some info on it, but I feel they often lack on explaining properties of the Preload natives used.

We have:
JASS:
Preload
PreloadEnd
PreloadEndEx
Preloader
PreloadGenClear
PreloadGenEnd
PreloadGenStart
PreloadRefresh
PreloadStart
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
Yeah a guide about preload stuff and sync stuff please.

Sync natives require no explanation. They all do what they are expected to do. (except for SyncStoredString, the one native we actually NEED)

I would like to gather all available info on those natives. If possible with examples to make it comprehensible. This, this, this, this and ofc Nestharus' IO system have some info on it, but I feel they often lack on explaining properties of the Preload natives used.

We have:
JASS:
Preload
PreloadEnd
PreloadEndEx
Preloader
PreloadGenClear
PreloadGenEnd
PreloadGenStart
PreloadRefresh
PreloadStart

Preloader opens up a file and runs the .j contents within it if the user has local files enabled. PreloadGen# natives are used with Preload to write files. (no idea what the Preload# natives do).

Apparently calling Preload() with no PreloadGenStart will load the specified file into the RAM
 
Level 12
Joined
Feb 22, 2010
Messages
1,115
So why it is hard to sync string?Just convert all characters into integers 1 by 1 and store them?I think there is something missing.

Also I don't know "how" to use them, which part of code.
 
Last edited:
Level 26
Joined
Aug 18, 2009
Messages
4,097
It just means that more sync instructions are required -> takes longer.

Preload adds a string to the preload buffer.
PreloadGenEnd unloads the buffer in a given path. If the path has no folder, the source is Warcraft III\Logs, if it has a folder then Warcraft III\, if it has even a drive specificiation, then on that exact path.
PreloadGenClear clears the buffer.
PreloadGenStart clears the buffer and starts a timer until PreloadGenEnd, the time value gets appended to the file.
Preloader as said tries to interpret a file as jass code but only a few things work there, it does not see your custom definitions, the syntax has to be okay, else it won't do anything. Path is same as with PreloadGenEnd I think. What Arhowk meant with local files, actually you can also load from the mpq. Wc3 merges the file trees to obtain the latest version and if you enable local files, Wc3 gains access to the paths on the hard drive and considers them as well.
PreloadRefresh no idea
PreloadEnd/PreloadEndEx: I guess those load the buffered paths and PreloadEnd let's you specify how much time it may take longest or over what duration it distributes them.
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
So why it is hard to sync string?Just convert all characters into integers 1 by 1 and store them?I think there is something missing.

Also I don't know "how" to use them, which part of code.

The sync stored integer operation takes p(300+150(c^1.25))ms where p is the player count and c is the number of integers being stored, roughly. "Abcdefgj" would take 11 seconds to sync in a 12 player game. (These maths are only an estimate)
 
Level 12
Joined
Feb 22, 2010
Messages
1,115
Nice, thanks for explanations.

Also by saying "c is the number of integers being stored" you mean for numbers with 1 digit c = 1, for 2 digit c = 2?

Are these natives stop thread or I need to check them myself, also is there any chance they fail?
 
Level 12
Joined
Mar 13, 2012
Messages
1,121
Sync natives require no explanation. They all do what they are expected to do.

Preload adds a string to the preload buffer.

Thank you for the information provided so far. However for example the info in the upper quotes is of no use if one is not experienced with the matter. A bit more self-explanatory info would be great. E.g. what are sync natives expected to do? What is/does the preload buffer? etc..

Also, could there be any chance that wc3 reloads a file at map init or runtime that is loaded at startup? Would greatly increase the ways to customize wc3..
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
What is/does the preload buffer?

A list of strings. Each call to Preload adds a new element. I have explained what it is used for.

Also, could there be any chance that wc3 reloads a file at map init or runtime that is loaded at startup? Would greatly increase the ways to customize wc3..

No, the functions are no executables. Even if it does cache the new contents of standard files, it won't transfer them to the current game behavior.
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
Nice, thanks for explanations.

Also by saying "c is the number of integers being stored" you mean for numbers with 1 digit c = 1, for 2 digit c = 2?

Are these natives stop thread or I need to check them myself, also is there any chance they fail?

?

c = number of integers being stored.

since WC3 uses ASCII for strings, 4 characters = 1 integer
 
Level 12
Joined
Mar 13, 2012
Messages
1,121
A preload line is limited to 259 chars. Why such random numbers, Blizzard, why?
Quite sure it is related to this. Wc3 really has a lot of strange numbers but when you dig deeper it often makes sense somehow.

Also, keep the knowledge flowing. For example for what else the Preload and sync natives can be used (are they used in a special way in File IO?) or just what else you know about them.
 
Level 12
Joined
Feb 22, 2010
Messages
1,115
If you are asking other uses of Preload natives, they are mainly created for "pre" loading files such as models so that model won't freeze game for a short duration when it first used.
 
Level 20
Joined
Jan 3, 2022
Messages
355
After mere 8 years (or 20, depending on how you count), the preloads have been documented here: WC3 Modding Information Center - Jass documentation Database Thanks to @WaterKnight for his description, it helped.
259 limit: Windows' MAX_PATH is 260 chars max. iirc such Preload calls are dismissed instantly. Further, the game engine reads the files in background without freezing the main thread. For example you can let it read any huge .zip file on your drive - by issuing read commands to OS, it'll just make sure that the file lands in the file cache.
 
Status
Not open for further replies.
Top