Nothing Found :(
JSE - Forming the Tilemaps
11th May 2021  
Really wasn't expecting that, yesterday.


The day started off with the SmileBASIC launch, after which I decided to look into why Michael Fernie was having issues drawing a background.

The issue was two-fold.
First, the JSE just isn't good at doing nested loops. Even a simple set of 64x64 can chug along at a ludicrously slow pace.
Add to that, the whole issue with the giant Symbol Sheet, and .. well, it's not a good combination.

The Symbol Sheet size has been both reduced and expanded. Now instead of one single 1024x1024 pixel sheet, the thing is stored across 10 smaller 340x340 pixel images.

Slightly more pixels in memory, overall, but each sprite is now a teensy bit faster to draw, as the javascript engine needs only work with rotating and scaling 340x340 pixel images instead of 1024x1024 ones.
"Why not split each symbol into its own image?" I hear you cry?

Javascript seems to have slowdown issues flipping between different spritesheets, in-between drawing calls.. By keeping everything to fewer sheets, things get a teensy bit quicker.
Of course, further testing is still required, and extra optimisation, too. But for the mostpart, the current method is a little better than it previously was.

.. Tilemaps, then?

Most of the slowdown that was happening, then, was being caused by JSE not being able to loop at full speed over a full screen of tiles, in order to handle the entire tilemap.
How best to handle that?
I sat pondering this for about an hour or so, before going ".. Well, guess I need a Tilemap engine.."

Halfway through coding the tilemap, and thinking "It's quicker when Javascript is handling it, instead of my badly coded scripting language", I wondered if perhaps that's why Fuze on Switch struggles to keep pace when doing a similar thing?
I wonder, then, how SmileBASIC manages to keep up. I imagine SmileBASIC is much more streamlined when "compiled" than what I'm managing to do.

Anyhoo, tilemaps are in now, and things are flowing reasonably well.
I think I've got most of the important functions in there. If there's anything specific that you'd like to do with a tilemap, but that isn't already in there, do please let me know.

I now need to code a bunch of mathsy things, to allow for collisions and whatnot.
In fact, I haven't added ANY collision code in JSE, yet, so I think that'll probably be today's challenge.

Or the Arrays.

.. or the For loops..

So much to do!!

Views 15, Upvotes 1
Daily Blog , Jse
Site credits : Jayenkai
(c) Jayenkai 2017 and onwards, site design Rychan. RSS feed
Blog - JSE - Forming the Tilemaps - AGameAWeek