New games every week!
Dusty Old Shoebox Blog
26th March 2024
Good grief!!!

-=-=-

Mum was playing Crosswords (Definitely not Scrabble, Honest) in the Shoebox, with the nice new colourful tiles.
She seemed to enjoy it, but was annoyed that the "Previous Word" is no longer as bright and noticeable on the board as it was when the bubbles were there.
"It's ok, I'll add a border" says I...
.. Because that's easy to do. Just shove nice little rectangles to highlight the previous word. What could possibly go wrong!?!

I opened up the Crossword code, and was greeted by the horrific mountains of AI Player code that exists within.
Oh lordy, it's a mess!!
And there's about 3 or 4 old versions of the code in there, too.

Yikes!!

It must've taken about 20 minutes to figure out where in the code it was, searching endlessly for the for-loop that drew the board, but once I remembered that I'd coded a standardised reusable "DrawBoard" function, it became infinitely easier.

I tracked it down, gave it a tweak, and now there's little nice noticeable border around the letters that the last player put down.
Hurray!!



Now, why's the pinch-zoom not working any more..

....Hmmm...

Meanwhile...


You might notice that the background no longer changes colour in the Shoebox.
I discovered to my horror that, as screen resolutions have increased, so has the amount of work it takes for the engine to "just" draw a picture on the background.
It's really quite alarming how much effort that took for the browsers, especially Firefox, where every draw call seems to take that little bit more effort.

I stripped out the constant redrawing and recolouring of the background, and it's now a static image on the physical background of the webpage, which reduces the amount of drawing by a fairly significant amount.
The whole engine's still running at an alarmingly high resolution, though, and will use an average of 57% CPU* just for a blank screen, on my MacBook.
By comparison, GotoJSE when in full swing, will usually use about 43%.
Hmm.
There's definitely some more optimisation to be had, here, but I'd have to work carefully so as not to end up making everything either too blurry or too pixelated.
It'd probably make sense to have a target resolution, though, then scale the result up to the size of the screen.
But then all the mouse stuff needs maths, and aaaargh!!!

Good grief!!!

*I believe this is a single core's worth of CPU. I certainly hope so, anyway!!


"Cartoon @Derek is scared , screaming, shocked, when he lifts the lid of an old blue shoebox with white trimmings. Ominous light emanates from within the shoebox. Dark, Scary, horror, cinematic lighting, smoke, dust particles, old shoebox, living room in an old creepy mansion" by #ArtFlow.ai
Views 36, Upvotes 7  
Daily Blog , Shoebox
New games every week!
Site credits : All of the above : Jayenkai
(c) Jayenkai 2023 and onwards, RSS feed

Blog - Dusty Old Shoebox - AGameAWeek