- Joined
- Sep 28, 2009
- Messages
- 222
SC2 Bank files - Critics
WARNING: This post is outdated and its not all true whats said in here. Please read the entire thread or at least the last pages to get the latest informations, thanks!
Introduction
Hello everyone!
In WC3 it was very hard to save heroes or other things after map close. In that time we used "save codes" that every player had to write down and type in later if he wanted to load his hero. So Blizzard gave us some new method to save our heroes/map progress: The bank files.
Bank-files basics
In fact, the bank files are nothing else than XML files located in your documents folder. The difference to WC3-GC is, that you can use Bank-files in multiplayer, because you can load/save them for specific players. The bank files itself are not encrypted and can be edited with the normal windows text editor.
How to use Bank files:
The bank files are quite easy to use. If you for example want to save an integer to a bank file, you have to do the following:
1) save integer to bank
-
save int
- Events
-
Local Variables
- int = 1337 <Integer>
- Conditions
-
Actions
- Bank - Open bank "testbank" for player 1
- Bank - Store integer int as "integer" of section "integers" in bank (Last opened bank)
- Bank - Save bank (Last opened bank)
-
load int
-
Events
- Game - Map initialization
-
Local Variables
- int = 0 <Integer>
- Conditions
-
Actions
- Bank - Open bank "testbank" for player 1
- Variable - Set int = (Load "integer" of section "integers" from bank (Last opened bank) as integer value)
-
Events
- If we only restart the map and dont close sc2, it works perfect
- if we close sc2 and reopen it, the integer value wont be loaded
so why is this? why does it work if we only restart the map and not if we restart the entire game? the reason is, that bank files get written to your cache while playing. if you only restart the map the bank is still in your cache and can be loaded. but if you restart the entire game the cache will be deleted and you cant load your bank value any more.
So what can we do about it? no need to be worried, we can fix this issue with one simple action:
-
load int
-
Events
- Game - Map initialization
-
Local Variables
- int = 0 <Integer>
- Conditions
-
Actions
- Bank - Preload and synchronize bank "testbank" for player 1
- Bank - Open bank "testbank" for player 1
- Variable - Set int = (Load "integer" of section "integers" from bank (Last opened bank) as integer value)
-
Events
Bank-files advanced
Ok, until now its all good and easy. now we will go a bit more advanced
at first i want to rewrite the code, so that it works for all 16 players. i just change the int to an int array and save/load the bank for all players.
1) save:
-
save int
- Events
-
Local Variables
- int = 1337 <Integer[16]>
- Conditions
-
Actions
- ------- note: players are integers now!
-
Player Group - Pick each player in (All players) and do (Actions)
-
Actions
- Bank - Open bank "testbank" for player (Picked player)
- Bank - Store integer int[(Picked player)] as "integer" of section "integers" in bank (Last opened bank)
- Bank - Save bank (Last opened bank)
-
Actions
-
load int
-
Events
- Game - Map initialization
-
Local Variables
- int = 0 <Integer[16]>
- Conditions
-
Actions
- ------- note: players are integers now!
-
Player Group - Pick each player in (All players) and do (Actions)
-
Actions
- Bank - Preload and synchronize bank "testbank" for player (Picked player)
- Bank - Open bank "testbank" for player (Picked player)
- Variable - Set int[(Picked player)] = (Load "integer" of section "integers" from bank (Last opened bank) as integer value)
-
Actions
-
Events
if we test this new triggers we will be quite surprised:
- it will work with restarting the map
- it WONT work with restarting the game
so why is this? didnt we preload the bank files? yes we did, but we are not allowed to do it in a loop. bank-name and player must be LITERAL values, no variables or expressions are allowed. so we have to do it like this:
-
Actions
- Bank - Preload and synchronize bank "testbank" for player 0
- Bank - Preload and synchronize bank "testbank" for player 1
- Bank - Preload and synchronize bank "testbank" for player 2
- Bank - Preload and synchronize bank "testbank" for player 3
- ...
Bank-files - Multiplayer
in singleplayer the bank files seem to work quite well, so i decided to do some multiplayer testing about them. if we take the code from above and load the map in multiplayer it works very good, the bank gets loaded and the integer restored, all fine.
in reality, you wont store only one integer value in a bank file. for example if you want to do an ORPG (like me), you have to save a lot more to the bank files, for example hero attributes, position, if hes alive, player property, option settings, ... and so on. addicionally, you might not only have one character in an rpg, but more. so you would need more then one bank file to save all characters individually. ok, so what? were is the problem in this?
at first we will again rewrite the code a little bit. instead of storing one integer value, i now want to store much more in the bank files to simulate an RPG game.
1 save int
-
bt
-
Events
- Game - Player Any Player types a chat message containing "-bt ", matching Partially
-
Local Variables
- int = 0 <Integer[500]>
- string = (Substring((Entered chat string), 4, 10)) <String>
- Conditions
-
Actions
- Bank - Open bank "bt" for player (Triggering player)
- Bank - Remove section "test" from bank (Last opened bank)
- ------- Comment
-
General - Pick each integer from 0 to (Integer(string)), and do (Actions)
-
Actions
- Variable - Set int[(Picked integer)] = (Integer(string))
- UI - Display (Text(int[(Picked integer)])) for (All players) to Subtitle area
- Bank - Store integer int[(Picked integer)] as (String((Picked integer))) of section "test" in bank (Last opened bank)
-
Actions
- ------- Comment
- Bank - Save bank (Last opened bank)
- UI - Display "saved" for (All players) to Subtitle area
-
Events
our load trigger will be very simple:
-
load
-
Events
- Game - Map initialization
- Local Variables
- Conditions
-
Actions
- Bank - Preload and synchronize bank "bt" for player 1
-
Events
Bank-files - The problem
ok, if we test the triggers from above in battle net we will get the following results:
- if we save 1-80 integer values, its all fine
- if we save >80 integer values, the game WONT LOAD ANYMORE
so whats wrong now? why cant he preload the bank if we save >80 values to it? (the bank size is around 6KB then)
please keep in mind, that loading <80 values goes without problems and without any delay, so why he just cant load >80 values?
my conclusion is, that blizzard set some limit. i dont know why, maybe because of net-traffic, i dont know. but im quite sure in theory its no problem to load 80 values or more, just because a lower value goes without any problems. so we have a LIMIT here of ~80 values in a bank, otherwise our map WILL NOT EVEN LOAD!
ok, now you might say its not a such big problem. 80 values is quite much for one hero in an rpg, and we could use more banks to split them up a little bit and reduce the amount of values every bank ha to save.
so lets modify the trigger a bit to see what will happen if we load 2 banks with <80 values:
save:
-
bt 2
-
Events
- Game - Player Any Player types a chat message containing "-bt2 ", matching Partially
-
Local Variables
- int = 0 <Integer[500]>
- string = (Substring((Entered chat string), 5, 10)) <String>
- Conditions
-
Actions
- Bank - Open bank "bt" for player (Triggering player)
- Bank - Remove section "test" from bank (Last opened bank)
-
General - Pick each integer from 0 to (Integer(string)), and do (Actions)
-
Actions
- Variable - Set int[(Picked integer)] = (Integer(string))
- UI - Display (Text(int[(Picked integer)])) for (All players) to Subtitle area
- Bank - Store integer int[(Picked integer)] as (String((Picked integer))) of section "test" in bank (Last opened bank)
-
Actions
- Bank - Save bank (Last opened bank)
- UI - Display "saved" for (All players) to Subtitle area
- ------- Comment
- Bank - Open bank "bt2" for player (Triggering player)
- Bank - Remove section "test" from bank (Last opened bank)
-
General - Pick each integer from 0 to (Integer(string)), and do (Actions)
-
Actions
- Variable - Set int[(Picked integer)] = (Integer(string))
- UI - Display (Text(int[(Picked integer)])) for (All players) to Subtitle area
- Bank - Store integer int[(Picked integer)] as (String((Picked integer))) of section "test" in bank (Last opened bank)
-
Actions
- Bank - Save bank (Last opened bank)
- UI - Display "saved2" for (All players) to Subtitle area
-
Events
load:
-
load
-
Events
- Game - Map initialization
- Local Variables
- Conditions
-
Actions
- Bank - Preload and synchronize bank "bt" for player 1
- Bank - Preload and synchronize bank "bt2" for player 1
-
Events
remember: loading ONE bank with 50 values was no problem!
ok, if we type "-bt2 45" now and try to restart the map... it WONT LOAD!
so what does this mean? this means that not only the values every SINGLE bank can load are limited - the values of ALL BANKS TOGETHER are limited to 80!
so what does this mean for an orpg game? if we have for example 5 character slots for each player, there could only ~80/5 values be saved for each character! its a joke. if you want to save quest progress, property, attributes, level, position and so on its just not enaugh.
by the way: in singleplayer its no problem to load a bank with >80 values. even 400 values are no problem. so this problem is ONLY multiplayer. test it yourself, and you will see its no joke. you cant load >80 values in multiplayer from banks.
Bank files - Conclusion
Bank files are a very good idea of blizzard and im really thankful that they gave them to us. But if we are not able to load >80 values from bank files in multiplayer, they are sensless. i can just hope that blizzard will fix this. its the dead for nice orpgs.
not only that blizzard limited map size, tilesets and has quite bad hero support and is completly leaking the hero triggers, now we also have this bank limit.
I can only hope this is a beta-issue. If not:
Please blizzard, stop killing ORPGS!
PS: please dont complain about any trigger optimizing, this triggers here are just examples to show you the problem.
Last edited: