How would you guys do slow movement in low resolution games (like for example NES games)?
For example move the player for 0.5 pixels at a time.
I tried just rounding the position inside draw(), but results where jerky (which is kinda logical).
I'm now thinking of implementing a system where I just skip frames entirely.
For example 0.5 pixels movement per frame on 60 fps, is the same as 1 pixel movement on 30fps.
I know this has some limitations to what speeds I could use, but I think 0.25px, 0.5px, 1px and 1px+ should be enough for my use case.
Might be good to know I choose to ignore deltaTime and I'm using a "fixed time step with an accumulator" to keep the game running at 60fps (sort of).
Slow movement in low resolution games
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: Slow movement in low resolution games
Ok seems I figured it out... all though I don't completely understand it yet...
Rounding the x and y in draw() DOES work, but x needs to be rounded up while y needs to be rounded down... ¯\_(ツ)_/¯
Rounding the x and y in draw() DOES work, but x needs to be rounded up while y needs to be rounded down... ¯\_(ツ)_/¯
Code: Select all
public draw(): void {
const x = math.ceil(this.x);
const y = math.floor(this.y);
this.animation.draw(x, y); // this is my own animation class that draws a simple sprite based animation at x, y
}
Re: Slow movement in low resolution games
Some people may disagree, but I'd say just use subpixels (i.e. either round coords to subpixels or possibly don't round the coords at all). There is a trade-off that has to be made between nice smooth movement and "true pixel-perfect low resolution retro pixel-art" visuals.
You can also mix rounding and not rounding depending on what is being rendered. For example, don't round characters, but do round certain effects if they happen to look better that way.
(By the way, using a fixed time step like you've chosen is generally a good idea, at least when it comes to logical movement and physics.)
You can also mix rounding and not rounding depending on what is being rendered. For example, don't round characters, but do round certain effects if they happen to look better that way.
(By the way, using a fixed time step like you've chosen is generally a good idea, at least when it comes to logical movement and physics.)
Tools: Hot Particles, LuaPreprocess, InputField, (more) Games: Momento Temporis
"If each mistake being made is a new one, then progress is being made."
"If each mistake being made is a new one, then progress is being made."
Re: Slow movement in low resolution games
The floor/ceiling thing may be related to the rounding issue I encountered previously: https://love2d.org/forums/viewtopic.php?f=4&t=88933
Try not rounding at all, as ReFreezed suggested. Unless you're using love.graphics.points, in which case see the thread I linked for the solution.
Try not rounding at all, as ReFreezed suggested. Unless you're using love.graphics.points, in which case see the thread I linked for the solution.
Any code samples/ideas by me should be considered Public Domain (no attribution needed) license unless otherwise stated.
Who is online
Users browsing this forum: Bing [Bot], Google [Bot] and 1 guest