How to smooth out the camera

Discussion and feedback on Construct 2

Post » Wed Apr 22, 2015 11:29 pm

Hey guys,

I'm in a bit of a pickle.

For my camera, I'm using a simple "Every Tick" event.

Currently. my player's speed is 120. I want to reduce it to around 80 or 90 but if I do, the camera starts stutterly very slightly.
If I set it to 60, it's perfectly smooth, same with 120.

If I use multiples of 60, the camera is perfectly smooth, but anything else and it's kind of stuttery.

Any known fixes for this?
The moderators are corrupt and ban for no reason, especially that condescending neckbeard asshole Kyatric. The forums are filled with fanboys.
Banned User
B
22
S
7
G
1
Posts: 558
Reputation: 2,925

Post » Wed Apr 22, 2015 11:30 pm

That depends on how you are controlling your camera....
A big fan of JavaScript.
B
76
S
20
G
74
Posts: 2,244
Reputation: 46,462

Post » Wed Apr 22, 2015 11:39 pm

Colludium wrote:That depends on how you are controlling your camera....


I just use an Every Tick event with one action that sets the camera to the player's X and Y position.
The moderators are corrupt and ban for no reason, especially that condescending neckbeard asshole Kyatric. The forums are filled with fanboys.
Banned User
B
22
S
7
G
1
Posts: 558
Reputation: 2,925

Post » Thu Apr 23, 2015 12:27 am

Try: every tick, set scrollx to lerp(scrollx, playerx, 10*dt) and do similar for scrolly. Although it's not a totally accurate use of dt, it'll be more than adequate for smoothing out the motion of the camera.
A big fan of JavaScript.
B
76
S
20
G
74
Posts: 2,244
Reputation: 46,462

Post » Thu Apr 23, 2015 12:39 am

Yeah you don't really have a lot of options here. Using lerp() or anything for a dragging camera will just make it worse. One "fix" is to disable pixel rounding and use high-quality fullscreen scaling...but that's kind of against the rules if making a retro game ;)
Image
B
243
S
30
G
13
Posts: 1,787
Reputation: 18,770

Post » Thu Apr 23, 2015 10:40 am

Colludium wrote:Try: every tick, set scrollx to lerp(scrollx, playerx, 10*dt) and do similar for scrolly. Although it's not a totally accurate use of dt, it'll be more than adequate for smoothing out the motion of the camera.


I did a funny thing yesterday, I think I was trying to do that but ended up doing this:

lerp(playerx, playerx, 1 - 60^dt)

lol

@Tokinsom

Would disabling pixel rounding create any bugs?
The moderators are corrupt and ban for no reason, especially that condescending neckbeard asshole Kyatric. The forums are filled with fanboys.
Banned User
B
22
S
7
G
1
Posts: 558
Reputation: 2,925

Post » Thu Apr 23, 2015 10:44 am

Pixel rounding is purely graphic, it will only affect how the game is displayed.
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
53
S
22
G
18
Posts: 2,122
Reputation: 17,123

Post » Thu Apr 23, 2015 10:58 am

Tokinsom wrote:Yeah you don't really have a lot of options here. Using lerp() or anything for a dragging camera will just make it worse. One "fix" is to disable pixel rounding and use high-quality fullscreen scaling...but that's kind of against the rules if making a retro game ;)


Just tried disabling pixel rounding (fullscreen scaling was already high-quality).

Any known side effects of disabling pixel rounding besides stuff can get drawn between pixels?
So far it's just made the camera really smooth.
The moderators are corrupt and ban for no reason, especially that condescending neckbeard asshole Kyatric. The forums are filled with fanboys.
Banned User
B
22
S
7
G
1
Posts: 558
Reputation: 2,925

Post » Thu Apr 23, 2015 3:30 pm

Aphrodite wrote:Pixel rounding is purely graphic, it will only affect how the game is displayed.



Ah okay great, Thanks Aphrodite!

My game seems a lot smoother when it's turned off. So I think I'll give my game a bit of a cheat and keep it turned off. 8-)
The moderators are corrupt and ban for no reason, especially that condescending neckbeard asshole Kyatric. The forums are filled with fanboys.
Banned User
B
22
S
7
G
1
Posts: 558
Reputation: 2,925

Post » Fri Apr 24, 2015 12:59 am

You can try MoveTo behavior to make smooth moving,also this give you the option to change the speed any time you want.
B
60
S
10
G
10
Posts: 1,013
Reputation: 9,155


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 11 guests