Scroll Jitters

0 favourites
  • 11 posts
From the Asset Store
All popular touch mechanics - scrolling, zooming, swiping
  • 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.

  • You should do it this way ...

    Playerbox.X > 12


    Playerbox.X <= 12

    That should solve it


  • 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.

  • 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.

  • 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.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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/-12

  • Can't imagine what you are trying to do. Any .capx file?

  • 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.

    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)

    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.

    <img src="" border="0" />

  • 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.

  • 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.

  • 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.

    Ah, sounds exactly like what is happening.

    I doubt it'd be a major issue, but I assume it's a valid issue for some minor things like this. Is there any sort of guideline on how to organize things, or should I just make it so every group that has an every-tick function to have the every-tick last?

    EDIT:Put it below in the group and still having occasional jittering.

    Editx2: Tried messing with it and using dt to see if I could use it to prevent it, but somehow made it so it would stutter and then still stutter when I stopped moving.

    Went to another tab, came back and it wasn't stuttering anymore. Since I couldn't get it to stutter on the live versions, going back to assume it's a non-issue for now as it mostly only affects Preview. Leaving the every tick on the bottom of the player group just because it can't hurt.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)