| 01-03-2009, 06:58 AM | #1 |
What is it? How does it work? How is it manipulated? All I know about it is that it can store stuff. EDIT: also, Bonus TFT Campaign about Rexxar |
| 01-03-2009, 07:20 AM | #2 |
The gamecache was first mentioned in the Book of Genesis. The Lord God Almighty stored a boolean value using call StoreBoolean( Creation, "Universe", "DoesExist", true ). But seriously (and in nontechnical terms), it stores values. You can retrieve those values with the correct key. You need to flush the values before assigning a new one to the same position (I think). It can store just about anything. |
| 01-03-2009, 07:35 AM | #3 |
I think these days you are best placed if you don't know what it is. |
| 01-03-2009, 07:39 AM | #4 | |
The gamecache is a save file used for the passing of a value, unit and others, from a map to another by storing data to your hard disk, AFAIK, you can only save the gamecache file for single player campaigns only, but that doesn't mean you can't use it on multiplayer maps. You can store data to it by using string keys and mission keys; by also using those keys, you can retrieve your data. How does it work for multiplayer maps? Apparently, the gamecache writes its data to your computers primary memory (RAM) first, caching it there until you decide to save it to your hard disk. This means that you can access data from your gamecache while your map is still being played. Quote:
|
| 01-03-2009, 08:18 AM | #5 |
You say it is intended for campaigns... but, apparently, it's being used to multiplayer maps too. So it is also used for storage, here? What are the advantages of using it and how is it used? |
| 01-03-2009, 09:23 AM | #6 |
If you're not using it for a campaign, you're better off not knowing. It was an OLD/OUTDATED/BUGGY method of storage used in multiplayer maps that generally resulted in what are known as "chaos bugs", which are random bugs that happen with the map code as the result of doing one of many random (some times unknown) things in conjunction with gamecache |
| 01-03-2009, 09:26 AM | #7 |
It's used because you can store data using the handle of a unit as a key. H2I(unit) will return an integer unique to a unit, which you can then use as a gamecache key/store in a gamecache. It was also used because you could store a lot of data globally and only have to declare only global variable. Katana's handle vars (probably still on wc3jass) are the original usage. Vex's Table is the latest implementation. |
| 01-03-2009, 12:36 PM | #8 | |||
Hey fx_ Quote:
Quote:
I did say that it can be used for multiplayer maps didn't I? Quote:
Gamecache didn't cause the bugs, it was the return bug, specifically the IntegerToHandle typecasts. JASS:function I2H takes integer i returns handle return i return null endfunction Vexorian's Table uses gamecache, I think he wouldn't have used it if the bugs were caused by gamecache itself. |
| 01-03-2009, 08:23 PM | #9 |
Well that was required for using it to directly store handles, that is why Table only store integers |
| 01-03-2009, 08:37 PM | #10 |
You're referring to Kattana's Local Handle Vars, not gamecache, the only handles supported by gamecache are units, of course, this is assuming that you won't exploit the return bug on gamecache. Anyways, I just wanted to clear that gamecache isn't bugged, it's just slow but it works as intended. Also because of structs, we can use gamecache safely since the preprocessor deals with instantiating the objects we use in our code, thus removing the need to typecast. |
| 01-03-2009, 09:51 PM | #11 |
Though this has little relevance for almost all maps, the gamecache serves one purpose that is infinitely useful for mine. It allows for the real time collection of multiplayer game data for use in a league. |
| 01-03-2009, 11:06 PM | #12 | |
Quote:
Gamecache is basically some sort of hash table object where you can store data (integers, reals, strings, even units) by associating it with two keys (which can be any string) and you can save the gamecache object itself to the hard drive and also load it from there (but only in single player). It is very useful as a data structure; it's kinda slow but it has very few limitations, the two string keys offer much more possibilities than for example the 0-8191 index limit in arrays. |
| 01-03-2009, 11:27 PM | #13 |
AotZ is awesome for its chaos bugs. It has all sorts of problems, dynamic triggers, I2H, and a motley of other proven-to-be-awful techniques used all over the place. As far as I'm aware, AotZ is the only map with the proper errors lined up to cause natives to fail and timers to randomly stop and stuff. Anyways, though, that is a result of poor coding more than anything else. Cache in itself is a very safe thing. |
| 01-04-2009, 04:13 AM | #14 |
Why is it slow and how can this be fixed? |
| 01-04-2009, 04:36 AM | #15 |
Fixing cache problems fast and easy... Thread in russian We must keep at least one reference to timer, or you will get 2 or more timers with same handle. JASS:call HandleDelay(SomeHandleLocal) set SomeHandleLocal = null JASS:function HandleDelay takes handle Handle returns nothing set GlobalCounterInteger = GlobalCounterInteger + 1 if GlobalCounterInteger == 8000 then set GlobalCounterInteger = 1 endif set HandleStorage[GlobalCounterInteger] = Handle call ExecuteFunc("HandleCleanUp") endfunction function HandleCleanUp takes nothing returns nothing local integer ID = GlobalCounterInteger call TriggerSleepAction(0.00) set HandleStorage[ID] = null endfunction Same code for "unknown delay" removal. JASS:function HandleLOG takes handle Handle returns nothing set GlobalCounterInteger = GlobalCounterInteger + 1 if GlobalCounterInteger == 8000 then set GlobalCounterInteger = 1 endif set HandleStorage[GlobalCounterInteger] = Handle call StoreInteger(EngineCacheGlobal,H2S(Handle),"RecycleID",GlobalCounterInteger) endfunction function HandleRecycle takes handle Handle returns nothing set HandleStorage[GetStoredInteger(EngineCacheGlobal,H2S(Handle),"RecycleID")] = null endfunction Dont remember such code poster here. |
