Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
So pretty much what the title says, an easy explanation of how to add -save and -load commands into my orpg homemade map. I find the other instructions I've found very hard to understand. Please #Confused.![]()

You never save the user name as part of the code. Instead you use the case insensitive user name as part of a key. The user name key can be part of the hash or be used to modify the encryption key. The result is that you deal with two problems at once, both protecting the code from modification and name locking it.one part of this is the same thing but for the username so you can't just steal other peoples "saves" since they're not actual "saves" but just codes that you could technically enter without ever saving once.
The other approach is to use it as part of the hash. You can even do both although modifying the encryption key is probably the better of the two (unique codes between players) and is good enough by itself.One technique I like to use to ensure code uniqueness is to use the player's name and some other stuff as the key when I encrypt the code. This means that if any other players tries to load it, they'll decrypt it wrong and got an invalid code back.
This is how to produce optimum codes at the cost of extra runtime overhead doing the highly complicated long multiplication and divisions required.How do we combine those into one number?
1*10 + 7 = 17
17*10 + 2 = 172
Now, it's a little bit more complicated than this, but that's how save/load systems work. You need a special system in order to handle very large numbers. Division is especially painful : ).
A hacky approach is to use the same load function with conditional statements to change the values loaded. In theory this degrades load performance as the number of versions increase however this should not really matter.Next we have versioning. Versioning is used when you want different versions of your code. For example, you add 3 new items to the map or some new thing to save. Without a versioning system, you won't be able to read older codes because you'll be trying to read values that aren't there (or vice versa). All you do is add a version value to the code and you're set. I like to do something special to make this version value as small as possible : ). The version value will tell you which loader to use so that you read the code correctly. You will always only have 1 saver because you'll always want to save in the latest format.
All this would be super helpful information if this was The Lab. But this thread was made by a user who probably uses GUI and is probably a beginner to coding in general.You never save the user name as part of the code. Instead you use the case insensitive user name as part of a key. The user name key can be part of the hash or be used to modify the encryption key. The result is that you deal with two problems at once, both protecting the code from modification and name locking it.
The other approach is to use it as part of the hash. You can even do both although modifying the encryption key is probably the better of the two (unique codes between players) and is good enough by itself.
This is how to produce optimum codes at the cost of extra runtime overhead doing the highly complicated long multiplication and divisions required.
Logically it is far simpler to use powers of two for the size of numbers. A vector of bits can deal with this and inserting elements into it becomes highly efficient and a matter of bitwise shifts and masking. This may or may not be more efficient in WC3 due to the lack of native bitwise operators for the integer type however in StarCraft II it will likely be orders of magnitude faster. The resulting bit vector is perfect to feed into standard hashing and encryption algorithms.
A hacky approach is to use the same load function with conditional statements to change the values loaded. In theory this degrades load performance as the number of versions increase however this should not really matter.