Framerate vs. Framerate

Discussion and feedback on Construct 2

Post » Fri Apr 17, 2015 6:17 pm

That only happens because the crowd tries to make the elephant perform acrobatics whilst balanced on the under-fueled and duck-taped motorcycle....
A big fan of JavaScript.
B
76
S
20
G
74
Posts: 2,245
Reputation: 46,464

Post » Fri Apr 17, 2015 6:18 pm

What is with this forum and analogies.
Last edited by Tokinsom on Sat Apr 18, 2015 5:10 am, edited 1 time in total.
Image
B
243
S
30
G
13
Posts: 1,787
Reputation: 18,770

Post » Fri Apr 17, 2015 6:36 pm

Yeah, I have the same question:
Why on consoles (XOne, PS4) 30FPS it's working fine but in HTML5 30FPS (even 50FPS) it's not enough for a smooth gameplay?
: S
B
92
S
30
G
11
Posts: 654
Reputation: 11,707

Post » Fri Apr 17, 2015 7:01 pm

Those games on there are smaller elephants.
Image ImageImage
B
170
S
50
G
179
Posts: 8,379
Reputation: 113,427

Post » Fri Apr 17, 2015 7:35 pm

Why isn't it smooth? I'm pretty sure it has to do with how the browsers handle the rendering.
Independent of C2, motion still isn't buttery smooth, well at least not on my pc. Part of the issue is graphics card support, mine for instance has bugs in the driver and ati won't be making an updated driver for a ten year old card.

Here's a very simple js test where motion still isn't smooth:
viewtopic.php?f=147&t=115540&p=835995&hilit=jsfiddle#p835995
I'm pretty sure Javascript isn't to blame. I was able to get smooth motion in my now stalled wrapper experiment, in which I still used javascript, but implemented my own crude renderer on top.

Reducing the framerate doesn't fix the lack of smooth motion.
There was a discussion before of adding a 30fps mode, but it didn't work out as I recall because it wasn't smooth and had an unstable framerate.

Anyways I found this page describing a way to use a fixed framerate, so I took a gander at editing the C2 runtime to implement it.
http://stackoverflow.com/questions/1951 ... pplication
It seems to work alright, at least for me. It still has little pauses on my pc, but it's at least as smooth looking as it normally is on my pc.


These are the changes to limit the fps to 30, if anyone wants to test it.

file: \exporters\html5\preview.js
"..." is any number of lines, for this you'll want to find the line with "Runtime.prototype.tick". Bold are added lines. I prepended "rojo" to the variables I added. If it breaks, then just re-install C2 to fix it, or you could backup the file before editing it.

...
var rojoThen = cr.performance_now();
Runtime.prototype.tick = function (background_wake, timestamp, debug_step)
{
...
var rojoDelta = nowtime-rojoThen;
var rojoInterval = 1000/30;
if (rojoDelta >= rojoInterval)
{
rojoThen = nowtime - (rojoDelta % rojoInterval);
raf_time -= (rojoDelta % rojoInterval);

// Execute logic
this.logic(raf_time);
...
this.logictime += cr.performance_now() - logic_start;
}
};
B
94
S
33
G
113
Posts: 5,356
Reputation: 73,273

Post » Fri Apr 17, 2015 9:30 pm

The main issue is that your game is likely NOT hitting a consistent 30 fps. If the lower frame-rate is due to the CPU/GPU being taxed and having to wait longer between frames, you wont get "smooth" 30 fps, because you're getting a fluctuating fps in the first place. It's possible to schedule longer times between renders for logic, however construct doesn't have an in engine option to do this, so your "30 fps" is not really the same as a console games 30 fps, it's a 25-35 fps from overtaxed hardware. If you were to build your own renderer that skips every other frame in a properly scheduled way it'd be 'smooth' (if you could really call 30 fps smooth in the first place, something i'd argue), I've done tests with Q3D doing exactly this, and even have an option to skip rendering of specified ratios of frames. If your game is lagging to 30 fps it's unplayable because of the instability of the logic and the effect that has on frame scheduling, not because of the renderer/browser or otherwise. It's the same way any game because horrendous to play with significant drops in framerate, especially when timedelta based games make everything unstable in fluctuating fps.
B
79
S
13
G
8
Posts: 1,976
Reputation: 9,947

Post » Sat Apr 18, 2015 12:02 am

szymek wrote:Why does 30 fps in any native/console game means smooth game,
and 30 fps in any Construct 2 game means slow, almost not playable game?

Maybe it's silly question, but I'm just curious


Because consoles are designed to run at 30 fps, the engine is capped at 30, so there's no fluctuations. A stable 30 fps is very playable.

A stable 60 fps is more fluid though.

The problem is that games designed to run at 60 fps sometimes can't and the dips cause frametime variance, to the end user, it looks as though the game is very stuttery, fast, slow, fast, slow etc. This makes it feel worse than if its running stable 30 fps.

It's the same for PC games, running with or without vsync, if the frame rate jumps all over the place, the game feels very choppy even if its running 40-80 fps.
B
70
S
24
G
19
Posts: 1,757
Reputation: 17,616

Post » Sat Apr 18, 2015 2:46 am

Todays consoles are mainly made for 3d graphics. 3d graphics look still good with 30 fps, but 2d games not. Old consoles, like Nintendo Snes or Sega Genesis had a framerate of 50 or 60 Hz because of this.

Also, what some people don't know, today smooth 2d graphics are often more "complicated" for the GPU than 3d graphics. Old graphic cards was optimized for 2d things like parallax scrolling, todays GPUs are optimized for 3d (like vertexes). Because of this editors like Unity seems to work smoother.
B
11
S
2
Posts: 213
Reputation: 1,266

Post » Sat Apr 18, 2015 3:00 am

Also, fun fact: a lot of game studios working on console exclusive games don't even bother to manage frameskip / delta time.
If the game drops under the targeted framerate, then everything slows down (visuals, music, sfx, etc...). You'd be surprised, many studios don't give a damn at this issue and just optimize the game to be sure it will never drop under the framerate it's based on.
Consoles have a lot of flaws compared to PC, but they really are a paradise on this side if the game is not set for PC release later.
Image | @AurelRegard on twitter
B
19
S
6
G
1
Posts: 307
Reputation: 2,500

Post » Sat Apr 18, 2015 4:55 am

As everyone said C2 is built to run at 60fps. dt should in theory cope for dropped frames. However that does not seem to be the case.

I linked to a article that was about fixing the dt and putting the game to 30fps. The theory runs on the idea that the engine loops as fast as possible. The game also tracks the dt difference. however logic only updates every 30fps. So even if the game dips below 60fps the logic already at 30fps anyways so you will never see the dip. however as always. it's not 60fps so there is no value in the design choice.
B
90
S
18
G
9
Posts: 2,455
Reputation: 15,038

PreviousNext

Return to Construct 2 General

Who is online

Users browsing this forum: Bob Thulfram and 16 guests