New games every week!
Squeezing Values Blog
31st July 2022
Squeezing in the numbers, yesterday. Yikes!

-=-=-

Each Browsercade game gets about 50 values that it can save.
This is enough for the Top 10, the Last 10, and then 30 spare values for things like how many times you've played each game, and a ton of leftovers!

Yesterday's task was trying to fit a calendar of 366 into the save file.
First challenge, Stars.
I've given each day up to 3 stars, which is 2 bits. (0,1,2,3)
Squeezing them into packs of 8 is 16 bits. (Because, honestly, I still don't trust that every browser is going to use 32 bit integers correctly!)

Divide the year into 8 and you get 46 necessary values, which is "just" enough to squeeze into the allocated space.
So I did that, yesterday.

Aaaand.. it .. almost works..!
The values are getting misaligned somehow, so a bit more tweaking to be done.
But that's "only" a star value. None of those days have an actual Score value.
For Quadoban that's enough, but for anything that would require scores (NeonPlat Adventures) it's obviously not good enough.

Of course, there's always the possibility that such a game could use its own save file.
That's likely the best way around this current issue, and makes the most sense, instead of constantly trying to squeeze "everything" into an ever-growing file.

.. To be honest, there's a ton of work still to do, to get things working right, and I haven't even started on the Quadoban game itself, yet!
Aargh!
Views 27, Upvotes 3  
Daily Blog , Planning
New games every week!
Site credits : All of the above : Jayenkai
(c) Jayenkai 2023 and onwards, RSS feed

Blog - Squeezing Values - AGameAWeek