solarus-games / solarus

This repository was moved to GitLab: https://gitlab.com/solarus-games/solarus
http://www.solarus-games.org
Other
712 stars 134 forks source link

Line artifacts when displaying animated tiles (SDL bug?) #641

Closed ghost closed 8 years ago

ghost commented 9 years ago

Hi,

I have been working with Solarus 1.3 for a while, both in Windows and Linux distributions, and I've seen there's a small bug when displaying animated tiles. Sometimes, depending on the position of the hero in the screen, there appears a small black line right at the edge of the tile. I attach an image to illustrate this: 2015-01-24-165259_1280x1024_scrot I've seen this happen in Mistery of Solarus DX and XD too, so it's a problem in the engine.

I suppose you're already aware of this, but I report it just in case. :) Thanks a lot for your work. Solarus is helping me a great deal, love it. (also, never posted in Github before, hope I'm doing it right)

vlag commented 9 years ago

Hi, and welcome :)

Actually it's an SDL bug. As you probably noticed it, the bug doesn't occur with the normal display, and with a display size which is a multiple (so 320x240 works fine, as well as 1280x960). However there are no difference on the way to handle the normal and the resized display on the Solarus side, tiles are placed on the exact same pixel and have the exact same size.

The issue is already reported on the SDL bug tracker, and I hope it will be fixed for the next release :)

ghost commented 9 years ago

Oh, I see. That makes sense. Thanks for clearing it up, and for the quick response! Let's hope it gets fixed :) For the moment, I'll simply change the background tileset color to something more neutral so the bug isn't so noticeable.

christopho commented 9 years ago

The known SDL bug is here: https://bugzilla.libsdl.org/show_bug.cgi?id=2336 There is also this discussion: https://forums.libsdl.org/viewtopic.php?t=9866&sid=0c905cfc712a811965568be86aa4b8a9

The symptoms are the same, but the cause must be different. The bug we know does not happen in Solarus because we simply never call the buggy function SDL_RenderSetClipRect(). Also, the bug we know could only occur in fullscreen, and your screenshot shows a window. The problem is a rounding issue with the black bars that are added by SDL when your ratio is larger than the one of the quest. A funny thing I remember is that I could not even take a screenshot of the problem, because the captured image was actually okay :)

But again, we never call the buggy function SDL_RenderSetClipRect() so I am surprised to see that you observe this problem in release 1.3. What is the resolution of your screen?

ghost commented 9 years ago

Mmm. Well, I'm using a Gameboy screen size in my quest, 160x144, which is admitedly a weird screen size, but I get the same problem with the default 320x240. The glich only seems to happen when the screen size is increased by the user. The default x2 ratio works okay; it's when you make the screen bigger that there's a problem, no matter if the game is in fullscreen mode or not.

Mmm. Let me try different resolutions. I don't see the glich with a low resolution (the lowest I've been able to test is 800x600), but that may be simply because there's not much room to make the screen bigger. I do get the glich in 1024x768 and 1280x960 resolutions. With a 1280x1024 resolution, the glich is invisible in a maximised 320x240 screen, but when I test it with my own 160x144 screen size and make the screen as big as I can, I do see it. The line is faint, but there.

Now that you mention it, I do experience another graphical problem with animated tiles that I haven't been able to take a screenshot of. When the hero walks diagonally, the animated tiles get cut diagonally with a "stripe", as well, which follows the hero's direction. Something like this: captura I'm not entirely sure what this "stripe" is. But I just mention it in case it's related in some way to the other bug. (this one, however, happens no matter the resolution and no matter if the screen has been made bigger by the user or not) So far, animated tiles are the only kind of entities that seem to be causing me some trouble.

I've only been reading the quests documentation, not the engine documentation, so I am not yet completely aware of how the engine works internally. Hope this helps, though. If you want more information, just ask. :)

vlag commented 9 years ago

@christopho : Actually the bug I was thinking about is this one : https://bugzilla.libsdl.org/show_bug.cgi?id=2382

@AfroditaPeloAfro : I never experienced the animated tiles bug, so it is indeed something to dig but I don't think that it is related to the same bug than the original one.

The first glitch indeed only appears when the window is resized by the user, into a non-multiple of the original size. Higher is the window size compared to the original one, wider will be the glitch, because either the start position of some tiles will be rounded on the final window display, or because their end position will be truncated. About the fullscreen issue, I guess that it is related to your screen resolution, but the behavior seems to be the same.

vlag commented 8 years ago

In case, I don't experience the line artifact anymore once SDL updated to 2.0.4.

christopho commented 8 years ago

Good news! I will check for 1.5.1.

christopho commented 8 years ago

Fix confirmed. No problem with SDL 2.0.4.

christopho commented 8 years ago

Keeping the bug open to update the SDL version in the windows port.

christopho commented 8 years ago

Done