Camera feeling shaky

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
snibo
Prole
Posts: 23
Joined: Sat May 04, 2024 6:56 am

Camera feeling shaky

Post by snibo »

Hello everyone I am trying to make a small rpg and when I got to making the movement and the camera I realized that it had a bunch of issues
Look at the video
[youtube]https://youtu.be/TQ6l7zjFonM?si=wgvBAa3gvbP5CHJF[/youtube]
Now you might understand what I mean the background seems to not be keeping up with the player and it also get a bit blurry whenever I moved wich is a bit nauseating to me

Si if someone know how to fix the choppiness and blurriness issues please tell me because I couldn't find anything on my own
User avatar
zorg
Party member
Posts: 3468
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Camera feeling shaky

Post by zorg »

Don't forget to math.floor camera coordinates, that might help.
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
snibo
Prole
Posts: 23
Joined: Sat May 04, 2024 6:56 am

Re: Camera feeling shaky

Post by snibo »

zorg wrote: Tue Jul 30, 2024 2:30 pm Don't forget to math.floor camera coordinates, that might help.
How do i do that?

Edit: I have figured out how to do it but all that did is amplify the snapping effect wich I don't really like and it also didn't fix the blurryness problem because when they switched to the next pixel it had the ugly quick blur in between the snapping
User avatar
slime
Solid Snayke
Posts: 3166
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: Camera feeling shaky

Post by slime »

It's hard to guess what needs to be fixed without seeing what your code is doing. Can you upload your project here as a .love file?
snibo
Prole
Posts: 23
Joined: Sat May 04, 2024 6:56 am

Re: Camera feeling shaky

Post by snibo »

slime wrote: Tue Jul 30, 2024 11:29 pm It's hard to guess what needs to be fixed without seeing what your code is doing. Can you upload your project here as a .love file?
Sur man. I just thought that it would be a more general question but you can see the code if you want to
Attachments
lovegame.love
(300.3 KiB) Downloaded 794 times
User avatar
marclurr
Party member
Posts: 158
Joined: Fri Apr 22, 2022 9:25 am

Re: Camera feeling shaky

Post by marclurr »

Because your camera is locked the player position, flooring just the camera makes the player look more "jittery". You need to floor both to see the improvement, but you should only floor the player position input to the draw function call, otherwise you'll lose any fractional position information. For example, do something like this:

Code: Select all

love.graphics.draw(player.sprite, math.floor(player.x), math.floor(player.y), nil, 2*player.scale, nil, 16, 26)
Instead of flooring you might want to try rounding to the nearest whole value. Sometimes that can make things look better, you should experiment with both.

The other thing you might notice is not jittering but an odd "staircase" looking affect when the player moves diagonally. This is a quirk of working at low resolutions. If you want to go down a rabbit hole there are some things you can do to improve it. This is an interesting video about that exact topic, in the context of making a shmup at a very low resolution (128x128) https://www.youtube.com/watch?v=stoDWgR-kF8&t=1451s
snibo
Prole
Posts: 23
Joined: Sat May 04, 2024 6:56 am

Re: Camera feeling shaky

Post by snibo »

Ok so I watched the video and his solution was not only flooring but adding 0.5 that way it gets to the senter of the pixel my only issue is that it doesn't seem to be 0.5 in love2d I feel like it's lower do you know what value should I use for it
User avatar
marclurr
Party member
Posts: 158
Joined: Fri Apr 22, 2022 9:25 am

Re: Camera feeling shaky

Post by marclurr »

It will be the same in Love2D, but his solution is more complex than just 0.5 then floor. All of his code works together to give the nice diagonal movement. Make sure you're happy with the player/camera stuff before implementing what's in that video.
snibo
Prole
Posts: 23
Joined: Sat May 04, 2024 6:56 am

Re: Camera feeling shaky

Post by snibo »

You know what I think that I am trying to fix the wrong problem by removing all the flooring and stuff I feel like it looks better, my issue with it is that the movement felt inconsistent where sometimes everything is very smooth and sodenly it changes place I don't know how to say it and flooring just amplifies the snapping effect wich I don't like
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot] and 10 guests