wc3campaigns
WC3C Homepage - www.wc3c.netUser Control Panel (Requires Log-In)Engage in discussions with other users and join contests in the WC3C forums!Read one of our many tutorials, ranging in difficulty from beginner to advanced!Show off your artistic talents in the WC3C Gallery!Download quality models, textures, spells (vJASS/JASS), systems, and scripts!Download maps that have passed through our rigorous approval process!

Go Back   Wc3C.net > Warcraft III Modding > Developer's Corner > Triggers & Scripts
User Name
Password
Register Rules Get Hosted! Chat Pastebin FAQ and Rules Members List Calendar



Reply
 
Thread Tools Search this Thread
Old 11-29-2011, 06:27 PM   #1
cohadar
master of fugue
 
cohadar's Avatar
 
Join Date: Jun 2007
Posts: 2,453

Submissions (5)

cohadar is just really nice (250)cohadar is just really nice (250)cohadar is just really nice (250)cohadar is just really nice (250)cohadar is just really nice (250)

Default My thoughts on save/load codes.

Ok first we need alphanumeric base, standard one is this:
ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789

But I don't like it because it has 36 digits, I prefer binary, so lets remove 4 symbols:

ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
=>
ABCDEFGHJKLMNPQRSTUVWXYZ23456789

The reason I removed those:
1 is easy to mix with I
0 is easy to mix with O

This way there will be no mistyping problems.

Ok so we now have a nice 5-bit code (32 = 2^5)

If there are maximum of 32 permanent items in game we can now save 6 slot hero inventory with 6 codes, for example: 2G7-JJ8

Two more codes for hero level and one for parity check and we are done.
We have a save/load code in most easiest to remember 3x3 format.
C97-BB6-4AS

===================================================
Ok so my question is this:
Why I often see idiotic stuff in ORPG games like these:
3H0OY-HNJIW-YUI1H-7SJEV-PWL5J-IOP4S

???
__________________
Omg database crash deleted my signature, as a side effect this immensely improved wc3c.

Last edited by cohadar : 11-29-2011 at 06:28 PM.
cohadar is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 11-29-2011, 08:27 PM   #2
Anitarf
Procrastination Incarnate


Development Director
 
Join Date: Feb 2004
Posts: 8,190

Submissions (19)

Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)

2008 Spell olympics - Fire - SilverApproved Map: Old School Alliance TacticsHero Contest #2 - 3rd PlaceSpell making session 2 winner

Default

Oh, if Nestharus sees this there'll be trouble.
Quote:
Originally Posted by cohadar
Ok so my question is this:
Why I often see idiotic stuff in ORPG games like these:
3H0OY-HNJIW-YUI1H-7SJEV-PWL5J-IOP4S
Well, they likely save more data than what you just mentioned (I can easily imagine maps with more than 32 possible items, not to mention extended inventories and stashes). They also likely use a suboptimal algorithm, but as I already hinted at if you asked some people they'd likely consider yours as such as well.
__________________
Anitarf is offline   Reply With Quote
Old 11-29-2011, 09:46 PM   #3
cohadar
master of fugue
 
cohadar's Avatar
 
Join Date: Jun 2007
Posts: 2,453

Submissions (5)

cohadar is just really nice (250)cohadar is just really nice (250)cohadar is just really nice (250)cohadar is just really nice (250)cohadar is just really nice (250)

Default

Quote:
Originally Posted by Anitarf
They also likely use a suboptimal algorithm, but as I already hinted at if you asked some people they'd likely consider yours as such as well.
Nah my code is perfectly optimal.
Nestharus is just using a lot of mathematics to do a simple thing: reduce code size for unused inventory slots.

For example if hero has items only in 2 slots than 4 slots have code value zero:
C97-B40-000

so he can just display the short version to the player:
C97-B4

It is just most basic compression really.
__________________
Omg database crash deleted my signature, as a side effect this immensely improved wc3c.
cohadar is offline   Reply With Quote
Old 11-30-2011, 04:00 AM   #4
PurgeandFire111
User
 
PurgeandFire111's Avatar
 
Join Date: Dec 2006
Posts: 253

PurgeandFire111 will become famous soon enough (58)PurgeandFire111 will become famous soon enough (58)

Default

Well, if people are going for compression, then yes it can be very small. However, often people want to save other things, like experience, abilities, and other random data. (like position and whatnot)

Of course, the logical argument would be that half of those savings aren't needed, but obviously people will do it anyway. xD

The reason why Nes has to use so much math and conversions is because he is trying to systemize something that is often more map-specific. In doing so, he has to make sure there is a proper balance in security, speed, and compression, which is annoying when one is trying to keep the API friendly enough. :P

... but that is a bit off-topic. Overall, the reason why some people make such long codes is usually because:
1) Illogical reductions (ex: compressing object id's instead of using catalogues)
2) Storage of extra data (ex: position/hero name)
3) Security (ex: adding a player's name into the code)

Last edited by PurgeandFire111 : 11-30-2011 at 04:03 AM.
PurgeandFire111 is offline   Reply With Quote
Old 11-30-2011, 04:19 AM   #5
Ignitedstar
Moderator
 
Ignitedstar's Avatar


RP Section Moderator
 
Join Date: Jul 2005
Posts: 1,755

Ignitedstar has a spectacular aura about (102)Ignitedstar has a spectacular aura about (102)Ignitedstar has a spectacular aura about (102)Ignitedstar has a spectacular aura about (102)

Send a message via MSN to Ignitedstar Send a message via Yahoo to Ignitedstar
Default

I have always felt that save/load codes should be shorter. I thought that it couldn't be helped though, since I remember Vexorian making a save/load system that gave items different sets of data that could be recorded. For security measures, of course.
__________________
Current Activity: It's a secret, now.
Evaluation: I actually logged in?!?!
"If I speak in the tongues of men and of angels, but have not love,
I am only a resounding gong or a clanging cymbal.
If I have the gift of prophecy and can fathom all mysteries and all knowledge,
and if I have a faith that can move mountains, but have not love, I am nothing."

1 Corinthians 13:1-2

Current Works:
None.
Ignitedstar is offline   Reply With Quote
Old 11-30-2011, 07:27 AM   #6
cohadar
master of fugue
 
cohadar's Avatar
 
Join Date: Jun 2007
Posts: 2,453

Submissions (5)

cohadar is just really nice (250)cohadar is just really nice (250)cohadar is just really nice (250)cohadar is just really nice (250)cohadar is just really nice (250)

Default

Quote:
Originally Posted by PurgeandFire111
3) Security (ex: adding a player's name into the code)
This does not require any additional data.
Code is simply colored with user name (XOR-ed, Modulo multiplied, or something else)

And hero position does not need to be precise.
For example (-3451.7 , 7343.8) could be rounded to multiples of 64 (3456, 7296) without anyone noticing.
This saves 12 bits! Almost 3 letters.
__________________
Omg database crash deleted my signature, as a side effect this immensely improved wc3c.
cohadar is offline   Reply With Quote
Old 11-30-2011, 09:32 AM   #7
Anitarf
Procrastination Incarnate


Development Director
 
Join Date: Feb 2004
Posts: 8,190

Submissions (19)

Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)

2008 Spell olympics - Fire - SilverApproved Map: Old School Alliance TacticsHero Contest #2 - 3rd PlaceSpell making session 2 winner

Default

Quote:
Originally Posted by cohadar
This does not require any additional data.
Code is simply colored with user name (XOR-ed, Modulo multiplied, or something else)
That won't stop players from inputting random codes and getting valid, potentially powerful heroes. The number of random attempts that are needed to generate a valid code is directly proportional to the amount of junk data your code contains. Of course, it doesn't take many extra characters to make the odds satisfactory small, with only two extra 5-bit characters you can make only one in every thousand codes valid.

The trick however is to make it reasonably difficult for users to reverse-engineer your password generation algorithm. As long as individual items directly correspond with individual characters, the code is not too difficult to crack by saving a bunch of similar heroes and comparing the results. To make sure that the code is completely different for even small changes in input parameters, you need to do at least some sort of Nestharus-grade mathemagics.

You may think that a 9-character code is short enough, but you are storing hardly any data in it. As has been already pointed out, you're missing experience, position, abilities and quest status, you are limited to only 32 different storable items in only 6 slots and can't store item charges. Sure, for some maps what you store is enough, but for others there's all these things I listed and more and your approach would end up generating the same 30 character code you object to in your first post.
__________________
Anitarf is offline   Reply With Quote
Old 11-30-2011, 12:26 PM   #8
BBQ
User
 
Join Date: May 2011
Posts: 85

Submissions (2)

BBQ will become famous soon enough (30)BBQ will become famous soon enough (30)

Default

Cracking save/load codes is a breeze. Viewing a rather readable (more readable than Nestharus' code for sure) version of the war3map.j is very easy, even if the names had previously been shortened - and that allows you to generate your "own" code without any fuss. I am all against those codes, but that's just me.
Quote:
Originally Posted by cohadar
1 is easy to mix with I
0 is easy to mix with O
There is absolutely no reason to display the save/load code as an in-game message. Saving them to a *.txt file by abusing the preloading natives is just more intuitive. That way, there is no way to mix those up.

Last edited by BBQ : 11-30-2011 at 12:29 PM.
BBQ is offline   Reply With Quote
Old 11-30-2011, 01:27 PM   #9
cohadar
master of fugue
 
cohadar's Avatar
 
Join Date: Jun 2007
Posts: 2,453

Submissions (5)

cohadar is just really nice (250)cohadar is just really nice (250)cohadar is just really nice (250)cohadar is just really nice (250)cohadar is just really nice (250)

Default

Quote:
Originally Posted by BBQ
Saving them to a *.txt file by abusing the preloading natives is just more intuitive. That way, there is no way to mix those up.

Didn't know about this, could be very useful for debugging, link please.
__________________
Omg database crash deleted my signature, as a side effect this immensely improved wc3c.
cohadar is offline   Reply With Quote
Old 11-30-2011, 01:36 PM   #10
Fledermaus
default string
 
Fledermaus's Avatar
 
Join Date: May 2006
Posts: 705

Submissions (1)

Fledermaus is a jewel in the rough (194)Fledermaus is a jewel in the rough (194)Fledermaus is a jewel in the rough (194)

Send a message via MSN to Fledermaus
Default

Here. You could also just colourise your code before you print it out. Then you can use upper/lower case without worrying about Il1 mix ups.
Fledermaus is offline   Reply With Quote
Old 11-30-2011, 01:45 PM   #11
cohadar
master of fugue
 
cohadar's Avatar
 
Join Date: Jun 2007
Posts: 2,453

Submissions (5)

cohadar is just really nice (250)cohadar is just really nice (250)cohadar is just really nice (250)cohadar is just really nice (250)cohadar is just really nice (250)

Default

Tnx for link.

It really is not worth it to use lowercase letters.
It is just one more bit of information per symbol.
It is easier to add one or even two more symbols to your code than to have people type upper and lower case.

The whole point is to make a code that can be easily remembered.
__________________
Omg database crash deleted my signature, as a side effect this immensely improved wc3c.
cohadar is offline   Reply With Quote
Old 11-30-2011, 09:26 PM   #12
Ignitedstar
Moderator
 
Ignitedstar's Avatar


RP Section Moderator
 
Join Date: Jul 2005
Posts: 1,755

Ignitedstar has a spectacular aura about (102)Ignitedstar has a spectacular aura about (102)Ignitedstar has a spectacular aura about (102)Ignitedstar has a spectacular aura about (102)

Send a message via MSN to Ignitedstar Send a message via Yahoo to Ignitedstar
Default

Okay, so the point is to make a code that can be easily remembered. Well, there's no point in many of the arguments above, then. We need long strings of code, because we were talking about maps that need to store lots of data. Namely RPG-like maps.

If we have a map like Elimination Tournament where the only thing someone would need to keep track of is their score with their name attached to it (plus maybe a few extra things for security), then of course the save code will be small. There's not as much data that needs to be saved.

But everyone knows these two points, already. This discussion doesn't seem to be getting anywhere.
__________________
Current Activity: It's a secret, now.
Evaluation: I actually logged in?!?!
"If I speak in the tongues of men and of angels, but have not love,
I am only a resounding gong or a clanging cymbal.
If I have the gift of prophecy and can fathom all mysteries and all knowledge,
and if I have a faith that can move mountains, but have not love, I am nothing."

1 Corinthians 13:1-2

Current Works:
None.
Ignitedstar is offline   Reply With Quote
Old 12-01-2011, 07:05 AM   #13
cohadar
master of fugue
 
cohadar's Avatar
 
Join Date: Jun 2007
Posts: 2,453

Submissions (5)

cohadar is just really nice (250)cohadar is just really nice (250)cohadar is just really nice (250)cohadar is just really nice (250)cohadar is just really nice (250)

Default

May I just add that storing lot of data is not an excuse to have long codes when data is as much correlated like in rpg games.

For example if you need to save heroes STR/AGI/INT you don't have to store values like 513/345/678 because heroes stats depends heavily on hero level. In fact if there are no tomes in the game the level and hero type is all you need to determine str/agi/int

And if there are you just store deltas from expected values for a hero of that level: +12/-7/+5

Same can be done with items, in fact most RPG games have level requirement for items, so more optimizations.

A little math can go a long way...
__________________
Omg database crash deleted my signature, as a side effect this immensely improved wc3c.
cohadar is offline   Reply With Quote
Old 12-02-2011, 08:02 PM   #14
Ignitedstar
Moderator
 
Ignitedstar's Avatar


RP Section Moderator
 
Join Date: Jul 2005
Posts: 1,755

Ignitedstar has a spectacular aura about (102)Ignitedstar has a spectacular aura about (102)Ignitedstar has a spectacular aura about (102)Ignitedstar has a spectacular aura about (102)

Send a message via MSN to Ignitedstar Send a message via Yahoo to Ignitedstar
Default

You're right; that's how I would code the save/load codes in my map, too. Since a hero's stats is (mostly) dependent on the hero's level, all you'd need to save is the level of the hero and any added stats that they've grabbed.

Thinking of ways to minimize or making save/load codes as short as possible is a better way to phrase it. It's a big difference than saying "codes get long and tedious, make them short".
__________________
Current Activity: It's a secret, now.
Evaluation: I actually logged in?!?!
"If I speak in the tongues of men and of angels, but have not love,
I am only a resounding gong or a clanging cymbal.
If I have the gift of prophecy and can fathom all mysteries and all knowledge,
and if I have a faith that can move mountains, but have not love, I am nothing."

1 Corinthians 13:1-2

Current Works:
None.

Last edited by Ignitedstar : 12-02-2011 at 08:04 PM.
Ignitedstar is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off


All times are GMT. The time now is 09:57 AM.


Affiliates
The Hubb The JASS Vault Clan WEnW Campaign Creations Clan CBS GamesModding Flixreel Videos

Powered by vBulletin (Copyright ©2000 - 2019, Jelsoft Enterprises Ltd).
Hosted by www.OICcam.com
IT Support and Services provided by Executive IT Services