Yep, I've gotten stuck in the JSE code again. Aargh!!!
-=-=-
Honestly, I love doing this!
Mum's been freaking out that I'm "doing too much", but nips and tucks and tweaks to the engine is fun to do.
I'm in my element!
Yesterday I uploaded v.3gih, which appears to be a teensy bit more optimised.
The engine now does a short spurt of pre-optimising when it's loaded, forcing the browser to do several hundred quick spurts of drawing, multiplying, string access and more. Then it stops and has a breather before letting you start any code.
This all happens over the space of about 20 frames, so "shouldn't" impact the player's experience in the slightest, though I'll be stress testing the impact it has on many more setups before calling it a day.
This is Optimisationalism 5 running (barely) on a Samsung Galaxy Tab A 10 2018 (name things better, Samsung!)
v3gig wouldn't get beyond the initial few Text Drawing tests before crashing out, so though v3gih doesn't "feel" like it's that much faster, the fact that I've now got the thing managing a complete suite of tests on this age-old rubbish tech, is a fair improvement.
Optimising is fun!!
What else have I tweaked?
The Random-Number function has been streamlined a teensy bit, though not as much as I'd like. This is because I'm using my own random number generator, mostly because I like to use pseudo-random numbers when generating levels and such, so that everyone sees the same things.
Browsers, of course, have their own pseudo number generators, but I can't 100% rely on every browser on every system being the same output for the same seed, which is why I wrote my own.
.. Sure is slow, though!
Here's a bit of code that I've been experimenting with, yesterday.
// Optimise For Loop
// by Jayenkai
// Created 2024/2/10
// GotoJSE.com/KjXtDqv9.BAS
Graphics 512,512,1
s=Mills()
mcSquared=1
for x=0 to 100
for y=0 to 100
for z=0 to 100
// e=mcSquared
// e=mcSquared+1+(1,2)
// e=mcSquared+Sin(1)+Sin(1,2)
// e=mcSquared+Rnd(1)+Rnd(1,2)
next
next
cls;LoadingBar x,"Trying","Twirl";flip
next
ResetDraw;CLS;Print Mills()-s;Flip
There's 4 commented lines in the middle of the for's. You can uncomment them one-by-one to see how each one impacts the time that the code takes to run.
... And you'll find that the Rnd command really does suck the life out of the engine.
So I think I need to try and focus on that for a while. Get it as fast as I can get it working, but.. importantly.. not breaking the resulting pseudo-random numbers, or that'll result in all kinds of breaks, all over the place.
Eeek!
Right then.. I should probably write Monday's game before I get back to any more optimising.
I'll go do that!
[verse]
I'm trying to make it faster.
I'm trying to make it better.
I'm trying to make it optimised,
In a way that makes it better.
[verse]
I'm trying to make things neater.
I'm trying to keep things tight.
I'm wondering if the things I did today,
Will still be functional tonight.
[bridge]
I will try my best to get things optimised.
And I'll try to do it all today.
If there's any kind of tweak that I can make to make things faster,
Then I'm sure that I will find a way.
to make things optimised, today.
[verse]
I'm trying to give it action.
I'm trying to give it speed.
I'm trying to give it function,
So that you can make more things.
[verse]
I'm trying to make the engine calm.
I'm trying to make the engine smoother.
And when all of the engine's running neatly,
All the code will stay together.
[bridge]
I will try my best to get things optimised.
And I'll try to do it all today.
If there's any kind of tweak that I can make to make things faster,
Then I'm sure that I will find a way.
[A large van has parked out at the rear of the shop, and Dave and Greenie are taking delivery of a set of retro Arcade Cabinets.]
Green: These things are heavier than a ScrunchCake stack!
Dave: Depends on the type of ScrunchCake.
Green: Not my point.
Dave: (adjusting his hat) Don't worry, Greenie. I've got this under control! We're gonna wheel these bad boys in like a charm.
Green: Not quite a charm, though, is it? We've gotta drag the things through a maze of half-built kitchen cabinets because .. for some reason.. you decided it was a great idea to start doing those, knowing we'd have to wheel all the Arcade machines through it.
Dave: Honestly, I thought we'd be done with the kitchen by now.
Green: An entire kitchen. In a single morning?
Dave: (fiddles with his hat) It's only a few screws. You're normally good at flatpacked furniture.
Green: No I'm not! We've made plenty of disasters over the past few years. You know I'm not good with wood.
Dave: You can punch holes in card just fine. There's no reason that screwing panel E into panel K shouldn't be just as easy.
Green: .. And would you take that hat off, it looks stupid.
Dave: It's promotional.
Green: DGS. Makes it sound like a furniture store or something.
Dave: Dave's Games and ScrunchCakes is too wordy for a hat.
[Dave and Greenie wheel a couple of Arcade Cabinets on trolleys through the building, avoiding a myriad of unfinished kitchen units as they go]
Dave: (grunting) This thing’s like a greased eel! I’ve got it, though. I’ve got it! [Dave headbuts the arcade machine as it stumbles through the kitchen]
Green: (sighing) Dave, you’re going to end up with a black eye doing that. Pull it, don't push it.
Dave: I think we should probably have moved all the spare screws before starting this.
Green: It's not my fault that we got disturbed halfway through.
Dave: Half way?
Green: OK. An eighth of the way, then. You really should've delayed the arcade cabinets a day or two.
[They make it through the double-doors of the kitchen, into the main store interior]
Dave: (still grunting) This really is a hefty job. The cardboard cutouts were a lot lighter.
Green: Not as flashy, though.
Dave: OK, we need to decide on the layout for these. What kind of ordering system should we go for?
Green: You haven't decided on that, yet? What was the point of all the cardboard machines?
Dave: For [waves arm dramatically through the air] .. effect..!
[Dave lets go of his trolly, and the Arcade cabinet plops to the floor.]
Dave: One!
Green: [similarly plopping his arcade cabinet down] Two..
Dave: (puffing, exhaustedly) .. out of thirty.
Green: Good grief..
Dave: Brew time!
Views 134, Upvotes 2
Daily Blog
,
Jse
,
Optimising
New games every week!
Places
Archives
Site credits : This was all done by Jayenkai
(c) Jayenkai 2023 and onwards, RSS feed
105