Complex Game is Occasionally Generating a Lot of Lag!
id: 750057
category: Help with Scripts
posts: 10
Mar 25, 2024 09:31:17
Complex Game is Occasionally Generating a Lot of Lag!
view on scratch
view on legacy ocular
Chikematoodles
loading
My game, https://scratch.mit.edu/projects/930833177/, is very complex and has almost 12,000 blocks. It is extremely complex and in some cases has frozen and crashed weak laptops and had them sent to be fixed XD It seems to run somewhat okay on my computer, which I'll list its stats below:
Windows NT 10.0, Opera 107.0.0.0, No Flash version detected
Anyway, it still ocasionally has extreme lag spikes and after, it takes a few seconds for my computer to catch up with the game. This is not really a problem, but for some people, it could actually cause a major issue with their computer and I've seen it happen already. So what I'm doing in the next update, v0.13, is doing a complete makeover of all scripts and creating one “event handler” sprite or whatever you want to call it, but I'm pretty much just limiting the project to one forever loop and one “when green flag clicked” block and using broadcasts to update individual sprites. This is definitely doable, but I'll need to know if this will even make a difference, or if there's anything else I can do, like limit the sprites which I already have done a bit.
And by the way, I'd call myself a pretty experienced coder, so please don't say something obvious like “Don't put custom blocks on run without screen refresh if they have a delay”.
Thanks, Chikematoodles.
Windows NT 10.0, Opera 107.0.0.0, No Flash version detected
Anyway, it still ocasionally has extreme lag spikes and after, it takes a few seconds for my computer to catch up with the game. This is not really a problem, but for some people, it could actually cause a major issue with their computer and I've seen it happen already. So what I'm doing in the next update, v0.13, is doing a complete makeover of all scripts and creating one “event handler” sprite or whatever you want to call it, but I'm pretty much just limiting the project to one forever loop and one “when green flag clicked” block and using broadcasts to update individual sprites. This is definitely doable, but I'll need to know if this will even make a difference, or if there's anything else I can do, like limit the sprites which I already have done a bit.
And by the way, I'd call myself a pretty experienced coder, so please don't say something obvious like “Don't put custom blocks on run without screen refresh if they have a delay”.
Thanks, Chikematoodles.
Mar 25, 2024 09:53:03
Complex Game is Occasionally Generating a Lot of Lag!
view on scratch
view on legacy ocular
AZBIDABOI
loading
Can you simplify your game? I don't see much projects having over 12000 blocks of code
Mar 25, 2024 09:57:20
Complex Game is Occasionally Generating a Lot of Lag!
view on scratch
view on legacy ocular
Chikematoodles
loading
(#2)
Can you simplify your game? I don't see much projects having over 12000 blocks of code
Not really, I kinda enjoy making large games XD
Mar 25, 2024 09:59:06
Complex Game is Occasionally Generating a Lot of Lag!
view on scratch
view on legacy ocular
AZBIDABOI
loading
Maybe add a turbowarp link or a link that helps the game run faster.
Mar 25, 2024 10:02:17
Complex Game is Occasionally Generating a Lot of Lag!
view on scratch
view on legacy ocular
Chikematoodles
loading
(#4)I already have.
Maybe add a turbowarp link or a link that helps the game run faster.
Also, the lag that I was talking about was on TurboWarp. The game is not really playable on regular Scratch XD
Mar 25, 2024 13:00:42
Complex Game is Occasionally Generating a Lot of Lag!
view on scratch
view on legacy ocular
LUKiCREATE
loading
It works perfectly fine for me, maybe try using Google Chrome?
Mar 25, 2024 13:14:12
Complex Game is Occasionally Generating a Lot of Lag!
view on scratch
view on legacy ocular
SpyCoderX
loading
It works perfectly fine for me, maybe try using Google Chrome?
Works fine on Edge. (In my opinion)
Mar 25, 2024 15:44:41
Complex Game is Occasionally Generating a Lot of Lag!
view on scratch
view on legacy ocular
epicdude512
loading
On the FAQ, Opera is not offically supported by scratch, use either crome, safari, microsoft edge, or firefox
Mar 25, 2024 15:48:49
Complex Game is Occasionally Generating a Lot of Lag!
view on scratch
view on legacy ocular
NamePending_
loading
If you're looking to boil everything down to one forever loop, put this in the one loop.
forever
broadcast [loop 1 v]
broadcast [loop 2 v]
...
end
Mar 25, 2024 16:22:23
Complex Game is Occasionally Generating a Lot of Lag!
view on scratch
view on legacy ocular
Malicondi
loading
The project works fine for me, on chrome on my Chromebook and PC.