The generator for the JSE Dungeon game is a bit slow.
-=-=-
I mean, it's not "that" slow.
It takes 8 seconds to build a level of about 10x10 screens, but .. come on, though! I can do better than that, right?
That's currently the task that needs to be worked on, otherwise you'll be seeing an awful lot of the screen above.
Ingame, movement seems to be running smoothly enough, and though things can get a little teeny bit sluggish at times, I've already got ideas in mind to optimise those elements.
It's the level generator, though. That's where the biggest slowdown occurs.
The largest bottleneck is working out which rooms are interconnected, which requires tile-by-tile testing, and there's a lot of tiles in a 10x10 screen level.
I need to decide, then, do I reduce the complexity of the tile-scan, and deal with potential issues involving mis-scanned tiles.
.. or do I reduce the size of the dungeon, which would indeed help speed up the generator, but .. Is that worth doing?
I'm thinking a play through might actually help in that decision, so that means..
.. um, ADDING to the complexity of the level generator, to ensure it's a fun game, then playing through a few levels and deciding on the possibility of reducing the size.
Gosh, this isn't easy.
.. And most of the slowdown is JSE doing loops within loops, which it's still not 100% fast at doing.
Grrr..
That'll be today's continued work, then. Optimising can be fun, sometimes!
.. Sometimes.
[verse]
I've gotta optimise the generator.
Optimise the building of the map. (oooh)
I need to make it all a bit quicker,
So the player doesn't need a short nap.
The generator's taking ages, (so long)
I'm not sure that I know quite why, (oh, why)
So I'll tweak the settings and type more code,
Until it races once again. (optimised)
[chorus]
Optimising. Optimising.
Speed it up, I'm really trying.
Optimising. Optimising.
Wherever there are tweaks, I'll prod.
To help the code fulfil it's job,
I'll optimise it better.
(ooh ooh, optimising)
I'll optimise it.
[break]
[alt-verse] (rap)
Tweak at the engine until it goes faster,
Smash at the code with a speedy-go blaster.
Hammer it home to reduce all the waste,
And explore all the bits to make space.
Space in the system to fit in more tasks,
Like working out keys and which enemies pass.
Lock all the doors and let enemies spawn,
From the places you wish they had never been born.
[break]
[chorus]
Optimising. Optimising.
Speed it up, I'm really trying.
Optimising. Optimising.
Wherever there are tweaks, I'll prod.
To help the code fulfil it's job,
I'll optimise it better.
(ooh ooh, optimising)
I'll optimise it.
[break]
[bridge] (spoken)
I just ate an entire packet of Ginger Nut biscuits.
I had them with a coffee whilst I was writing today's blog.
I probably should have only eaten two or three biscuits (four or five at the most)
But the entire packet vanished in the time it took to write the silly blog.
I'm a greedy greedy blogger, yes I am
[break]
[key change]
[outro]
Optimising. Optimising.
Speed it up, I'm really trying.
Optimising. Optimising.
Wherever there are tweaks, I'll prod.
To help the code fulfil it's job,
I'll try my best to optimise it all a little better.
Int. Dave's Kitchen - Morning
[Dave and Green are sat at the kitchen bench. Mrs Microwave watches on, silently]
Dave: You'll never guess!
Green: It's going to be Cola, isn't it...?
Dave: You never know!
Green: There's eight empty cans sat next to your coffee machine. I think we can all see where this is going.
[Dave starts rummaging in cupboards]
Dave: But this is different. This is sophisticated!
Green: Sophistication starts with a can of coke, right?
Mrs Microwave: *concerned beep*
[Dave pulls out a jar of instant coffee and throws it into the top of his new coffee machine]
Green: Oh no.
Dave: Oh yes!
Green: You're supposed to grind beans, Dave.
Dave: Who has time for that?
[Dave starts preparing his concoction]
Green: Dave, just think about what you're doing. Two forms of caffeine, it could go horribly wrong.
Dave: It's fine. I've already had some.
Mrs Microwave: *urgent warning beeps*
[The coffee machine splurts and gargles]
Green: I think Mrs Microwave could be right on this one. What say you, Master Air Fryer
[Master Air Fryer flashes "ERROR", as Dave stirs his unholy mixture]
Dave: Lord Caffeine approves.
Green: Lord Caffeine is just trying to please you. Mrs Microwave, do something!
Mrs Microwave: *prolonged distressed beep*
Dave: Don't worry, I've got this all under control.
[Dave takes a sip]
Dave: Mmm... sophistication!
Green: Your leg's already bouncing.
Dave: That's the sophistication kicking in!
Mrs Microwave: *emergency beep sequence*