Saving / Loading Tutorial

Steel

Software Engineer
Reaction score
109
Originally posted at jx3.net/tdg, since the formatting is different between forums I can't post the entire thing here without a lot of grief. Our size tags differ from TH's.

These steps show how to save a hero's level / experience. This has been considered extremely difficult but as you can see for yourself, it is easier than you think. Saving units and loading them is quite simple since there is a function there.

The Tutorial

The original post also contains a demo map.
 

Renendaru

(Evol)ution is nothing without love.
Reaction score
309
...I touched on banks already. Though you touched on a more specific area, then I did at least.

So bleh, but a nice contribution nonetheless.
 

Steel

Software Engineer
Reaction score
109
...I touched on banks already. Though you touched on a more specific area, then I did at least.

So bleh, but a nice contribution nonetheless.

Well yes, banks themselves are VERY easy. You're just stuffing things into an XML file. That isn't hard, what is hard is how to do very specific things with banks. Mine uses banks to illustrate how to make a save / load system in a game. As I stated in the tutorial this is a working and functional way to save a hero's experience / level. I believe I am the first to have this working.
 

Renendaru

(Evol)ution is nothing without love.
Reaction score
309
Well yes, banks themselves are VERY easy. You're just stuffing things into an XML file. That isn't hard, what is hard is how to do very specific things with banks. Mine uses banks to illustrate how to make a save / load system in a game. As I stated in the tutorial this is a working and functional way to save a hero's experience / level. I believe I am the first to have this working.

I've had that working since I first saw a bank... I don't see how so many people see the editor as advanced, only the data editor, and its only reason, is because we are as fish out of water with such a thing.

Most features are missing, but with what's there, it's all self-evident, at least if you're paying attention.
 

Steel

Software Engineer
Reaction score
109
How did you trigger experience to modify the veterancy behavior?

Yea, exactly. Not that easy.
 

Renendaru

(Evol)ution is nothing without love.
Reaction score
309
How did you trigger experience to modify the veterancy behavior?

Yea, exactly. Not that easy.

I am not sure how to answer, as I am not getting the phrasing of the question...
 

Steel

Software Engineer
Reaction score
109
I am not sure how to answer, as I am not getting the phrasing of the question...

1. How do you save a hero's experience from the veterancy behavior?
2. How do you load a hero's experience into a veterancy behavior?

Those are not easy things to address.
 

Renendaru

(Evol)ution is nothing without love.
Reaction score
309
As to getting the Experience, I know you can use "UnitXPTotal (unit inUnit)" to get the unit's experience. However, I have not figured out how to give experience, I had thought you meant figuring out what it was...
 

Yoshii

New Member
Reaction score
74
Nice work that will help those who dindt play around with the banking system.I played with it as soon as editor came out but the issue still remain, the saved variable are saved on your computer in a very easily editable format..
 

dudeim

New Member
Reaction score
22
ok just a question this was posted below the tutorial as to show how the xml bank file looks like

Code:
<?xml version="1.0" encoding="utf-8"?>
<Bank version="1">
    <Section name="Hero">
        <Key name="Experience">
            <Value fixed="12"/>
        </Key>
        <Key name="Unit">
            <Type string="Archon2"/>
            <Shields fixed="350"/>
            <Life fixed="170"/>
            <Energy fixed="0"/>
        </Key>
    </Section>
</Bank>

wouldn't it be really easy for a player to just edit it to this

Code:
<?xml version="1.0" encoding="utf-8"?>
<Bank version="1">
    <Section name="Hero">
        <Key name="Experience">
            <Value fixed="12"/>
        </Key>
        <Key name="Unit">
            <Type string="Archon2"/>
            <Shields fixed="99999"/>
            <Life fixed="99999"/>
            <Energy fixed="99999"/>
        </Key>
    </Section>
</Bank>

this way the hero would have lost of health energy and shield...
so how would this be solved? that players won't edit it.
 

Cookiemaster

New Member
Reaction score
36
Would this work crossmap?

And would it be possible to use this in multiplayer (with different players every game) by use of some clever structure?





ok just a question this was posted below the tutorial as to show how the xml bank file looks like

Code:
<?xml version="1.0" encoding="utf-8"?>
<Bank version="1">
    <Section name="Hero">
        <Key name="Experience">
            <Value fixed="12"/>
        </Key>
        <Key name="Unit">
            <Type string="Archon2"/>
            <Shields fixed="350"/>
            <Life fixed="170"/>
            <Energy fixed="0"/>
        </Key>
    </Section>
</Bank>

wouldn't it be really easy for a player to just edit it to this

Code:
<?xml version="1.0" encoding="utf-8"?>
<Bank version="1">
    <Section name="Hero">
        <Key name="Experience">
            <Value fixed="12"/>
        </Key>
        <Key name="Unit">
            <Type string="Archon2"/>
            <Shields fixed="99999"/>
            <Life fixed="99999"/>
            <Energy fixed="99999"/>
        </Key>
    </Section>
</Bank>

this way the hero would have lost of health energy and shield...
so how would this be solved? that players won't edit it.
You could encrypt the values. (Just like changing random things in a save/load code in wc3 often returns "invalid save code!")
 

Zwiebelchen

You can change this now in User CP.
Reaction score
60
Why not just use a savecode compiler like we used in WC3 (you know, generating a string out of multiple integers) and simply store that string to the bank?
That way you have perfect encryption ... And additional name-safety, so that players can't just copy and pass their bank data to another player.
 

celerisk

When Zerg floweth, life is good
Reaction score
62
You don't need to encrypt everything.

Something like
md5( 'my secret password' + 'celerisk' + string(123) )
goes a long way in making sure that the values you read back are legit.

The problem though is that anyone who knows how the code was calculated can easily re-create it.
Presumably that problem is solved once you can protect your map.
If you get the actual source though... reading will do.
 

Steel

Software Engineer
Reaction score
109
There are various ways to encrypt data. You can change the names of the keys and sections of the bank however you like. I have taken cryptography classes before, I don't want to put forth the effort here on this for now. To address the single issue of setting someone's shields and health above their maximum, you can't do that...I don't think. You can't increase something's health over their maximum.

Either way this is a tutorial about saving and loading data, encryption is your job!
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top