Players who are playing my map are often loosing their banks. Problem appear to be not my fault, but...
I'm using starcode, to encrypt banks. People report that they loose exp and it sometimes return in next game. When I start game with my bank broken (bank not loaded properly) and then try to load it in another game (or in editor) sometimes it work properly, sometimes not. I think data may be lost because of saiving current progress (but we have no progress, because bank was not loaded). I'm loading data at start of game and saving at end.
No triggers errors. Players are getting message like "Your bank file is corrupted", so Validate String fail (maybe, because nothing was loaded from bank).
Someone have similar problems?
My banks have 317 bytes.
Here's code, IDK if something is wrong with it - works 90% time:
// Bank preload trigger w/o events, never calledBank-Preloadandsynchronizebank"TheThingBank"forplayer1(...)Bank-Preloadandsynchronizebank"TheThingBank"forplayer14// Banks init tigger, called in map init triggerPlayerGroup-Pickeachplayerin(ActivePlayers)anddo(Actions)ActionsGeneral-If(Conditions)thendo(Actions)elsedo(Actions)If(Controllerofplayer(Pickedplayer))==UserThenBank-Openbank"MyBank"forplayer(Pickedplayer)Variable-SetBanks[(Pickedplayer)]=(Lastopenedbank)BanksLoad((Pickedplayer))Else// Banks Load acton definitionVariable-SetTempString=(Loadkey"key"ofsection"scetion"frombankBanks[Player]asaString)General-If(Conditions)thendo(Actions)elsedo(Actions)IfAndConditionsTempString!=""(<Starcode>ValidateString(TempString,4))==True// this is failingThenVariable-SetTempString=(<Starcode>RemoveHashfromString(TempString,4))Variable-SetTempString=(<Starcode>DecryptString(TempString,BanksEncryptionkey))Variable-SetTempString=(<Starcode>DecompressString(TempString))<Starcode>SetCode(TempString)Variable-SetSomeVar=(<Starcode>GetIntegerValue(500))UI-Display("Your archive version: "+(Text(ArchiveVer)))for(Playergroup(Player))toDebugareaElseUI-Display"Your bank file is corrupted, new filecreated instead"for(Playergroup(Player))toSubtitlearea// and pple are getting this message
Just pointing out the first thing that jumps to my mind-
// Banks init tigger, called in map init triggerPlayerGroup-Pickeachplayerin(ActivePlayers)anddo(Actions)ActionsGeneral-If(Conditions)thendo(Actions)elsedo(Actions)If(Controllerofplayer(Pickedplayer))==UserThenBank-Openbank"MyBank"forplayer(Pickedplayer)Variable-SetBanks[(Pickedplayer)]=(Lastopenedbank)BanksLoad((Pickedplayer))Else
Unless I'm mistaken, you cannot use anything but implicit values for "Open Bank". Try opening each bank and assigning to to a variable separately, instead of through a loop. I'm not 100% sure if this is correct (or if I'm getting this mixed up), so check the action description to be sure.
That could be an issue, though I doubt it's related to what you're describing. The issue could be related to how you save your banks- are you doing everything in the right order (reverse of how you load it)?
Rollback Post to RevisionRollBack
Feel free to Send me a PM if you have any questions/concerns!
Sadly there is alot of wrong information in this thread.
"Open bank" works well with variables, loops and so forth. The only action that needs literal values is "Preload bank", thats because its actually not a real function in script, instead it just adds a line to a file in the maps .mpq that tells the game which banks to preload before the source code gets loaded.
About your problem:
I cant tell 100% whats causing it, but you pretty much nailed it down by yourself already, didnt you?
Since sometimes the bank validation fails it could either be a problem of Starcode (for example if your bank file contains characters that are not part of the encryption alphabet) or it could be an engine overload. This can happen if to much bank data is loaded at the same time, resulting in some banks not getting loaded properly. Note that an empty bank key will return "false" for starcode validation.
If you encounter a bank validation failure in game 1 while the bank works in game 2, this would point towards an engine overload or maybe a trigger execution limit (Note: Starcode is very slow depending on the size of keys etc). Try to insert small waits within the "Load Banks" function after each player and see if it fixes the issue.
Additionally try to place more debug messages everywhere in your script. Did the trigger get run for player X? What exactly is the value of the bank key? etc etc
Also make sure that the trigger debug window is open in your tests (Also in multiplayer!) to track eventual script errors.
Finding issues of this sort can take some time and you need to make small steps in order to succeed.
zelda speaks truth.... you need to use a hard coded player integer value for the "bank - open bank" statement
Don't think so. If it was issue it wouldn't work in 100% cases, not in 1%, right?
Mille25:
My banks have 300-500 bytes. I don't think that it could cause problems. Script is executed for 100%, because each player see error message (not trigger execution limit or trigger error then). I'll check what's loaded, that's good idea. Invalid characters aren't issue too, because whole string is created by starcode. Also bank one time is loaded and second time it is not, so it can't be saving problem.
Opening debug window in multiplayer is bad idea, because players could cheat in game, also it never happened to me. This problem is bothering me for couple months, (I'm even not playing this map really often), just players cry about loosing their progress.
Just wanted to chime in ShadowDancer... I had tons of these issues with banks with my map Death Haven. When it was popular, I was restoring bank files for pages of people every day lol... and Death Haven saves kills to bank fairly often.
I put in a safety where I had another bank that would save every 5s and if the main bank came back blank, I would then pull from the 5s one.
I think the issue is if the file is being written and someone disconnects, it wipes it. I believe it's a Blizz issue :/
never had that problem in my map but also i only save map when someone leaves games and in game end no need to be allways saving i think just load on start and save everything at exit
I dunno about you guys, but i stopped using the preload and synchronize statements. I also hardcode the values of each open statement. I find it works much better this way.
Rollback Post to RevisionRollBack
Skype
KageNinpo = SN
My Libraries
DialogLeaderboard & TeamSort
My Projects
SPACEWAR Tribute
Infinite TD
I'm saving more entries than most people, I'm saving much more often than most people. I'm not aware of any problems appearing with my banks. =/
Maybe some char combinations that starcode adds that the banks accidentally not like?
You can either accept it as some sort of mysterious, random bug, or you can start to remove/change components of your save system in order to track down the potential mistake. If you dont really accept any tips, why do you even ask for them?
The "sometimes loaded, sometimes not" thing is not a proof that its not Starcode. Your source code also doesnt change at all and it still happens. Therefore it could either really be a Blizzard bug, or an issue in your code that isnt that obvious.
From my personal experience I can tell that banks sometimes behave a little bit weird, as an example i had pretty much the same issue as you describe here (banks randomly not loaded) and managed to fix it with a 0 second wait in the load-player-loop. My banks were alot bigger though. However, there were 0 logical mistakes in my source code that could explain the problem, meaning that it was some sort of internal engine problem (not able to load so much bank data at once, whatever)
Looks like adding small waits fixed problem (at least nothing bad happened until now). In addition I created second backup bank, saved after "normal", and loaded when normal fail (but I don't know if it was necessary). When I gather more data I'll post it.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Players who are playing my map are often loosing their banks. Problem appear to be not my fault, but... I'm using starcode, to encrypt banks. People report that they loose exp and it sometimes return in next game. When I start game with my bank broken (bank not loaded properly) and then try to load it in another game (or in editor) sometimes it work properly, sometimes not. I think data may be lost because of saiving current progress (but we have no progress, because bank was not loaded). I'm loading data at start of game and saving at end. No triggers errors. Players are getting message like "Your bank file is corrupted", so Validate String fail (maybe, because nothing was loaded from bank).
Someone have similar problems? My banks have 317 bytes. Here's code, IDK if something is wrong with it - works 90% time:
Just pointing out the first thing that jumps to my mind-
Unless I'm mistaken, you cannot use anything but implicit values for "Open Bank". Try opening each bank and assigning to to a variable separately, instead of through a loop. I'm not 100% sure if this is correct (or if I'm getting this mixed up), so check the action description to be sure.
That could be an issue, though I doubt it's related to what you're describing. The issue could be related to how you save your banks- are you doing everything in the right order (reverse of how you load it)?
@zeldarules28: Go
zelda speaks truth.... you need to use a hard coded player integer value for the "bank - open bank" statement
Inside the loop you can use a switch statement per player
and put the hard coded statement in there for each player that could possibly be playing.
@SouLCarveRR: Go yeah, thats how you do it.
Just like you used Preload.
Sadly there is alot of wrong information in this thread.
"Open bank" works well with variables, loops and so forth. The only action that needs literal values is "Preload bank", thats because its actually not a real function in script, instead it just adds a line to a file in the maps .mpq that tells the game which banks to preload before the source code gets loaded.
About your problem:
I cant tell 100% whats causing it, but you pretty much nailed it down by yourself already, didnt you? Since sometimes the bank validation fails it could either be a problem of Starcode (for example if your bank file contains characters that are not part of the encryption alphabet) or it could be an engine overload. This can happen if to much bank data is loaded at the same time, resulting in some banks not getting loaded properly. Note that an empty bank key will return "false" for starcode validation.
If you encounter a bank validation failure in game 1 while the bank works in game 2, this would point towards an engine overload or maybe a trigger execution limit (Note: Starcode is very slow depending on the size of keys etc). Try to insert small waits within the "Load Banks" function after each player and see if it fixes the issue.
Additionally try to place more debug messages everywhere in your script. Did the trigger get run for player X? What exactly is the value of the bank key? etc etc Also make sure that the trigger debug window is open in your tests (Also in multiplayer!) to track eventual script errors.
Finding issues of this sort can take some time and you need to make small steps in order to succeed.
Don't think so. If it was issue it wouldn't work in 100% cases, not in 1%, right?
Mille25: My banks have 300-500 bytes. I don't think that it could cause problems. Script is executed for 100%, because each player see error message (not trigger execution limit or trigger error then). I'll check what's loaded, that's good idea. Invalid characters aren't issue too, because whole string is created by starcode. Also bank one time is loaded and second time it is not, so it can't be saving problem.
Opening debug window in multiplayer is bad idea, because players could cheat in game, also it never happened to me. This problem is bothering me for couple months, (I'm even not playing this map really often), just players cry about loosing their progress.
Just wanted to chime in ShadowDancer... I had tons of these issues with banks with my map Death Haven. When it was popular, I was restoring bank files for pages of people every day lol... and Death Haven saves kills to bank fairly often.
I put in a safety where I had another bank that would save every 5s and if the main bank came back blank, I would then pull from the 5s one.
I think the issue is if the file is being written and someone disconnects, it wipes it. I believe it's a Blizz issue :/
Ach, nearly forgot. I'm opening banks once at game start, and saving them when i write something. Is it correct?
@ShadowDancer93: Go
That sounds right to me if my memory is correct.
never had that problem in my map but also i only save map when someone leaves games and in game end no need to be allways saving i think just load on start and save everything at exit
Try to completly remove Starcode from your save system and see if it fixes the issue.
@Mille25: Go
I dunno about you guys, but i stopped using the preload and synchronize statements. I also hardcode the values of each open statement. I find it works much better this way.
I'm saving more entries than most people, I'm saving much more often than most people. I'm not aware of any problems appearing with my banks. =/
Maybe some char combinations that starcode adds that the banks accidentally not like?
But bank is sometimes loaded, sometimes not. Exacly the same bank file.
Well, ive understood that.
You can either accept it as some sort of mysterious, random bug, or you can start to remove/change components of your save system in order to track down the potential mistake. If you dont really accept any tips, why do you even ask for them?
The "sometimes loaded, sometimes not" thing is not a proof that its not Starcode. Your source code also doesnt change at all and it still happens. Therefore it could either really be a Blizzard bug, or an issue in your code that isnt that obvious.
From my personal experience I can tell that banks sometimes behave a little bit weird, as an example i had pretty much the same issue as you describe here (banks randomly not loaded) and managed to fix it with a 0 second wait in the load-player-loop. My banks were alot bigger though. However, there were 0 logical mistakes in my source code that could explain the problem, meaning that it was some sort of internal engine problem (not able to load so much bank data at once, whatever)
Looks like adding small waits fixed problem (at least nothing bad happened until now). In addition I created second backup bank, saved after "normal", and loaded when normal fail (but I don't know if it was necessary). When I gather more data I'll post it.