Control the performances: why so irregular?

Get help using Construct 2

Post » Wed Feb 08, 2012 7:57 pm

Hi,

I've encountered a lot of more or less important problems during the last months, but I know there is always a way to fix them or an alternative solution... it is just a matter of time. In term of gameplay implementation, I'm satisfied and can't wait to add new functionalities and the final assets.

But something worries me muuuch more than specific issues: the global "lag" of my game. I don't remember when, but at one moment of the development, the game started to "lag" on my laptop. On my computer at work it seems ok, but that kind of games are supposed to be played on (almost) every computers, aren't they? More generally, whatever the computer, sometimes the game is fluid, sometimes it's really slow... and during "long" sessions, it gets slower over time.

I'd like to share my project (WIP) in order to help you (and me) understand why the result seems so... unstable. Maybe it won't be laggy on your computers, I don't know..

The html game:
http://dl.dropbox.com/u/39121175/index.html

The C2 file:
edited

("space" to pause the game and restart a new one, click to drop balls)

At first sight, the projet could seem to be a mess (in which I'm not lost, fortunately), there are a lot of global variables (too much? I don't know), but not too many sprites nor too many physical objects (according to the tutorial I've read about optimization), and I think I destroy all the created objects when they're not useful anymore... I don't display anything extraordinary so where am I wrong? Which fondamuntal mistake did I make?

In addition, I'm actually not sure that the FPS displayed is really consistant with what's happening... Something the FPS seems pretty great while the game is slow... eventually really slow...

I can -eventually- give up some further features, but I really don't want to create a laggy game, I must be confident in what I'm doing, and not beeing afraid by everything I will add in the future in this project...

Please help

Rag'Ragtime2012-02-10 12:17:01
B
17
S
4
G
4
Posts: 137
Reputation: 3,767

Post » Wed Feb 08, 2012 8:33 pm

I noticed a similar problem with my game a few days back, that suddenly the game was stuttering, despite a pretty good fps. This only happened in firefox though, was fine in all other browsers.

The weird thing though was that when I exported the game and played it from a remote host it ran fine again. No idea what's going on, but firefox appears to suddenly dislike myself hosting the game. Have you tested running it from an external server? It might be a similar problem to the one I'm having.

As a side note though, your game's running pretty well for me in firefox =)
B
22
S
6
G
10
Posts: 118
Reputation: 8,005

Post » Wed Feb 08, 2012 9:03 pm

@Haematite: I experienced the same "lag"/"chopiness" after updating to FF 10.0
I'm relieved to learn that it may have to see with localhost only.

There were new additions with the indexdb that may have occured some slowdowns. First time I experienced it was with Ashley's first example of particles.
I got 60 fps solid and fluid in chrome, and around 45/50 with "freezes" in FF10. I was a sad panda. Trying right now, I got 60 fps in both and fluid in both ^^
2nd demo is a bit more intensive. It stabilizes to 50 fps and ~800 objects in 1920X1080, FF10 maximized.

But I believe a 10.0.1 patch or superior could fix it, and by FF 11 we should gain again some of the fluidity that appeared to have been lost between 9 and 10.


New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 7,000
Reputation: 57,795

Post » Wed Feb 08, 2012 11:21 pm

Thanks for your answers

@Haematite
What do you mean by "pretty well"? It is perfectly fluid (it can be sometimes, exactly as it should be) or just.. acceptable? How long was your session? (not long I suppose, since this is just a semi-prototype not very fun)

@Kyatric
In my case, according to you... Where does the problem come from? (if there is one)

Browser? As far as I've tested, the performances seem similar from a browser to another.

C2? Is there some specific things that C2 hardly deals with? Or some specific options/features I haven't enabled/disabled?

My project? Did I something fundamental wrong? Too many loops? Too many sprites? Too many physical objets? Seriously I don't think so... That's why I don't understand... If you don't have the time to check the .capx, I'll sure understand but please have a look at the web version... It might give you a clue about what could be wrong in all that mess...

My project is currently much less "intense" than the demo you posted (particularly the second one).Ragtime2012-02-08 23:25:40
B
17
S
4
G
4
Posts: 137
Reputation: 3,767

Post » Wed Feb 08, 2012 11:33 pm

Sorry, should have been clearer! It ran completely fluidly, almost constantly 60fps, lowest it dipped was 57fps. That was after playing for a few minutes =) Also, I like the graphics btw!
B
22
S
6
G
10
Posts: 118
Reputation: 8,005

Post » Wed Feb 08, 2012 11:39 pm

[QUOTE=Ragtime] and during "long" sessions, it gets slower over time.[/QUOTE] Define long.

Played it for 3 minutes on a PC with powerful CPU and a slow graphics card. In Chrome the FPS alternated between 49 and 51 with no problems.
B
12
S
3
G
3
Posts: 73
Reputation: 2,647

Post » Thu Feb 09, 2012 9:35 am

The problem with FF is the garbage collector. It runs at times not entirely appropriate, causing those lags.
In the Nighlty Builds, for what I saw on the bug tracklist (FF 11, 12 or 13, I don't remember), it's going to be better, with a new generation of GC...
B
33
S
9
G
6
Posts: 709
Reputation: 6,704

Post » Thu Feb 09, 2012 11:52 am

So... According to you, what should I do? On some computers it's as fast and fluid as it should be. On others, it's just... slow, really slow, like if the time itself was slowing down. I don't see any consistency in all that.

Seriously, I find C2 definitely amaaaazing as a software (seriously, for a game designer it is an incredible opportunity to concretize my ideas and C2 is much more friendly-user and deep than what I've experienced before), but the exported result is sometimes disappointing... I work with two talented friends (Haematite, if you like the current visual, you'll be totally seduced by the final graphics, FX and animations ) and I don't want to let them down with a laggy game...

I don't even know if the problem comes from me, C2, HTML5 or the different browsers... I'm a bit desperate, I must admit.

But thanks for your answers anyway.Ragtime2012-02-09 11:55:38
B
17
S
4
G
4
Posts: 137
Reputation: 3,767

Post » Thu Feb 09, 2012 3:28 pm

Have you read Performance Tips? How many objects do you have created and which renderer is in use?
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,610

Post » Fri Feb 10, 2012 12:16 pm

I've updated the project in the first message, but you can access it from there:

http://dl.dropbox.com/u/39121175/index.html

Now are displayed FPS, renderer, number of objects and number of physical objects. The last count is "home made" so I could have missed some of them but I don't think so.

I've "cleaned" the project and on my work computer, it's perfectly fluid but it has always been. At home, it's a little bit slower but it remains totally acceptable.

I'll retry on the computers on which the results were somestimes terrific and let you know about the hardware etc...!

Thanks for you answer anyway!
B
17
S
4
G
4
Posts: 137
Reputation: 3,767

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 16 guests