[💡Feature Preview] Import/Export saves
Added 2022-02-20 16:10:48 +0000 UTCHello all,
I hope you are still doing great. 😃
Progress on the next tease has been steady over the last weeks. The majority of time went into collecting and sorting picture sets so far, but I also managed to improve the technical aspect of the tease.
One thing that limited 'Tale of the Succubus Hunter' and 'Triple X-COM' a lot was the storage limit. For example: I had to cut down the amount of save slots to 2 (3 were planned), and there are unsolved bugs with the save system for some players which are almost impossible to fix due to a lack of reporting features... (some unlucky players can't save their games past day ~9 and I haven't found out why, yet)
That's why I'm experimenting with a (rather hacky) Import/Export - Feature! Here is a rundown:
- Only 1 save will be stored in EOS at any given time, which results in more possible variables. (in comparison to 2 or more save slots)
- The current saved game can be exported into a string of text. Means there won't be a limit of how many saves you can store.
- Saved strings can be imported, which loads the relevant saved game.
- As a side-effect, this will allow me to troubleshoot bugs more easily and we will be able to fix/modify save files.
There is no rocket science behind this. It just somewhat bypasses a few of the most limiting features of EOS.
I also have updated the title of the next tease: Trouble on Demon Island.
It will have chapters like some of my previous story-based teases. Once the first chapter is complete, I will release a demo version of it.
Anyways, that's it for now!
Thank you for your support and remember to have a great day. 💗
Comments
I guess an old, reliable for cycle is the best solution, most of the times 😂
Thamrill
2022-02-24 08:21:43 +0000 UTCUgh, seems like EOS doesn't like array.forEach(). Modules don't load when using that in the init script. Gonna create a workaround.
MisterFlames
2022-02-23 18:34:44 +0000 UTCThanks for sharing. 😁 I see, so I'll stick with toString(36) for now. My compression and decompression functions seem good to go now, in case you are interested: https://pastebin.com/FmXV9SaZ It needs a multidimensional array with the arrays ['strings'], ['booleans'] and ['integers']. I tried to use typeof to sort a single array with multiple types of variables at first, but I realized that I can't (easily) sort them back to their original index without increasing the size of the string. And I have to be careful with strings. They are not allowed to contain ".", ":" and "#".
MisterFlames
2022-02-23 16:07:29 +0000 UTCAlso, I got my numbers wrong; my encoding of 123456789 is "4gs(j" and even running tests up to almost a billion, using my algorithm you save at most 1 character, and the efficiency is also strongly dependent on number range. So maybe the complexity of my algorithm is not really worth, unless you have many integer variables
Thamrill
2022-02-23 10:19:10 +0000 UTCI uploaded it here: https://pastebin.com/KKgiDBz7
Thamrill
2022-02-23 10:02:58 +0000 UTCSorry if my previous answers were separate comments, mobile wouldn't let me answer to a comment but only posting a new comment. Anyhow, i wrote the code to perform coding and decoding of numbers. It's a bit cumbersome and in no way optimized, but at least works for the interval 0-99'999'999, i tried testing them up to a billion, but the online editor gave up XD.
Thamrill
2022-02-23 10:00:47 +0000 UTCThanks for your help. Seeing how much booleans can be compressed that way, I will use them more than I planned to.
MisterFlames
2022-02-23 06:43:03 +0000 UTCJust convert the list of booleans to a binary string, then parseInt with base two to convert to an integer and then process it just as any other integer. For decoding, extract the integer, toString(2) it, add leading zeros to the desired length and convert back from zeros and ones to falses and trues. I currently have a function that takes an integer and returns a single character, I just need to make it work for larger number, which should be easy
Thamrill
2022-02-23 05:52:20 +0000 UTC1. Ah, didn't think about that. Would it still be decompressable when I use twos? In the example, I can turn the "a" into "10" and that into "1" and "0". (and I get the missing 0 by comparing array length) 2. Yeah, I forgot to add the rs: at first. :D Edited it a few mins later. Did you write a new function for the compression with more characters than "toString(36)"? Making the strings even shorter sounds like it could be worth it if the string ends up becoming really big.
MisterFlames
2022-02-22 21:46:10 +0000 UTCSort of. First of all, as a general comment, it would be better to store the booleans by using powers of twos, rather than 10s, it would be the most compact. Second, in the number compression, shouldn't the output have a ':'? (Ps, tried your code in an online interpreter, I see it's missing a "rs:" in front of the number result) My approach was a lot less structured, as I only needed to save small number, but could be scaled easily to bigger number, and sort of work the same as using toString(62), as I have different values for lower and upper case letters. But it would also be extensible to a larger number of characters by using special characters. Using also: @%[]<>{}() it would effectively double the capacity of each character with respect to your solution. Your number string in my solution would be (I hope, I computed it by hand, also I used my current 62 base conversion) e8:8m0J
Thamrill
2022-02-22 20:46:58 +0000 UTCI had some time to try out a few compression methods. This is the result: // turning a list of booleans into a compressed string: var boolArray = [false, true, false]; var boolNumber = 0; boolArray.forEach(function (x, i) { boolNumber += x ? Math.pow(10, i) : 0 }); var boolString = boolNumber.toString(36); // -> result: a // turning a list of integers into a compressed string: var intArray = [1000, 123456789]; intArray.forEach(function (x, i) {intArray[i] = x.toString(36)}); var intString = intArray.join(':'); // -> result: rs:21i3v9 Those should be able to be decompressed without major problems. I will probably base the whole save storage on this to make room for more variables. Is this similar to your solution?
MisterFlames
2022-02-22 20:12:59 +0000 UTCWell, keep in mind, if you need a more compact solution, just let me know and I can provide some more info/code
Thamrill
2022-02-21 19:08:57 +0000 UTCAh, you are right of course. The only way I would save space when converting to hex would be with booleans and/or integers. Besides the name of the character, all of my stored variables consist of those. In any case, I want the exported string to be imported into a list, so I don't have to be too careful about the possible size of each variable. I just have to figure out the most elegant solution.
MisterFlames
2022-02-21 17:10:17 +0000 UTCYou can combine up to 6 booleans in a single character. In the current state, each character represent 62 possible values, adding 2 characters you get to 64, which can store 2^6 possible combinations of values, hence 6 booleans. Strings, no. But you should consider that if you use your approach integers and booleans occupy lots of space. It's not entirely clear to me how converting to hex would reduce the size of the string, as printing the hex representation of a list of characters doubles the length of the string itself. And by converting back to decimals, I don't know if truly you save space. After all, since you have to insert data as characters, it all boils down on how much information each character that is inputted carries
Thamrill
2022-02-21 16:27:10 +0000 UTCThanks. My first approach was to put the variables into an associative array and simply save that as a big string. But in order to shorten the string, I plan to use some simple string-to-hex conversion. Does your solution also handle booleans and strings besides int?
MisterFlames
2022-02-21 16:04:39 +0000 UTCI don't know if you may be interested, but in my test tease https://milovana.com/forum/viewtopic.php?t=25018 I used a very simple algorithm to serialise and compact integers into an easy to handle string (digits, a~z and A~Z)
Thamrill
2022-02-20 20:48:59 +0000 UTC