High CPU Usage

Get help using Construct 2

Post » Tue Mar 07, 2017 1:22 am

@99Instances2Go ha, we were definitely thinking along the same lines. You must have a really nice laptop! :)

@HessamoddinS
I just added another optimization that I was thinking about adding to the first version - limiting how many sprites it checks per tick.
this version bumps the sprite count up to 300, but only checks 5 per tick. So, it takes a whole second for them all to have a turn looking for connections - but because there are so many, most of them will already have the connection made to them. Since it checks the same number every tick, there is no jerkiness.

it runs very smoothly on my computer, cpu is under 50% as reported by C2 (but Windows says it really is only about 27%). If you watch really closely you can occasionally see where a connection should have been made but didn't get checked in time. But since there are so many other connections going on, I doubt anyone would ever notice.

http://www.rieperts.com/games/forum/DotEffect2.capx

if you play with the SpriteCount and CheckPerTick variables, keep SpriteCount an even multiple of CheckPerTick, otherwise some will never get checked, or it may even go into an infinite loop or something...
B
94
S
33
G
20
Posts: 438
Reputation: 17,615

Post » Tue Mar 07, 2017 3:56 am

99Instances2Go wrote:@HessamoddinS

I beleive that this is what you want to do.

https://www.dropbox.com/s/2bxe5qcl3v8oq ... .capx?dl=0

Runs like a slow poke in the debugger.
Runs at 118 FPS on my laptop, outside the debugger.

I like the idea of using a dictionary to keep the amount of lines as low as possible.
But, then you gots to use the the dictonary's feature to not allow the same key twice. Look at how i solved that.
Have fun.

Edit: @AllanR, did not see your last capx yet. Had this topic open while coding, so topic was not refreshed when posting this¨.

Thank you, this is great. I think I have solved the problem of having the same key twice but it wasn't good.
Really helpful Thank you guys this thread was great I learned a lot from your examples.
B
45
S
19
G
3
Posts: 102
Reputation: 4,598

Post » Tue Mar 07, 2017 4:00 am

AllanR wrote:@99Instances2Go ha, we were definitely thinking along the same lines. You must have a really nice laptop! :)

@HessamoddinS
I just added another optimization that I was thinking about adding to the first version - limiting how many sprites it checks per tick.
this version bumps the sprite count up to 300, but only checks 5 per tick. So, it takes a whole second for them all to have a turn looking for connections - but because there are so many, most of them will already have the connection made to them. Since it checks the same number every tick, there is no jerkiness.

it runs very smoothly on my computer, cpu is under 50% as reported by C2 (but Windows says it really is only about 27%). If you watch really closely you can occasionally see where a connection should have been made but didn't get checked in time. But since there are so many other connections going on, I doubt anyone would ever notice.

http://www.rieperts.com/games/forum/DotEffect2.capx

if you play with the SpriteCount and CheckPerTick variables, keep SpriteCount an even multiple of CheckPerTick, otherwise some will never get checked, or it may even go into an infinite loop or something...

That's great. Thank you
B
45
S
19
G
3
Posts: 102
Reputation: 4,598

Previous

Return to How do I....?

Who is online

Users browsing this forum: Syazanie Amirin and 8 guests