Page 1 of 1

Perfectly smooth scrolling

Posted: Sun May 07, 2017 3:43 pm
by reno57
Hello,

I'm creating a 2d game with an multi-directionnal scrolling. I implement it using a quite common feature called a camera that can translate the background when the player moves. This kind of camera system is decribed in many tutorials in the forum
My issue, is that i dream of a perfectly smooth and clear scrolling as we could see on old arcade cabinets.
However, until now what i see in window mode is a little blurry and some artefacts appear.

Have you any technical sugestion to improve the quality of the scrolling to reach the arcade cabinet quality ?

Hope this question will also help other game developper.

See you

Re: Perfectly smooth scrolling

Posted: Sun May 07, 2017 8:19 pm
by raidho36
What you mean is pixel perfect graphics. The only way to get those is to grid-lock the whole thing to the pixel grid. Old arcades and consoles simply didn't support rendering sprites partway between two pixels, so you never saw such issue.

There are two basic ways to accomplish this. The first is to render at exactly integer coordinates, exactly integer scaling ratios and exactly 90 degree angles or their multiplies. The second way is to disable texture interpolation for all relevant graphics. The second way will produce pixel-aligned graphics without the need to manually do it, but non-integer scale or non-right angles will still look like ass.

Re: Perfectly smooth scrolling

Posted: Wed May 10, 2017 6:17 am
by reno57
thanks for your advice, i will have a try

Re: Perfectly smooth scrolling

Posted: Wed May 10, 2017 3:03 pm
by D0NM
reno57 wrote: Sun May 07, 2017 3:43 pm Have you any technical sugestion to improve the quality of the scrolling to reach the arcade cabinet quality ?
See you
Basically, the arcade cab has worse possibilities to make a smooth scrolling than love2d does.

You can download our Zabuyaki and tweak our code. You can even borrow pieces of my code )
Please, look at my signature. There is a link to the site and to the GitHub.

To remove blurry stuff use this

Code: Select all

love.graphics.setDefaultFilter("nearest", "nearest")
also round down the drawing tiles/sprites coordinates like this

Code: Select all

mainCamera:update(dt, math.floor(coord_x * 2)/2, math.floor(coord_y * 2)/2)
PS Does our game look like an arcade cab one?
I'm going to add more stuff to the in-game camera and the screen scrolling. Now coding other things. :joker:

Re: Perfectly smooth scrolling

Posted: Wed May 10, 2017 3:40 pm
by zorg
Whenever i see coordinates rounded in -update- functions, i think it may be a bad thing, since that will mess up sub-pixel calculations in the long run; you want to floor them only when drawing stuff, and not keep those modified values.

Re: Perfectly smooth scrolling

Posted: Wed May 10, 2017 4:23 pm
by D0NM
yup. that might be the reason of some "wobbly" camera behaviour.