Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

6 years ago by fulvio

I have this strange issue with Google Chrome where the FPS in my game drops to ~30-40fps for every ~5 seconds and then back to 60fps. I can see this occur when I enable debugging and also when I disable it so I know it's not the debugging/performance that's causing the issue. It's system lag -- keep in mind I have an incredibly fast processor and graphics card. This even happens when my character is idle.

The strange thing is when I use Node-WebKit to export it to an executable I get 60fps again!? So this is only happening in Google Chrome and I have no idea why it would be occurring. I've tried disabling extensions, background maps, entities, etc. It's definitely not related to draw calls. It's 100% system lag that causes the drops in FPS.

The system lag seems to ONLY be occurring in Google Chrome. I've killed off as many background applications that might be running under Windows and it still just drops every 5 seconds or so.

I would understand it might be my code if exporting to Node-WebKit also caused the drops, but it does not. It's Google Chrome for some reason.

/><br />
<br />
Very very odd.<br />
			</div>
		</div>
			<div class=

6 years ago by Joncom

Have you tried using Chrome's profiling tools to see specifically which functions are eating a lot of CPU?

6 years ago by fulvio

Quote from Joncom
Have you tried using Chrome's profiling tools to see specifically which functions are eating a lot of CPU?

I might do just that when I get home tonight. I'm assuming it's somewhere under the Developer Tools?

Also, I don't think it would be much help considering my player is idle while this is happening.

6 years ago by Joncom

I'm assuming it's somewhere under the Developer Tools?
Yes.
I don't think it would be much help considering my player is idle while this is happening.
Your player being idle does not mean that some function somewhere cannot be using a lot of resources.

6 years ago by vincentpiel

Such a behaviour is typicall of a garbage collector happening.
Impact has many qualities, but it creates quite some garbage even when nothing is happening (in input handling and collisions mainly).

But it might also come from the fact that you are creating even more garbage by :
- having to check for collisions with too many objects on each frame
- creating objects/gradients/arrays/... that will get disposed soon after.

For arrays or simple storage object, you might re-use a single object that you create once in the init() of the related object.
Arrays can be reused easily : just handle a length separately to avoid disallocation/reallocation.

For entities or more complex object, if you create/destroy a lot of them quite often, you might be interested in pooling.

( i talked about pooling here :
short version :
http://gamealchemist.wordpress.com/2013/02/02/no-more-garbage-pooling-objects-built-with-constructor-functions/

long version :
http://gamealchemist.wordpress.com/2013/09/08/no-more-garbage-pooling-objects-built-with-constructor-functions-verbose-version/

Version for Impact :
http://gamealchemist.wordpress.com/2013/05/04/pooling-with-init-lets-throw-impactjs-classes-in-the-pool/
)

6 years ago by lTyl

The one thing you'll notice between the browsers (Internet Explorer has the best garbage collection process from my experiences) is Firefox cuts down the amount of memory it frees at any one point, so it simply does the calls more frequently but goes through less memory. You'll notice on Firefox that you will have a small System Lag bar every 1-2 frames compared to chrome doing all of it's GC in one batch every few seconds

6 years ago by fulvio

Well, it turns out this is a Google Chrome issue and nothing to do with my code.

Head on over to http://playbiolab.com and while you're in-game hit "F" to toggle the FPS reading on the top-left.

You can see it drop from 60 to 30 and then back every few seconds due to system lag. This is exactly what happens on every Impact game in Google Chrome Version 29.0.1547.76 m.

Ouch.

6 years ago by jazun33

Weird.... I don't get that issue...

6 years ago by fugufish

i can confirm, that this happens on my Chrome 30.0.1599.66 beta

Tested the biolab disaster link

6 years ago by fugufish

@Dominic, any suggestions on this?

6 years ago by Joncom

@fugufish: Not sure what kind of suggestion you're hoping for. As has been stated, this is a browser-specific issue and not much can be done on the code side of things, save for pooling perhaps...

6 years ago by jazun33

I'm having the same issue all of a sudden. I agree with Joncom that it's a browser specific, chrome issue. I'd still like to know a little more about it tho.

6 years ago by jazun33

It... seems to have fixed itself? Anyone else still having the same problem because I'm not.
Page 1 of 1
« first « previous next › last »