Should I combine Controller and Animation?

Get help using Construct 2

Post » Sat Jan 17, 2015 3:16 pm

Thanks guys!

@cacotigon
Unfortunatly it does not solve the problem. It is rather based on the pixel-rounding adjustment, which does not seem to work properly. It looks, like the moved sprite is not rounding first down, then up, between two whole number as it is expected, thus causing the platform sprite and the camera shake back and forth 1 px on both, X and Y axis.

@FraktalZero
Good approach. The lerp movement causes combined with pixel rounding a better, but still uncool effect though. At the end of the movement when the values are less than a pixel. It looks also a bit odd, like jumping, since 1 px is too big for the last steps of the ease, and it takes ages before the last pixels snap to the final value.
In my experience it is better to use the sine-behavior, if possible of course, since it is behaving with pixel rounding a bit smoother, the movement being less eased, I guess. But this is obvious, and not the problem at all.

I already tried Scroll to ROUND(Sprite.X, Sprite.Y), which works for the cam itself. But the "Sprite"-platform itself is still not rounded properly and shaking :(
It seems, like a pixel rounding-bug in the platform behavior.
B
8
S
3
Posts: 197
Reputation: 1,207

Post » Sat Jan 17, 2015 3:40 pm

I also did another test with rounding the sprite position, but that has a strange effect. The platform now is 1 px above the ground, if you don't touch the arrow buttons. As soon, as you move HORIZONTALLY, the platform object snaps 1 px down on X, touching the ground.

Is this maybe a rounding bug altogether? (Also when I'm not rounding, a similar effect happens to my platform, which should be drawn at a rounded X/Y position.)

See here:
You do not have the required permissions to view the files attached to this post.
B
8
S
3
Posts: 197
Reputation: 1,207

Post » Sat Jan 17, 2015 8:18 pm

Why not just set it to Self.X instead of round(Self.X) ?
Also, what would you like to accomplish actually?
B
43
S
12
G
14
Posts: 488
Reputation: 10,570

Post » Sat Jan 17, 2015 8:46 pm

I was doing something similar on a cinematic platformer prototype. Except I was using a PlayerDetect Sprite.
Difference is I wasn't using behaviours at all, so it was mostly animation driven. I modified the right/left movement slightly to work with your system.

https://www.dropbox.com/s/052x0j4kv9rg5oj/movementTest.capx?dl=0
B
43
S
12
G
14
Posts: 488
Reputation: 10,570

Post » Sun Jan 18, 2015 3:27 pm

@FraktalZero First, I am looking for an explanation, why the standard platform behavior causes the 1 px shaking, as described.
Second, I would like to get rid of it ;) I wish it would just work as expected, moving steady and smooth to different direction.

So mostly, since every time I start a platform I face this problem, I would like to have an explanation, to know if and how I can avoid this problem in the future.

I tried the "round" function, because since "pixel rounding" is on, its obvious, that the platform's sprite has to be displayed at a certain rounded position, which might not work perfect. But It seems to make it worse, so my suspicion is a rounding issue in Construct 2. This maybe a bug, but maybe due to a mathematical problem.

Do you experience these problems at all? In your own experience? With my example files, any of those?
B
8
S
3
Posts: 197
Reputation: 1,207

Post » Sun Jan 18, 2015 5:36 pm

Yes, I did experience some problems with the rounding in your file. I also had similar problems which I had to patch rather than completely fix in my current prototype build.
The problems were a little more obvious when I wasn't using behaviours for the platforming. Out of curiosity, why aren't you using the standard platformer behavior? Is it because you want more control? Like old cinematic platformers? (Flashback, PoP, etc)
B
43
S
12
G
14
Posts: 488
Reputation: 10,570

Post » Sun Jan 18, 2015 10:53 pm

@MultipleChoice: I've tested your original example as well as the one you posted in the bug report test_example.capx. This "shaking" you're referring to, the problem with the "shaking", is it possible that this is a v-sync / graphical glitch?

Here are some test cases you should try out:
1. Turn a small layout, disable camera following code
2. Pixel rounding off / on
3. Sampling - Linear/Point

In which combination of these options does the problem go away?

If we can narrow the problem down to the scrolling code, maybe try only moving the camera when the difference between (Scrollx, scrolly) and (PlayerX, PlayerY) is > 1 pixel. Also try using a lerp for the camera to see if it smooths out the scrolling any.

Just set a local variable CameraSpeed to 1/2.
Code: Select all
Scroll to position:
lerp(ScrollX, PlayerBox.X, dt * CameraSpeed)
lerp(ScrollY, PlayerBox.Y, dt * CameraSpeed)
B
31
S
7
G
8
Posts: 232
Reputation: 6,274

Post » Wed Jan 21, 2015 10:48 am

Hey, @cacotigon , @FraktalZero

As I wrote, it is related to the "pixel rounding = on" setting. Sampling does not matter. If pixel rounding is off, that makes it go away. But I need pixel rounding on for pixel style games... I also started a bug report-thread, let's see, what comes back.

So the problem is not the ScrollTo itself, but the platform object is jittering/shaking as described, causing the cam also to shake, when ScrollTo target is the Platform object.
So I don't want to smooth the camera at all, but the platform object-movement should be smooth. The problem is just more obvious to see, if the came also shakes with the platform object.
B
8
S
3
Posts: 197
Reputation: 1,207

Post » Wed Jan 21, 2015 2:35 pm

@MultipleChoice

You need to record a video of this issue, because I cannot repro what you describe in your bug report. Movement with Pixel rounding on/off with your sample capx was *completely identical* on my system. I'm starting to wonder if this might be related to video drivers. I'd recommend testing this issue on a couple different computers.

EDIT:
Also check this on-going thread about jitter issues in general:
https://www.scirra.com/forum/r190-jerking-on-ie-chrome-firefox-opera_t119846
B
31
S
7
G
8
Posts: 232
Reputation: 6,274

Post » Wed Jan 21, 2015 5:43 pm

> @cacotigon Appreciate your support man ;)

Here is the video: https://dl.dropboxusercontent.com/u/297 ... truct2.rar

I also saw those threads, but none seemed to handle platform behavior, very similar though. I am going to post the video also there, it indeed seems related.
You can see how the platform starts jittering AFTER I turn PIXELROUNDING ON, in the second half of the movie. I even did a slowmo of it at the very end.

> @Magistross : Please take a look, you might know something about this. Thank you!
B
8
S
3
Posts: 197
Reputation: 1,207

PreviousNext

Return to How do I....?

Who is online

Users browsing this forum: baks, jbr190, plinkie, TRMG and 34 guests