1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. We have recently started the 16th edition of the Mini Mapping Contest. The theme is mini RPG. Do check it out and have fun.
    Dismiss Notice
  4. Choose your ride to damnation in the 5th Special Effect Contest Poll.
    Dismiss Notice
  5. The winners of the 13th Techtree Contest have been announced!
    Dismiss Notice
  6. The 13th Music Contest Poll is up! Vote for the best tracks in this symphony of frost and flame.
    Dismiss Notice
  7. Race against the odds and Reforge, Don't Refund. The 14th Techtree Contest has begun!
    Dismiss Notice
  8. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

SC2 Bank files - Critics

Discussion in 'StarCraft II Modding' started by Mille25, May 14, 2010.

  1. Mille25

    Mille25

    Joined:
    Sep 28, 2009
    Messages:
    217
    Resources:
    0
    Resources:
    0
    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)


    2) load integer
    • 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)


    Thats it, quite easy, huh? ok, if we test this it works quite well, but there is a difference:

    • 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)


    because of the preloading action we can now load the bank value even if we restart the entire game.


    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)


    2) load
    • 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)


    in fact we didnt change anything, only that we do it for all players in a loop right now, so all should be good.
    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
    • ...


    this is the first thing that i dont like about banks and i want to critisize this. why we have to do it manually? what if one player has more then one bank? its alot of work and not really necessary, its just annoying. but ok, its only a bit typing work, its not a really serious problem.


    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)
        • ------- Comment
        • Bank - Save bank (Last opened bank)
        • UI - Display "saved" for (All players) to Subtitle area


    if we enter "-bt " in the chat the trigger gets activated. after this we have to enter the number of integers we want to store in the bank. so if we for example write "-bt 50", there will be 50 integer values with value 50 stored into the bank.

    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


    the only thing we want to do is preloading the bank for player 1, because otherwise we are not able to use it later.


    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)
        • 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)
        • Bank - Save bank (Last opened bank)
        • UI - Display "saved2" for (All players) to Subtitle area


    in fact, this trigger does exactly the same as the first one, the only difference is that we use 2 banks now. so if we enter "-bt2 50" we will create 2 banks, each of them containing 50 int values with value 50.

    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


    the load trigger should be self explaining.

    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: Jun 4, 2010
  2. Robbepop

    Robbepop

    Joined:
    Mar 6, 2008
    Messages:
    892
    Resources:
    7
    Maps:
    6
    Spells:
    1
    Resources:
    7
  3. Ouguiya

    Ouguiya

    Joined:
    Aug 14, 2005
    Messages:
    48
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Nice report, my thanks.

    I also hope that blizzard is reading this, but maybe it's possible to send them an e-mail AND a bug report. You know, just to be sure.

    So say, Mille25, since you already have dived into bank files: How safe are they versus hacking?

    Their advantages are obvious for ORPGs, but I have to say they would also work quite nicely with other maps, like the one I am currently working on.

    However, in almost all maps, if you are able to edit your hero to have 10k stats and 200k HP, well, the game is over.

    So, is it possible to simply edit this file (if it is unencrypted), or, if it is encrypted, is it possible to easily break the encryption by a little programming work? (I realize that it's nigh-impossible to make it COMPLETELY unbreakable, but a little bit of safety would be nice...)

    Thanks in advance.

    yours,

    Ouguiya
     
  4. Robbepop

    Robbepop

    Joined:
    Mar 6, 2008
    Messages:
    892
    Resources:
    7
    Maps:
    6
    Spells:
    1
    Resources:
    7
    hiho,

    the banks are not encrypted and in XML format which can be easily edited.
    you as a map creator need a save code to prevent cheating like in wc3...

    Robbepop
     
  5. M0RT

    M0RT

    Joined:
    Apr 15, 2008
    Messages:
    1,067
    Resources:
    6
    Maps:
    3
    StarCraft II Resources:
    1
    Tutorials:
    2
    Resources:
    6
    Well since you need encryption, as robbepop mentioned, you'll need to store all data into one string, so you only really need one value per hero. The only problem would be if every character of string did count towards 80 values limit...
     
  6. The World Is Flat

    The World Is Flat

    Joined:
    Mar 9, 2009
    Messages:
    5,560
    Resources:
    4
    Icons:
    3
    Tutorials:
    1
    Resources:
    4
    Hopefully a beta editor limit. This version is very limited.
     
  7. thelifelessone

    thelifelessone

    Joined:
    Feb 7, 2009
    Messages:
    369
    Resources:
    1
    Tools:
    1
    Resources:
    1
    So, banks are like gamecaches, just better?
    Cool, now gimme a hashtable. :p
     
  8. tagg1080

    tagg1080

    Joined:
    Nov 28, 2008
    Messages:
    632
    Resources:
    0
    Resources:
    0

    Hashtables are freakin huge, but no one seems to care...
    Try using the datatables they give you, hopefully they are a little better on memory.




    The bank system is very limited, but a LOT of things are, I think we can assume that blizzard is not stupid enough to make these limits permanent.
     
  9. Mille25

    Mille25

    Joined:
    Sep 28, 2009
    Messages:
    217
    Resources:
    0
    Resources:
    0
    where is the sense of bank files if we again have to generate a save code? that would really suck.

    i have no problem with encrypting my bank to make it a bit saver (see my project thread for some examples) but i dont want to code a savecodesystem, really not ~~
     
  10. Thalassicus

    Thalassicus

    Joined:
    Jul 11, 2006
    Messages:
    38
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Seems you could just dump all the data into one long series of bytes, then run an algorithm on the bytes. Solves both the hacking and limit issues. Substitution-permutation with a hill cipher on top are very easy to code, and fast for a program to compute. An algorithm that combines all three would frustrate most hackers, and if they REALLY want to hack it that badly, they'll find a way no matter what you do.

    http://en.wikipedia.org/wiki/Substitution_cipher
    http://en.wikipedia.org/wiki/Permutation_cipher
    http://en.wikipedia.org/wiki/Hill_cipher
     
  11. M0RT

    M0RT

    Joined:
    Apr 15, 2008
    Messages:
    1,067
    Resources:
    6
    Maps:
    3
    StarCraft II Resources:
    1
    Tutorials:
    2
    Resources:
    6
    Well the problem is that, if I remember correctly, it uses 2 xml tags to save a single value.. so saving a boolean (1 bit) needs like 100 characters (100 bytes?)... so technically it would be "correct" to compress it into few larger values even without any limit.
    (I will be saving ship models into banks, 100x(boolean+2xinteger)=300x100=30 KB, and I was going to use some string generating system anyway 100x(1+2x8 bits)=1,7KB )
     
  12. Dr Super Good

    Dr Super Good

    Spell Reviewer

    Joined:
    Jan 18, 2005
    Messages:
    25,822
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    I say the cap is with the fact that the packets are restricted to certain sizes or the internet servers will refuse to redirect them correctly.

    Also I belive your multiplayer use of the banks is incorrect. Have you even tried using banks with more than 1 player? No? Well ofcourse not as you can not run multiplayer custom map tests currently and any loophole method is not supported by blizzard and so may or may not be present when custom map support is included.

    I think what happens is when you load a bank, it takes that bank for the player and then syncronizes it with everyone. The key word is syncronizes, it does not say merge or anything. Thus what probably happens is by doing that for a bank like "bt" of Player 1, it would load that bank for everyone with Player 1's bt bank. Thus you might find you are actually limited to 80 values per player or something however that can not be proved as you can not test custom maps with more than 1 player (third party does not really count as that might cause its own bugs). Setting it to load Player 2's "bt" bank would discard the entire contense of previous "bt" bank and then load Player 2's or something like that. It might get even more extreem and actually overwrite all other player's banks with that of the source player.

    80 values should be more than enough. You can get 32 flags per value. If strings are an axcepted value you can store endless quantities of data.
     
  13. Mille25

    Mille25

    Joined:
    Sep 28, 2009
    Messages:
    217
    Resources:
    0
    Resources:
    0
    ok, you might be right, maybe i overreacted a bit^^ so we all have to rewrite our banks a bit ~~

    but i still dont understand why blizzard gives us so much limits again, i still hope the map publishing patch will bring some changes.
     
  14. Dr Super Good

    Dr Super Good

    Spell Reviewer

    Joined:
    Jan 18, 2005
    Messages:
    25,822
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    Cause you could otherwise transfer whole data files through the internet?
     
  15. Mille25

    Mille25

    Joined:
    Sep 28, 2009
    Messages:
    217
    Resources:
    0
    Resources:
    0
    hm, whats the problem with that?^^
    why should someone send data files with starcraft? oO
     
  16. Doctor-Pepper

    Doctor-Pepper

    Joined:
    Aug 25, 2004
    Messages:
    481
    Resources:
    4
    Maps:
    3
    Tutorials:
    1
    Resources:
    4
    Im just happy we dont need to force players to type those strings anymore. They always lose or forget them
    I guess ill just make a 80char savestring that can be retyped to transfer the bank to an other computer
     
    Last edited: May 17, 2010
  17. M0RT

    M0RT

    Joined:
    Apr 15, 2008
    Messages:
    1,067
    Resources:
    6
    Maps:
    3
    StarCraft II Resources:
    1
    Tutorials:
    2
    Resources:
    6
    Well it seems that you can save strings to banks, so there shouldn't be a problem in generating old-fashioned save code and saving that, putting limitless amount of information into one variable.
    And yes, Dr Super God already mentioned that:
    Also, if you were to save multiple values into an integer, you should better use bit separation rather then decimal. (I used such system in my warcraft code generator, except the separation was totally irregular, and I was able to save 6 bits into one value (one character of 64)
     
  18. The World Is Flat

    The World Is Flat

    Joined:
    Mar 9, 2009
    Messages:
    5,560
    Resources:
    4
    Icons:
    3
    Tutorials:
    1
    Resources:
    4
    Is it possible for the galaxy editor to find and save an IP adress and save that into a bank?
     
  19. Dr Super Good

    Dr Super Good

    Spell Reviewer

    Joined:
    Jan 18, 2005
    Messages:
    25,822
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    The World Is Flat, why would you want to do that?

    An IP addresses is nothing more than an address used to represent a desternation mac when passed through IP tables. Its sole purpose is to make transfer through the internet easier and not act as a reference for who someone is.

    Your IP address can change, EG if I restart my router my ISP throws me a completly new IP address (from a pool of IPs for this area). Thus storing it in a bank would be stupid as what would it achieve?
     
  20. tagg1080

    tagg1080

    Joined:
    Nov 28, 2008
    Messages:
    632
    Resources:
    0
    Resources:
    0
    LOL!

    Try going through the stack next time, you will get the same response out of people, :thumbs_up:

    You need to understand that most people that mod are not computer people, lol