[REQUEST] Developer to set FPS

Discussion and feedback on Construct 2

Post » Fri Nov 15, 2013 12:31 pm

Tested my game in CocoonjS launcher on Samsung Galaxy S2 with half FPS enabled and the display flickers while it shows me 50-60 FPS .
B
82
S
21
G
23
Posts: 517
Reputation: 18,731

Post » Fri Nov 15, 2013 2:09 pm

[QUOTE=jayderyu] Here is an interesting post.
http://www.koonsolo.com/news/dewitters-gameloop/[/QUOTE]

I guess you missed my post at page 6. I posted this exact same article with some other resources.
Scirra Employee
B
155
S
53
G
17
Posts: 710
Reputation: 17,875

Post » Fri Nov 15, 2013 2:11 pm

I've tried skipping every other tick regardless of the timing, and it just halves the framerate regardless of what it is on Chrome for Android. So if it's running at 40 FPS it drops to 20 FPS instead of 30 FPS, and still looks pretty bad.

I'm of the opinion that half framerate mode as implemented does not do anything useful, is too difficult to make work reliably in a browser-based engine, and I'd like to remove it in the next build.

Changing how the engine runs ticks and render frames is another matter and could be considered separately. However again I'm not convinced there's much value there. You want to aim to render a frame every v-sync interval, which is usually 60 FPS. Dropping frames is not much help if the game is logic-bottlenecked (the GPU will do the heavy lifting, not the CPU). Running logic more often than rendering is wasteful of CPU time.

AFAIK this is not a significant problem on desktops. I think it's a problem best solved by waiting. It's not much help in the short term, but in the long term I'm pretty sure everyone will have phones and tablets that can more or less match desktop performance.Ashley2013-11-15 14:12:47
Scirra Founder
B
399
S
236
G
89
Posts: 24,519
Reputation: 195,351

Post » Fri Nov 15, 2013 2:42 pm

Also on reading "deWiTTERS Game Loop", I disagree with fairly significant parts of it: the article goes all the way through without even mentioning v-sync, which is pretty strange. The goal of good game engine should be to draw a new frame at every v-sync interval. Picking 25 and 50 as example framerates are just about the worst examples. Picking 60 still wouldn't be perfect, because it doesn't address the problem that v-sync intervals come at different rates on different devices, depending on the display refresh rate. So that's quite a significant problematic area that it does not attempt to address.

Further the recommended solution proposes moving a fairly significant amount of logic in to the display function. In a good game engine, logic is a modifying operation and display is a read-only operation. The suggested solution sounds like it is really proposing three functions: logic, interpolate_logic, and display. So you call logic() at some fixed rate, then interpolate_logic() followed by display() at a higher rate.
To me this seems a kind of crazy way to design a game engine; it's a pretty big architectural change, and makes the assumption that it's good for performance if interpolate_logic() is cheaper than logic(). In fact if the game is GPU-bottlenecked, there's no point calling interpolate_logic() - you may as well just call the full logic() since it runs in parallel to the GPU and won't impact performance. And I'm convinced that even the use of interpolate_logic() will cause game logic problems far more serious than vanishingly small rounding errors with variable framerates, which will not cause any problems in a well-designed game with reasonable tolerances.

You can also simulate this method in the existing engine using techniques I've recommended previously: run expensive things like collision checks, for-each loops or nested loops on a timer, or at least every N ticks. Then you are effectively splitting your game logic in to expensive logic ticks (logic()) and cheap logic ticks (interpolate_logic()). This is just straightforwardly sensible game design and works well in a variable framerate engine as well, and can be done today without any extra engine options or rearchitecting.

On the contrary I'm of the opinion that the variable rate logic/display cycle is the best solution: it v-syncs nicely at different refresh rates, handles mid-range framerates reasonably well, and is simple to design and reason about (since logic updates and display updates come at the same rate). I think the only disadvantage is really low framerates can teleport objects through collisions, but most systems aren't that slow, and there is a minimum framerate of 10 FPS in the Construct 2 engine.Ashley2013-11-15 14:46:12
Scirra Founder
B
399
S
236
G
89
Posts: 24,519
Reputation: 195,351

Post » Fri Nov 15, 2013 4:21 pm

@lennaert :
Well, to me the pb with the 30/60 fps is more on newer devices than older ones.
My game flickers a lot on my Ipad3 with fps between 55/60 for example. Even a drop for 60 to 58 is very noticable.
That's why we are a lot asking to be able to set the fps at 30, to get rid of that, and have a stable framerate : we would prefer a stable 30 than a shaking 60, simply because people will not see they are at 30, but will see the shakes (cause there are really visible).
On older devices, like an ipod4, i'm around 30, so i personnaly don't care on that point regarding an older device (it's more a question of optimization in that case). But maybe people concider that devices (ipad3 for example) as old ones already.
I already uses timers for collisions, i've optimised my game a lot, i've optimized my code, but it's still there, it's not a question of code in that case i think. Of course you can get rid of that by having just 10 objects on the screen or 1 collision test in the layout (i exagerate voluntirally), but if you try to do a more complex game, it's difficult to get rid of that, if you do an action game or a platformer, and use a scrolling.

@Ashley :
I don't understand everything because of my limited english and because it's too technical for me, but it seems that if i understand well, you will stop investigating on that. Before everything, thanks to have tried :) , but for me it's a bad news, because of what i said above. goldentreee2013-11-15 16:23:15
B
12
S
6
G
2
Posts: 105
Reputation: 3,969

Post » Fri Nov 15, 2013 4:47 pm

@lennaert - I think your first question is valid: what constitutes a mid-range device today? I am sure we could discuss this for weeks as everyone will have a different target audience for their products and, so, a different opinion. Regarding your assertion that poor programming could be the cause of these problems, I am afraid that I must disagree as I dont think you see the problem. As @goldentree points out, those of us who are asking for this feature do so having already tried to reduce the processor loading in our games as much as feasible. However, the issues seem to be caused by things out of our control like the C2 engine processing maths for objects with physics or platform behaviours and trying to do that at the rate of 60 fps (or, to be more accurate, vsync). Try and play a few of the Scirra arcade games on your phone browser and youll see the problem we are trying to alleviate.

@Ashley - Thanks for devoting a lot of your time to this. Regarding setting a game rate at 30 fps, am I right in presuming that the likes of GMS and Unity just ignore vsync altogether? Regardless, I appreciate the efforts to try and make this work and I, for one, dont want to ask you to completely re-write the C2 engine to enable this feature. I totally understand that future mobile computing power will probably swallow up this problem in the next couple of years. Ill just have to teach myself some patience
A big fan of JavaScript.
B
76
S
20
G
73
Posts: 2,244
Reputation: 45,962

Post » Fri Nov 15, 2013 6:53 pm

[QUOTE=goldentreee] @lennaert :
Well, to me the pb with the 30/60 fps is more on newer devices than older ones.
My game flickers a lot on my Ipad3 with fps between 55/60 for example. Even a drop for 60 to 58 is very noticable.
That's why we are a lot asking to be able to set the fps at 30, to get rid of that, and have a stable framerate : we would prefer a stable 30 than a shaking 60, simply because people will not see they are at 30, but will see the shakes (cause there are really visible).
On older devices, like an ipod4, i'm around 30, so i personnaly don't care on that point regarding an older device (it's more a question of optimization in that case). But maybe people concider that devices (ipad3 for example) as old ones already.
I already uses timers for collisions, i've optimised my game a lot, i've optimized my code, but it's still there, it's not a question of code in that case i think. Of course you can get rid of that by having just 10 objects on the screen or 1 collision test in the layout (i exagerate voluntirally), but if you try to do a more complex game, it's difficult to get rid of that, if you do an action game or a platformer, and use a scrolling.
[/QUOTE]
@goldentree
Is the flickering related to reduced frame rate ? wouldnt your request for a lower frame rate be counter productive then ? i would assume you get more time between flickers ?
Or do you expect that with a reduced framerate the overall processing goes faster ?
Hadnt heard or seen that before :\ granted, I'm kinda new
Got some stuff running slow, but never flickering.
Only time I actually got flickering was with objects outside of the layout with CocoonJS.

And an Ipad unable to keep up ...that must be some heavy game then, you sure you have chosen the right development platform? :P (yoke yoke)


[QUOTE=Colludium] @lennaert - I think your first question is valid: what constitutes a mid-range device today? I am sure we could discuss this for weeks as everyone will have a different target audience for their products and, so, a different opinion. Regarding your assertion that poor programming could be the cause of these problems, I am afraid that I must disagree as I dont think you see the problem. As @goldentree points out, those of us who are asking for this feature do so having already tried to reduce the processor loading in our games as much as feasible. However, the issues seem to be caused by things out of our control like the C2 engine processing maths for objects with physics or platform behaviours and trying to do that at the rate of 60 fps (or, to be more accurate, vsync). Try and play a few of the Scirra arcade games on your phone browser and youll see the problem we are trying to alleviate.
[/QUOTE]

Hmm, I've encountered many problems with phone browsers and web based apps .. but thats mostly due to the device also having to run a full fledged browser in order to support the html5 aspects. Though my smartphones processing power is nice ... the rather small memory becomes the next bottle neck, not my code. (well, in a lot of situations anyway)
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,572

Post » Fri Nov 15, 2013 9:14 pm

Hi guys, I had made a recording on my Android to show you what I mean by flickering.
The first half of the video is with half framerate mode disabled, and the last part is with it enabled.
The flickering is almost as I see it with neked eyes and has nothing to do with the recording app.
[TUBE]http://youtu.be/SqQuBdox014[/TUBE]
B
82
S
21
G
23
Posts: 517
Reputation: 18,731

Post » Sun Nov 17, 2013 6:55 pm

@lennaert
Well, as you said you're new, so maybe you have not done enough tests to see what we are speaking about, I don't know.
First, sorry for my english mistake, but it's not "flicks" i have like Cipriux on his video, but a sort of lag. I'm not sure of the good term in english :).
Back to the pb, it's more complicated than what you think.
My game is running between 29 and 31 and my ipod4, which is a (very) good fps for such an old device with a more or less complex c2 game, fps i would have not reached at all without a lot of optimization work on the graphics and code.
When i put it on my ipad2, i'm at a constant 60, most of the time, sometimes 58, with very noticable framerate falls, even if my fps is very good. On my ipad3, i'm more aound 55-57 (don't ask me why compare to the ipad2). But more than that, the fps is not "constant". I wouldn't mind to be on 55 or even 30 or 42, if it was constant, but as the game tries to always reach 60, it creates noticable lags even if you lose just 1 or 2 fps, and even if you have a "good" fps, which is commonly known as 30 and above.
Now again, i can simplifly my game a lot to win fps, but for what i'm doing now, i can't do better that what i did i think, i've already simplified a lot my "art direction", my code, etc. A way of getting rid of that is to not use a scrolling too, but my game is based on that.
Anotehr (good) solution would be to have the memory manager on mobiles (to be able to use bigger images, so less objects, so to win fps), but it's not here now.
That's why i would have liked to have the ability to set the max fps at 30, as a lot of prgram about mobiles do (GS, Stencyl, Unity) to get rid of that pb, simply to have a smooth scrolling at least on newer devices, without the obligation of having very simple graphics.
Now, I'm not the best programer of the world (if I was I would not be on that forum or using C2), i'm not the best C2 user neither, but I just thought that this option would have been nice, and I'm not the only one (with people sometimes using the soft for a long time).
And maybe even setting the fps to 30 would have not solved that pb, I don't know, maybe i'm misunderstanding completely how fps work, but it was for people interested good to try.
So I thank again Ashley to have tried, even if he didn't "believed" in the good purpose of it. At least he tried to satisfy a part of the users and that's very nice!
To finish on that subject, and with all my respect, I can understand that some people think it's a useless feature, but it's not because the feature doesn't interest me for example, that i wiil go on the topic of it to say to people to be better programers, or change soft or target, it's not very helpfull :3. We have all different uses of C2, and sometimes different needs.goldentreee2013-11-17 19:46:10
B
12
S
6
G
2
Posts: 105
Reputation: 3,969

Previous

Return to Construct 2 General

Who is online

Users browsing this forum: newt and 7 guests