How do I eliminate jerkiness/tearing when fullscreen

Get help using Construct 2

Post » Mon May 09, 2016 12:44 am

Having control over pixels is important. @ashley is your final word that consistent 1-pixel per frame movement can't be achieved with C2? If it can be achieved, a push in the right direction please? Shovel knight can do it and apparently game maker too
B
28
S
12
G
4
Posts: 193
Reputation: 4,581

Post » Mon May 09, 2016 10:50 am

TBH the last example you posted looks fine to me. FWIW here's another version which works by having a double movement speed and disabling the behavior on alternate ticks: https://dl.dropboxusercontent.com/u/15217362/30fpsmovement.capx
It seems to work fine even without a minimum framerate. That looks pretty much the same as the previous example to me though.

@R0J0hound - you're mainly talking about v-sync, which is a slightly different problem. It's possible to move at precise pixel offsets, but not v-sync accurately, or to v-sync accurately but not move at precise pixel offsets. Construct 2 definitely can do precise pixel offsets (either lock dt or just make your own events to move at integer amounts). All modern browsers can v-sync to within 0.1ms, at least on my system. If you see poor-quality v-sync you should file a bug report at crbug.com or at least comment on the existing v-sync bug (crbug.com/422000) with your system spec. As far as I can tell it's been a solved problem for a while now, but maybe some different system setups work differently.
Scirra Founder
B
402
S
238
G
89
Posts: 24,622
Reputation: 196,011

Post » Mon May 09, 2016 7:51 pm

@Ashley thank you very very much for the explanation and example.
B
28
S
12
G
4
Posts: 193
Reputation: 4,581

Post » Tue May 10, 2016 12:57 am

@Ashley
Thanks for the link, the vsync test is especially useful. My pc doesn't vsync and gets an average of 30fps. However the solution for me probably has to be to get a new pc, since my graphics card hasn't been supported by amd since 2010, and windows vista is no longer supported by chrome. I won't be upgrading though, unless I have a major hardware failure.

On the plus side, anything I make in C2 will run fantastic on any other machine.
B
94
S
33
G
117
Posts: 5,389
Reputation: 75,339

Post » Tue May 10, 2016 5:34 am

So apparently the only way to achieve smooth 1-pixel movement is by not using dt, and fixing the min framerate to 60fps.
Yes, I sacrifice vsync, but it looks super smooth on all the devices I tested on. It's a super tiny game that takes hardly any CPU and RAM, 60fps should be easy to maintain.

It's also how old arcade games used to do it. Granted, they had unwavering 60fps, due to fixed hardware.

I don't have access to a 120hz monitor, but if what you say is true @Ashley, then it will run at double speed. Is there a way to fix the max framerate to 60? Should I just edit the .js?


From this article: http://www.learn-cocos2d.com/2013/10/ga ... me-or-not/

Even today, framerate-dependent gameplay is the de facto standard for 2D games on gaming devices with a locked refresh rate (meaning: vertical synchronization is always enabled).


Most moderately complex games employ a game simulation module that is updated at a fixed rate regardless of the framerate. This game simulation is completely separated from the visual side of things, just like OpenGW. Many games can do away with a 30 Hz or even a 10 Hz update rate of the game simulation. The delta time is only applied to the visuals.

What happens is as follows: the game world is updated once every tenth of a second and rendered to the screen in the same frame. The visual side then (linearly) interpolates the current game object’s positions by multiplying their velocity with the delta time for the next 5 frames, until in the 6th frame the game world is updated once more.



Could we have something like that in Construct? A simulation of fixed fps. It makes *SO* much sense for an engine that only does 2D games
B
28
S
12
G
4
Posts: 193
Reputation: 4,581

Post » Tue May 10, 2016 11:02 am

I think the alternate tick system will still work on a 120Hz monitor - at least in my example, it still uses dt on alternate ticks, which means it is moving in half-as-big steps at 60 Hz instead of normal size steps at 30 Hz. If you force dt to be constant, you are making a game design choice that breaks this, and the game will run double-speed on a 120Hz monitor.

As for varying the logic update rate, I can't see it working for a general purpose engine like Construct 2. There are two options:

- run logic at a lower rate than the display rate: this is fiddly to do in a way which doesn't just look like it's running at the lower framerate. Moving objects can be stepped, but they still have to be collision tested every step, and collisions can run events that have other consequences in general, so by then you may as well just run all your logic every step. I think this can work for custom-coded games with specific requirements, but I really doubt this is something you can just turn on for most games in general and have it "just work" - I think a lot of the time, the result would be the game just looks like it updates at the lower rate as well. Or you'll get really terrible collision skips where objects basically pass through other objects without registering a collision, because they only overlapped briefly and there wasn't a "real" tick during that time.
- run logic at a higher framerate than the display rate: this basically multiplies your CPU usage and hammers performance. Say you run logic at 120 Hz and display at 60 FPS. That doubles your CPU usage. People complain enough about performance as it is, I don't think we should add features to make that worse. Also if the logic rate is not a multiple of the display rate, e.g. 90 Hz logic and 60 FPS display, this creates the uneven-stepping problem you've already seen in this thread. If an object is moving 1 pixel per frame, there aren't enough display frames to show each update, so then you get an irregular pattern of 1-2-1-2-1-2...

So I don't see that either option is really any better. C2 has always done one logic step per display frame, and I think that makes most intuitive sense anyway: any less and sometimes there is nothing new to draw, any more and you burn CPU time simulating stuff you'll never see. And C2's approach has worked well for a very wide variety of games.
Scirra Founder
B
402
S
238
G
89
Posts: 24,622
Reputation: 196,011

Post » Tue May 10, 2016 1:35 pm

@Ashley you're right. You're always right. Thanks again, and sorry to have taken up so much space to figure out this stuff.
B
28
S
12
G
4
Posts: 193
Reputation: 4,581

Previous

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 7 guests