Scroll Jitters

Get help using Construct 2

Post » Sat Feb 23, 2013 10:27 pm

Sometimes when I have the camera moving it jitters. What I have works perfectly except the jittering.

My scrolling is set up like this:

Every Tick
-Playerbox.X - scrollx >= 12
--Set Scroll X to Playerbox.X - 12
-Playerbox.X - scrollx <= -12
--Set Scroll X to Playerbox.X + 12

edit: typo and forgot comparison with scrollx

This kind of scrolling has a dead area the center of the screen so the camera is not locked on to the player.

However occasionally (not too oftem) it jitters when going right, or left. Can't reproduce it on command. I added a Wait 0.001 seconds function but that doesn't do anything to alleviate the problem.Thndr2013-02-25 00:15:00
B
15
S
4
G
4
Posts: 294
Reputation: 3,225

Post » Sat Feb 23, 2013 11:35 pm

You should do it this way ...
Playerbox.X > 12
and
Playerbox.X <= 12
That should solve it
Cheers...
B
35
S
16
G
16
Posts: 2,222
Reputation: 16,589

Post » Sat Feb 23, 2013 11:47 pm

Sorry, had a typo in the first post.

Anyway what I have is an area 12x on either side of scrollx which is a dead zone. All that works, it's just that occasionally going outside the deadzone, it jitters. It's pretty rare but happens.
B
15
S
4
G
4
Posts: 294
Reputation: 3,225

Post » Sun Feb 24, 2013 11:23 pm

Tried it another way but it still jitters.

Every Tick
-Playerbox.X - scrollx >= 12
--Set Scroll X to scrollX + (60*dt)
-Playerbox.X - scrollx <= -12
--Set Scroll X to scrollX - (60*dt)

60 being the Playerbox speed.

Either way I do it it's smooth 97% of the time, but rarely when you make it scroll, it's like the process is lagging a tiny bit. only way to force it is to repeatedly move to scroll, stop and do it again and again until it unfortunately happens.
B
15
S
4
G
4
Posts: 294
Reputation: 3,225

Post » Sun Feb 24, 2013 11:53 pm

If you mean the entire game is occasionally stuttering, I've found this happens anyway and just seems to be a performance issue. I generally find it runs very smoothly, but every now and then, I do get some stuttering in my game which sometimes lasts for several minutes, sometimes hours, then everything runs smoothly again. I get the impression that the browser is probably being lagged by something like a background process.
B
25
S
5
G
3
Posts: 446
Reputation: 5,633

Post » Mon Feb 25, 2013 12:13 am

Well it does it at 60fps.

What I mean is you're in the dead zone, no scrolling. You move right, outside of it, it scrolls. This functions perfectly except this minor hiccup

Occasionally instead of a smooth scroll, it scrolls, then stops then scrolls then stops so fast you see a double image. If you stop and move again, it doesn't happen. I'm getting 60fps during this so it's not a performance thing, but calculating the scroll effectively, or the scroll function is lagging behind for some reason.


I can force the stuttering by adding "wait dt" before the scroll action, or having the >= <= be greater/less than 12/-12Thndr2013-02-25 00:14:28
B
15
S
4
G
4
Posts: 294
Reputation: 3,225

Post » Mon Feb 25, 2013 7:16 am

Can't imagine what you are trying to do. Any .capx file?
B
6
S
1
Posts: 11
Reputation: 934

Post » Mon Feb 25, 2013 8:20 am

Don't have access to it at the moment, but was screwing around with a hosted version of the game. All I did to recreate it was move to make it scroll -and if it didn't jitter- stop moving, and then move again to make it scroll.

https://googledrive.com/host/0B7mHJO1CK--NN1hxV2IxWnM3dTA/gametest2.html

Seems to not have the stutter when at a proper scale, or at least I couldn't recreate it (That's 3x scale in an iframe)

https://googledrive.com/host/0B7mHJO1CK--NN1hxV2IxWnM3dTA/index.html

Seems to sometimes have a stutter, but fixes itself. (Scales to browser size)

Guess it happens more reliably during live preview (Scales to browser size). Since it seems to be a non-issue for now and only noticeable on my end, going to file it away as a non-issue until the issue comes back or someone has a better way to scroll with a deadzone.

Due to the confusion earlier, here's my entire scrolling code. Forgot to link it earlier when I was messing around with the capx.
Thndr2013-02-25 08:23:12
B
15
S
4
G
4
Posts: 294
Reputation: 3,225

Post » Mon Feb 25, 2013 3:26 pm

Try to place this event Every Tick below the player control, or on the very last row?

My guess is if the Every Tick event is on top, the player will move afterwards, leaving the scroll one tick behind.
B
6
S
1
Posts: 11
Reputation: 934

Post » Mon Feb 25, 2013 5:16 pm

It has a lot to do with the browser. I get next to no stuttering in Chrome, but Firefox it is really evident.

Try exporting your game to a node-webkit.

It has nothing to do with C2 or HTML5 either. You will get the same stuttering with flash games in the same browser.


Go into your graphics card settings and set tripple buffering , and V-sync to on for your browser and see if it helps you.

People who watch NetFlix, and Hulu know all too well about panning images in web browsers.

TL;DR; Web browsers are not a very good platform to make scrolling, or panning animations.
B
28
S
8
G
4
Posts: 767
Reputation: 5,940

Next

Return to How do I....?

Who is online

Users browsing this forum: Vegamon007 and 21 guests