Hello! I just implemented a new feature into my game using MemoryStoreHashMaps.
I have a Daily Reward system where players earn rewards for spending time in-game, and since this data is not useful after a day, I figured hashmaps would be perfect for this implementation.
This is the simple data i’m attempting to save
type PlayerRewardData: {
claimed: {number}, --[[rewards have a 1 digit int identifier
we are saving those already claimed]]
savedTime: number --int seconds of total time played today
}
however, there was an instant surge in memory usage after having implemented this:
So I decided to search compression libraries to try to mitigate it to the best of my ability
First I tried string.pack()
to get binary strings out of my ints, and they worked really well!
(i could just represent my entire array with just a single byte for each element!)
…And then I learned that JSON formatting has issues with non utf-8 characters. So that’s not an option.
Afterwards I went on to implement my current solution, in which I JSONEncode()
the data and compress it with the lua port of LZW algorithm, and then create a buffer.fromstring()
that is then saved on to the memorystore.
…but it didn’t seem to make much of a difference, if any at all
in fact, as of a few hours ago, i’ve officially went over 50% of my quota.
I’m at a loss over what I should do! and by extrapolating, I should probably be hitting my quota in the near future.
I don’t want to be forced to remove this feature, and if possible, I don’t want the solution to just be using datastores instead
I appreciate your time and your suggestions!