Yeah discord message links will only work if you have access to that specific channel
PlayerSprite stutter and eventually is artifacted if drawn on canvas else not
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: PlayerSprite stutter and eventually is artifacted if drawn on canvas else not
Dragon
-
- Citizen
- Posts: 61
- Joined: Fri Feb 21, 2020 1:26 pm
Re: PlayerSprite stutter and eventually is artifacted if drawn on canvas else not
sorry
ty for your patience.
ty for your patience.
- Attachments
-
- 2DActionRogueLikeTest.zip
- (5.03 KiB) Downloaded 91 times
Re: PlayerSprite stutter and eventually is artifacted if drawn on canvas else not
There is a bit of 'jittering' but it's most likely the fluctuating delta time. As for graphical artefacts, I didn't notice any. That said, you can get a bit of persistence of vision with a large block of colour moving on a pure black background, which can look a bit like a ghost image. Is that what you mean? If so, the effect is usually reduced when you add some animation.
-
- Citizen
- Posts: 61
- Joined: Fri Feb 21, 2020 1:26 pm
Re: PlayerSprite stutter and eventually is artifacted if drawn on canvas else not
and you may know how get rid of this bit of jittering ?
https://www.youtube.com/watch?v=uvoMsw-4FC8
i think there are some at the edges and the sides top down left right.
what you mean with ghost image ?
and the strange is if i don't draw on canvas(you can close this easy out with 2 block comments in the love.draw method in the main.lua file)
it seems way better.
thanks in advance for all help so far !
https://www.youtube.com/watch?v=uvoMsw-4FC8
i think there are some at the edges and the sides top down left right.
what you mean with ghost image ?
and the strange is if i don't draw on canvas(you can close this easy out with 2 block comments in the love.draw method in the main.lua file)
it seems way better.
thanks in advance for all help so far !
Re: PlayerSprite stutter and eventually is artifacted if drawn on canvas else not
In 'conf.lua', what happens if you comment out the vsync line so that the default (off) is used?
-
- Citizen
- Posts: 61
- Joined: Fri Feb 21, 2020 1:26 pm
Re: PlayerSprite stutter and eventually is artifacted if drawn on canvas else not
doesn't seem to have any effect it seems to have always 120 fps on a 360 hz monitor. no matter vsync of commentet out or not.
but if i set it on false i get 60 fps.
but if i set it on false i get 60 fps.
-
- Citizen
- Posts: 61
- Joined: Fri Feb 21, 2020 1:26 pm
Re: PlayerSprite stutter and eventually is artifacted if drawn on canvas else not
dunno can it have to do with the framebuffer ?(i dont know even what this is exactly but this came into my mind)
Re: PlayerSprite stutter and eventually is artifacted if drawn on canvas else not
To help with debugging, I'd try drawing another element with a smooth animation, like some small shape going around a circular path. Drawing it like on the corner of the screen.
For example:
This way, when the player movement starts to stutter, I'd look at this other shape and see if it's also stuttering (so it's a display or framerate problem that affects the whole screen), vs it being some problem with the player movement code.
For example:
Code: Select all
local debugAngle = 0.0
function love.draw()
love.graphics.circle('fill', math.cos(debugAngle) * 100.0 + 200, math.sin(debugAngle) * 100.0 + 200, 25)
debugAngle = debugAngle + 0.1 -- Adjust this speed as necessary.
(...)
-
- Citizen
- Posts: 61
- Joined: Fri Feb 21, 2020 1:26 pm
Re: PlayerSprite stutter and eventually is artifacted if drawn on canvas else not
yep the circle doesn't seem to stutter.
do you see any mistake in my player movementcode ?
https://pastebin.com/TdSZFQM5
do you see any mistake in my player movementcode ?
https://pastebin.com/TdSZFQM5
Re: PlayerSprite stutter and eventually is artifacted if drawn on canvas else not
The problem is not in the movement code, although that is indeed written in a weird way: it's extremely difficult to control the player, as you're constantly accumulating speed on the xVelocity and yVelocity variables, making them huge. Like, you hold the key for 2 seconds and the xVelocity becomes as large as the entire map width.
xVelocity and yVelocity should have a top cap, a limit. That limit is usually reached instantly (whether the player is pressing the relevant keys or not), or the velocities can slowly work towards that limit in case you want to simulate acceleration, like in car racing games or realistic movement games like Prince of Persia, Another World etc.
But the actual stuttering problem comes from you drawing to an extremely small canvas, so there's not enough pixels to represent the soft position of the player, causing the impression of a stuttering. But it's lack of resolution. Edit: to clarify, when you upscale the canvas, what were pixels become larger squares on screen, and if the player is fast enough that they transition between pixels on consecutive frames, then when the canvas is upscaled, the player will step not between pixels but those actual squares, quite a big visual change.
Also, in love.draw() in main.lua, your "love.graphics.setBlendMode("alpha", "premultiplied")" line is causing text to render wrong.
xVelocity and yVelocity should have a top cap, a limit. That limit is usually reached instantly (whether the player is pressing the relevant keys or not), or the velocities can slowly work towards that limit in case you want to simulate acceleration, like in car racing games or realistic movement games like Prince of Persia, Another World etc.
But the actual stuttering problem comes from you drawing to an extremely small canvas, so there's not enough pixels to represent the soft position of the player, causing the impression of a stuttering. But it's lack of resolution. Edit: to clarify, when you upscale the canvas, what were pixels become larger squares on screen, and if the player is fast enough that they transition between pixels on consecutive frames, then when the canvas is upscaled, the player will step not between pixels but those actual squares, quite a big visual change.
Also, in love.draw() in main.lua, your "love.graphics.setBlendMode("alpha", "premultiplied")" line is causing text to render wrong.
Who is online
Users browsing this forum: Ahrefs [Bot] and 5 guests