Save/Load

Do you need World Editor help? Ask here!
Forum rules
Before making a new topic:
First, check if your question has already been answered in the Tutorials section.
If you didn't find a solution, use the search function.
If searching didn't help either, you can make a new topic.

Topic title & content:
You must use a descriptive title. (Help plz is not good) (Need help with Dialog buttons is good)
Go into much detail when posting. You should post attachments. Like screenshots of the problem, the map you are making, replays of the error. Or you could even make a screencast (video) of your problem and upload it here.

Spelling:
Grammar seems to be a serious problem amongst teenagers, so use a spell checker or you will get no love.
Read your posts twice, before pressing the reply button.
And do not use profanity. Chatspeak (y r u nub) and Leetspeak (1 C4N S33 H4X) are not welcome here either.

Only World Editor related questions are allowed here!
(Click for Battle.net help) (Click for World Editor help)
PurePwnage
Posts: 3
Joined: Mon Jul 20, 2009 10:34 pm
Realm: US East
Account: Pure.Pwnage.
Location: Canada

Save/Load

Unread post by PurePwnage »

Does anyone know how to program in save + load strings?
I have triggers and such down fine and am trying to add this to my knowledge for later use...

User avatar
3ICE
Admin
Posts: 2629
Joined: Sat Mar 01, 2008 11:34 pm
Realm: Europe
Account: 3ICE
Clan: 3ICE
Location: Hungary
Contact:

Re: Save/Load

Unread post by 3ICE »

Regular users are not supposed to understand how to encode numbers into strings and prevent cheating with (a) checksum(s). That's why there are save load systems available. You don't have to know how they work, all you have to do is import a few triggers into your map and you are done. (It would take days to make your own save load system.)
ImageImageImageImageImage
Image
ImageImage

PurePwnage
Posts: 3
Joined: Mon Jul 20, 2009 10:34 pm
Realm: US East
Account: Pure.Pwnage.
Location: Canada

Re: Save/Load

Unread post by PurePwnage »

So; from what I gather - I use a player types "whatever" event - and then use triggers to give them a code specific to their unit
And then when they type this code into a game - it decompresses this code into the unit that has been saved...
I'm going to look through a few unprotected maps I have to see if I can find exactly how some people did this...

User avatar
3ICE
Admin
Posts: 2629
Joined: Sat Mar 01, 2008 11:34 pm
Realm: Europe
Account: 3ICE
Clan: 3ICE
Location: Hungary
Contact:

Re: Save/Load

Unread post by 3ICE »

Why not use a save load system?
ImageImageImageImageImage
Image
ImageImage

PurePwnage
Posts: 3
Joined: Mon Jul 20, 2009 10:34 pm
Realm: US East
Account: Pure.Pwnage.
Location: Canada

Re: Save/Load

Unread post by PurePwnage »

I guess I phrased my last post wrong - you said what it was I was trying to say - that I'd figure out how to make a save/load system
Anyhow I figured out how to create a save/load system in the past 10 mintes or so
And now I'm going to sleep - It's 1:11 over here

User avatar
manstie
Posts: 310
Joined: Wed Jun 17, 2009 9:27 am
Account: manstie
Location: Perth, Australia
Contact:

Re: Save/Load

Unread post by manstie »

Along the lines of save/load systems... How the hell did the makers of The Black Road 2.0 make it that whenever you save, then save 1 second later, the code is totally different to the previous one...
Image

User avatar
3ICE
Admin
Posts: 2629
Joined: Sat Mar 01, 2008 11:34 pm
Realm: Europe
Account: 3ICE
Clan: 3ICE
Location: Hungary
Contact:

Re: Save/Load

Unread post by 3ICE »

They have multiple encoding patterns.

Every time you save, a random encoding is used. The encodings have an id, which is also saved (unencoded). This makes it harder (but not impossible) to manipulate your savecode.

I believe hashing is a more clever way to prevent code manipulation.

EDIT: What I meant by hashing is adding a 2-4 characters long checksum (also called a hash sum) to the savecode. This way people can try to edit their codes all they want but it will not have any effect because they will have no chance of finding out what the new checksum is.

If I made an RPG, I would save a hero this way:

Hero type: Archer, Code: A
Hero level: 45, Code: 45

Player gold: 19455, Code: 19455

Player wood: 6, Code: 6

Item in Slot#1: Empty, Code: null
Item in Slot#2: Crown of Kings +5, Code: Crwn
Item in Slot#3: Boots of Speed, Code: Btos
Item in Slot#4: Empty, Code: null
Item in Slot#5: Empty, Code: null
Item in Slot#6: Potion of health, Code: Poht

Quest 1 status: Completed, Code: 3
Quest 2 status: Completed, Code: 3
Quest 3 status: Started, Code: 2
Quest 4 status: Discovered, Code: 1
Quest 5 status: Not discovered, Code: 0

Type and level: A45-
Gold and wood: 19455-6-
Items: nullCrwnBtosnullnullPoht-
Quests: 33210
Full savecode: A45-19455-6-nullCrwnBtosnullnullPoht-33210

Get a checksum: md5

We don't even have to encode (turn the code into something players don't understand) their savecode, the hash sum takes care of potential cheaters.

Savecode: A45-19455-6-nullCrwnBtosnullnullPoht-33210-md5

We can optimize the item code by replacing 4 char strings with 1-2 char numbers: A45-19455-6-0-16-27-0-0-2-33210-md5

The checksum changes with every minor modification of gold or other variable:
The hero kills a creep (levels up, gets gold) and saves again: A46-19500-6-0-16-27-0-0-2-33210-xav
The hero kills another creep (gets gold) and saves again: A46-19515-6-0-16-27-0-0-2-33210-upt
The hero kills another creep (gets gold) and saves again: A46-19535-6-0-16-27-0-0-2-33210-dmz
The hero kills another creep (gets gold) and saves again: A46-19610-6-0-16-27-0-0-2-33210-awg

And the chance of getting a 3 digit checksum right is:
Characters: abcdefghijklmnopqrstuvwxyz1234567890 (36)
Digits: 3
Exponentiation: 36^3 = 46656
Chance: 1:46656
Calculating percent: 0.00002%

As you can see, it is pretty low. :)
ImageImageImageImageImage
Image
ImageImage

User avatar
manstie
Posts: 310
Joined: Wed Jun 17, 2009 9:27 am
Account: manstie
Location: Perth, Australia
Contact:

Re: Save/Load

Unread post by manstie »

Can you explain what the new "Hashtable" trigger function is? And how could I possibly use it?

Random off-topic stuff: Have you seen that BlizzCon thing about the Starcraft II Editor? ****ing amazing.
Image

User avatar
3ICE
Admin
Posts: 2629
Joined: Sat Mar 01, 2008 11:34 pm
Realm: Europe
Account: 3ICE
Clan: 3ICE
Location: Hungary
Contact:

Re: Save/Load

Unread post by 3ICE »

No&No.

Don't post unrelated stuff to this topic... This is about save/Load, not hashtables!
ImageImageImageImageImage
Image
ImageImage

User avatar
manstie
Posts: 310
Joined: Wed Jun 17, 2009 9:27 am
Account: manstie
Location: Perth, Australia
Contact:

Re: Save/Load

Unread post by manstie »

But... you said hasing, I thought the two were related :x
Image

Post Reply

Who is online

Users browsing this forum: No registered users and 116 guests