Perfectly smooth scrolling

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
reno57
Prole
Posts: 17
Joined: Thu Apr 14, 2016 9:46 pm

Perfectly smooth scrolling

Post 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
User avatar
raidho36
Party member
Posts: 2063
Joined: Mon Jun 17, 2013 12:00 pm

Re: Perfectly smooth scrolling

Post 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.
reno57
Prole
Posts: 17
Joined: Thu Apr 14, 2016 9:46 pm

Re: Perfectly smooth scrolling

Post by reno57 »

thanks for your advice, i will have a try
User avatar
D0NM
Party member
Posts: 250
Joined: Mon Feb 08, 2016 10:35 am
Location: Zabuyaki
Contact:

Re: Perfectly smooth scrolling

Post 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:
Our LÖVE Gamedev blog Zabuyaki (an open source retro beat 'em up game). Twitter: @Zabuyaki.
:joker: LÖVE & Lua Video Lessons in Russian / Видео уроки по LÖVE и Lua :joker:
User avatar
zorg
Party member
Posts: 3453
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Perfectly smooth scrolling

Post 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.
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.
User avatar
D0NM
Party member
Posts: 250
Joined: Mon Feb 08, 2016 10:35 am
Location: Zabuyaki
Contact:

Re: Perfectly smooth scrolling

Post by D0NM »

yup. that might be the reason of some "wobbly" camera behaviour.
Our LÖVE Gamedev blog Zabuyaki (an open source retro beat 'em up game). Twitter: @Zabuyaki.
:joker: LÖVE & Lua Video Lessons in Russian / Видео уроки по LÖVE и Lua :joker:
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 5 guests