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

Report Construct 2 bugs here.

Post » Sat Jan 17, 2015 4:16 pm

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[/list]
[*] Safari (MacOs): YES[/list]

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
You do not have the required permissions to view the files attached to this post.
Last edited by MultipleChoice on Thu Jan 22, 2015 12:14 am, edited 1 time in total.
B
8
S
3
Posts: 197
Reputation: 1,207

Post » Wed Jan 21, 2015 5:45 pm

Here is a movie captured of the phenomenon: https://dl.dropboxusercontent.com/u/297 ... truct2.rar

Please help!
B
8
S
3
Posts: 197
Reputation: 1,207

Post » Thu Jan 22, 2015 4:13 pm

@MultipleChoice

For your first capx file :
test_round_fix.capx

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 :
test_example_fix.capx

Change scroll to action to System| Set position to (round(Sprite.x), round(Srpite.y)) Works fine. No shaking no 1 pixel jog.
You do not have the required permissions to view the files attached to this post.
Image Image Image
B
61
S
19
G
6
Posts: 325
Reputation: 7,944

Post » Thu Jan 22, 2015 9:08 pm

@facecjf :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.
B
8
S
3
Posts: 197
Reputation: 1,207

Post » Fri Jan 23, 2015 2:48 pm

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.
B
8
S
4
G
1
Posts: 191
Reputation: 1,873

Post » Fri Jan 23, 2015 3:05 pm

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.
B
8
S
4
G
1
Posts: 191
Reputation: 1,873

Post » Fri Jan 23, 2015 3:35 pm

@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 ;)
B
8
S
3
Posts: 197
Reputation: 1,207


Return to Bugs

Who is online

Users browsing this forum: amir2244 and 0 guests