Pixel rounding & round function issue! Might be a feature :)

0 favourites
  • 7 posts
From the Asset Store
Vintage steam pixels for your UI! 125 unique assets in a single pack!
  • Problem Description

    Hi, this might be a bug.

    I encounter this problem every time, I try to make a platformer. As soon as I turn "pixel rounding" on, the platform is sometimes indecisive with the position of the sprite. It seems not to round down/up consequently (at the 0.5 threshold) between values thus causing the platform-sprite to shake between X Y and X+1 and Y+1.

    test_example.capx

    This is very simple and basic, just a platform behavior with scroll to the sprite object. Note how the spite and cam is shaking 1 px to any direction, when jumping or moving. Is there maybe a rounding bug causing this?

    In my understanding, when "pixel rounding" is on, means - as you wrote in previous bug reports - that the drawn sprite (but not the object itself) is (displayed) at a rounded position. If the object position does not change, the displayed position still can vary, if rounding is not consequently deciding at a certain threshold.

    test_round.capx

    To visualize that further, the second example is with round(x,y) on both, the cam, and the object. As you can see, the object is floating 1px above the ground. As soon as you move horizontally, it drops 1px touching down.

    Is there maybe a rounding bug? In my understanding, when pixel rounding is on, means - as you wrote in previous bug reports - that the drawn sprite (but not the object itself) is (displayed) at a rounded position. Is this then maybe related to the same not consequently rounding-error?

    No matter, what I do, there is always a little unwanted shake on the platform object.

    Steps to Reproduce Bug

    • See test_example if you experience the shaking
    • See test_round.capx to definitely see the described effect/problem

    Observed Result

    Platformer is shakin 1 px X and Y direction (in both files, the second is more obvious)

    Expected Result

    Platform object movement and scrolling should be without any shakes. No changes of Y, if moving horizontally on floor.

    Affected Browsers

    • Chrome: YES
    • FireFox: YES
    • Internet Explorer: YES

    Internet Explorer 11: YES

    Safari (MacOs): YES

    Operating System and Service Pack

    ____ Windows 7 64x SP1 ____

    Construct 2 Version ID

    ____ Stable v. 190 (64bit) ____

    also tried 194 (64bit) beta and 194.2 (64bit) beta, and I already have that problem since v 168 or something, since I use construct 2

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Here is a movie captured of the phenomenon: https://dl.dropboxusercontent.com/u/297 ... truct2.rar

    Please help!

  • MultipleChoice

    For your first capx file : [attachment=0:2f9g3fg4][/attachment:2f9g3fg4]

    If you disable or remove the action Platform | Set position to (round(self.x), round(self.y)) It works fine. No shaking no 1 pixel jog.

    For the second capx file : [attachment=1:2f9g3fg4][/attachment:2f9g3fg4]

    Change scroll to action to System| Set position to (round(Sprite.x), round(Srpite.y)) Works fine. No shaking no 1 pixel jog.

  • :Thanks, but actualy it still does, just rarely and less noticeable, since the cam is smoother. Essentially I am looking for a way to eliminate the platform jittering completely.

    So all the examples are just extreme, to point out the problem. No matter, what I do, sometimes the player-sprite snaps 1 px up sometimes, when stopping on the floor.

  • Looks like the exact same problem for me!

    when i set scale layout to 2 and more, my character animations begin to stutter in a strange way. There's like 1 px shaking on the animation. Am i doing something wrong? My character is a 32 x 32 sprite attached to an invisible behavior sprite. When i reduce the scale, it behaves normaly. Is this a bug??

    In the meantime, i found out that pixelrounding OFF does remove it. However i have to test it some more, but for now it looks smooth.

  • I didn't knew that making a pixel platformer is such a pain in C2 + Cocoonjs. Very little forum support on vital questions, lots of obstacles, not a unified opinion whether to use pixel rounding or not, Cocoonjs not supporting letterbox integer scale, Local storage not working in Webview+ etc etc. Some of these vital things, should be covered in the basic tutorials like this scaling issue.

  • marcel1980 : Yeah man, its so close to good, but I also always run in the end in a lot of restrictions. Its a good feeling though, when you manage to get rid of them No, seriously, you have to adapt your creativity..

    Basically all web-coding is like this. It's a wonder (browser wise that is) that it already works like that. All html/css/jqery/cocoonJs and even JavaScript itself is a big mess. Additionally, all systems have their limits, especially cross-platform.

    I think construct2 is a great pioneer pushing the limits and allowing people like me, who have no clue of coding, but perfectly capable of structured and logical thinking can get great stuff done... And hey, at least, if you achieved something, you might be one of the first! And the learning curve is extremely quick, if you get the drift.

    I have to disagree with the lack of documentation/information and the help. There is a lot of great stuff out there, even tons of YouTube tutorials... It is just sometimes hard to find what you need. But after all, we are here to help each other, right?

    Until now, I always came up with an acceptable solution - and I am picky

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