HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Game Cache

12-17-2006, 01:48 AM#1
MrApples
What are game caches used for?

I'm sure they are not better then using globals, and I've heard them associated many times with handlevars or variables attached to objects, however do not see how using them this way is any better then using Custom Value/array variables.

And was there ever a way to load them in a multiplayer game, because I remember someone being able to ban people from their map (probaly using caches) before a recent patch. It was detectable cross-accounts.
12-17-2006, 02:41 AM#2
PipeDream
Looking through the demo maps and spells will give you examples of a variety of novel game cache uses.

There is no known way to load a game cache in multiplayer. Maps also do not have information beyond a possibly spoofed name. That functionality comes from a third party program.
12-18-2006, 02:16 AM#3
MrApples
Is a game cache saved to hard disk instead of memory? I woudn't be able to figure that by looking at the demos, but I'll check some out.
12-18-2006, 02:37 AM#4
wyrmlord
Think a bit more about gamecache. With a gamecache, you can store values under strings. Suppose you wanted to create a timer that went off when a unit died. You need to have some way to refer to the information of which unit it is (this example is ignoring the GetTriggeringUnit function and such). You could set the unit as a global variable, but then if more than one hero died at once, you'd be out of luck, right? However with gamecache, you take advantage of the return bug and convert the timer into an integer, and then the integer into a string. You now use gamecache and store an integer (using H2I on the unit) and store the unit under that string you got from the timer. You are now able to refer to the specific timer created in another function that the timer calls when it goes off. You would just set a local timer to the expired timer, convert it to an integer and then to a string and voila, you now are able to refer to the unit being stored.

How this works? Each handle has its own id (an integer). When you convert a handle into an integer, you get its id. Since the id is unique to each handle, you don't have to worry when it comes to multi-instancibility. Do you now see the uses of gamecache?