Download

'Save code' generation tips

For a game I need a ‘Save code’ (or whatever it is called) (something like the first C&C game used to have, but for a different purpose). With this I mean a code that will contain all your progress and can be used by someone else, somewhere else to pick up where you left. The game will store ±30 parameters into this code which should be about 16 characters long and may contain letters and numbers. Obviously the easiest solution would be to instead use a 30 character save code, but since most parameters will only have 2-3 possible values I think it can be condensed into a shorter save code that’s easier to use.
I’ve been thinking about it and could use a fresh look on this problem. Any insight is welcome as I don’t expect an easy answer to this. Thanks for your time.

PS: I’m new to the forums and I’m not sure if I put this in the right subforum. :slight_smile:

if your parameters have only 1-3 different values, why not just appending the numbers?
i.e.
3133213
means the first variable has value 3, the second variable has value 1 and so on.

Sum up all values then convert decimal to hexa;
Example:

999999 = 000F423F

If different “achievements” must be tracked, then add another field to track score for each achievement, example:

123 - 456 - 999 - 321 =
7B - 1C8 - 3E7 - 141

To retrieve scores, convert hex strings back to decimals.

The problem is that the string would become longer than I want it to be, the shorter the better.

Thanks, this solves the problem! But the resulting hex string would still be too long.
If I use a base-36 instead of hexadecimal (base-1) this will reduce extremely large numbers to just a small string of letters and numbers, exactly what I needed.

Thanks for the idea!
Hexadecimal (base-16) won’t shorten the code enough though, but if I use a base-36 numbering system the remaining string will only be a fraction of the initial one.