System The Shortest Save/Load Code Ever

SerraAvenger

Cuz I can
Reaction score
234
NOTE:
I think I read some time ago that your system doesn't use multiple integers, instead it tries to save as much info into one integer as possible in order to save space...
Just in case you really map n-dimensional arrays into integers (I did that), this might be intersting for you...

length = Log_base( integer + 1)
adding codes:
length = length1 + length2 = Log_base( integer1 + 1 ) + Log_base( integer2 + 1 ) = Log_base( integer1 * integer2 + integer1 + integer 2 + 1 )
mapping n-dimensional arrays:
length = Log_base( integer1_max * integer2 + integer1 +1 )
since integer1_max >= integer1,

integer1_max * integer2 >= ( integer1 + 1 ) * integer2 (in any reasonable case it's > )

hence it is actually stupid to compress everything into one integer, lots of space will be lost. In fact it should be clever to encode every number on its own and use + and - as a seperator. That way you can save _any_ JASS integer in upto x digits (with a reasonable base of 36, that would be log(2^31)/log(36)=31*log(2)/log(36)=5.99=> 6 ), which is absolutely fine. The smaller the integer, the shorter the code... That is the most clever "compression" I can actually think of.
(example code, in base 10)
+304-41423-425+3566
->
+304
-41423
-425
+3566
In base 36 the code would ofc get much shorter.


If you find any flaws, plz tell me....
 

Zwiebelchen

You can change this now in User CP.
Reaction score
60
I use KODE in Gaias Retaliation ORPG; however, I got a really strange problem:

When reaching a certain number of digits (I think at around 12 blocks a 4 digits or something), the system doesn't load anymore. There is no invalid code displaying and the "loading lag" occurs. However, nothing else happens. It works fine with shorter codes, though (for example saving with the progressive int being 0)

May it be possible that KODE can not save up to that many digits?

This is what we store:

- a progressive int (10,5) ... common values at around 1000-10000
- ordinary ints: 1000, 12x300, 12x2, 3x200, 51, 7, 20, 50x4


EDIT: testet it with the following edit of the KODE's source code:
JASS:

function load_code takes player p, integer security, string s returns boolean
    local integer num_chars
    call BJDebugMsg("KODE executed")
    call clear_bits()
    set num_chars = parse_code(s)
    call decrypt(p, get_num_bits_supported(num_chars))
    call BJDebugMsg("KODE did reach end")
    return is_valid(security)
endfunction

As expected, only the first message is displayed.

In fact, everything works fine until decrypt.
 

SerraAvenger

Cuz I can
Reaction score
234
Try to put a couple of waits into the decrypt loop, then see if it _still_ stops working with so many digits. Sounds like an OP problem to me. If it works then, but you don't want to have that pause, you'll need a system that doesn't encrypt/decrypt but uses hashsums... I could code you one, if you want.
 

Zwiebelchen

You can change this now in User CP.
Reaction score
60
Hmm, I set the encryption strength lower and it works ...

Seems like there is a need to split the decryption process into multiple threads to avoid operation limit.
Feel free to write an optimized system SerraAvenger, I think Korolen is fine with that too. ^^
 

SerraAvenger

Cuz I can
Reaction score
234
Hmm, I set the encryption strength lower and it works ...

Seems like there is a need to split the decryption process into multiple threads to avoid operation limit.
Feel free to write an optimized system SerraAvenger, I think Korolen is fine with that too. ^^

Glad you got it to work.

I won't copy this system just to make it avoid the op limit. I'm no fan of heavy decription / encription after all when it comes to save load codes... Doesn't make them harder to crack, but means a lot of hazzle. Mapping to a different alphabet would be more than enough, if you ask me.

wishes, Davey
 

Zwiebelchen

You can change this now in User CP.
Reaction score
60
Well, I encountered another problem with KODE, which is something I can not fix without a new security method.

The problem is, that KODE does not recognize in its validy checker, wether a letter is capital oder lowercase.

This means that if you load a code with the exact same letters, but without the right caps (if you used a 62 letter system), the code loads (and of course, returns weird results) ...
A checksum validy checker may be the better solution here, so I would gladly take your offer to improve KODE @SerraAvenger.
 

xXGauntletXx

New Member
Reaction score
4
After looking at kode, then gobbledygook (sp?) it seemed much easier to edit gobbledygook than kode.
To make kode MPI took much more work than to change 1 value in gobbledygook.
 

Korolen

New User (Why do I keep getting those red bars?)
Reaction score
69
Kode is MPI, last time I checked.

Kode is neither MPI nor not MPI, the categorization doesn't really apply to a save/load system. Kode can generate codes for as many players as you need it to, one right after the other.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top