Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: [RESOLVED][GIF Included] Bizare flickering when drawing small minimap?  (Read 3361 times)

0 Members and 1 Guest are viewing this topic.

BesomeGames

  • Newbie
  • *
  • Posts: 8
    • View Profile
    • Email
Hello,

I'm using SFML 1.6 and this is the weirdest issue I can't figure out. In my project I'm drawing two tile maps currently, a large one that works fine and this new small one that has this weird flickering issue.

I load a large image then use Image.Copy to create the tiles from a large sheet. No matter what I've changed I can't seem to figure out what the hell is going on here.

Do you have any idea what would cause this? I've been working on this project for years and have never seen this before until I just added this map, which is a carbon copy of the current map from how its created to how its drawn.

Which tiles flicker is completely random, if I walk around the same tile that was flickering no longer is, but a different one does. I can't predict where or which ones have the issue. I am using std::map<std::string, sf::Image> images; to store the images, there is currently probably over a hundred images already stored inside which don't have this issue. The images that are drawing were created with Image.Copy and not loaded using SFMLs loading functions.

EDIT: Could this be caused by too many draw calls? I commented out some other functions that produce draw calls and the problem stops almost entirely, with one or two flickers very very rarely. I'll continue to see what I can do but I feel like it may be the result of too many draw calls or slow iteration.

« Last Edit: July 26, 2014, 05:15:12 pm by BesomeGames »

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: [GIF Included] Bizare flickering when drawing small minimap?
« Reply #1 on: July 07, 2014, 09:14:04 am »
SFML 1.6 is massively outdated... Your chances of getting help (and benefiting from bugfixes and new features) is much higher if you use a recent version such as SFML 2.1 or the last GitHub revision. Note also that even if that proves to be a problem within SFML, no one will ever fix it for your version.

Having said that, are you using shaders or manually interacting with OpenGL? Does it happen on an other machine? You should try to reduce and isolate the problem, ideally even come up with a minimal complete example. Since you say that this has not happened until you added the map, what about testing the map on its own?
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

BesomeGames

  • Newbie
  • *
  • Posts: 8
    • View Profile
    • Email
Re: [GIF Included] Bizare flickering when drawing small minimap?
« Reply #2 on: July 07, 2014, 09:23:10 am »
Is SFML 2.0 considered the main version now? I'm working on a networked game and require the use of the Graphics and Networking libraries, is SFML 2.0 missing any features if I were to upgrade?

I've been under the impression that updating my project from 1.6 to 2.0 would be a long and time consuming process so I have been reluctant to do so, but if it is stable and worth while I can dedicate the time to do so.

By commenting out other functions that produce draw calls I have nearly eliminated the problem. Could this be the result of too many draw calls? I've gotten the best results by moving the the minimaps draw function before another where I draw a lot of text onto the screen, probably 30-40 text calls, and the problem pratically goes away. If I comment out every drawing function besides the minimaps draw function it doesnt happen at all. It seems like I might be hitting a threshold of draw calls, yet I'm still getting 200+FPS on the project. Setting vsync, a frame limit of 60, or both doesnt change a thing.

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: [GIF Included] Bizare flickering when drawing small minimap?
« Reply #3 on: July 07, 2014, 09:30:15 am »
Is SFML 2.0 considered the main version now?
SFML 2.1 actually, but yes... SFML 1.x has not been worked on for several years.

I'm working on a networked game and require the use of the Graphics and Networking libraries, is SFML 2.0 missing any features if I were to upgrade?
The features should still be there, but the API may have changed a bit.

I've been under the impression that updating my project from 1.6 to 2.0 would be a long and time consuming process so I have been reluctant to do so, but if it is stable and worth while I can dedicate the time to do so.
It will take some time, but this list will help you. Yes, SFML 2 is much more stable than SFML 1 (regarding bugs, but also API). And it provides a lot more features.

By commenting out other functions that produce draw calls I have nearly eliminated the problem. Could this be the result of too many draw calls?
Hardly. The draw calls may just make the problem visible, but I doubt they actually cause it -- at least they're not supposed to. It may also be a bug in your graphics driver, make sure it is up to date.
« Last Edit: July 07, 2014, 09:33:35 am by Nexus »
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

BesomeGames

  • Newbie
  • *
  • Posts: 8
    • View Profile
    • Email
Re: [GIF Included] Bizare flickering when drawing small minimap?
« Reply #4 on: July 07, 2014, 10:03:39 am »
I tried the program on a different computer and there was no problem at all so it seems to be an issue with my hardware. I just did a clean install of the latest drivers for my graphics card but that didnt change anything. Is there a standalone opengl download I need or does it come included with the graphics card drivers?

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: [GIF Included] Bizare flickering when drawing small minimap?
« Reply #5 on: July 07, 2014, 10:11:21 am »
A basic version of OpenGL (the C API) is already installed on your operating system, but the graphics driver (middleware between C API and graphics card) needs to be installed from your manufacturer. So, updating graphics driver is enough. But make sure you actually go to the graphics card's manufacturer's page, operating systems or computer vendors tend to provide not the most recent version.

Out of interest, you don't happen to use an ATI card?
« Last Edit: July 07, 2014, 10:13:52 am by Nexus »
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

BesomeGames

  • Newbie
  • *
  • Posts: 8
    • View Profile
    • Email
Re: [GIF Included] Bizare flickering when drawing small minimap?
« Reply #6 on: July 07, 2014, 10:17:34 am »
No I am using a nVidia GTX 570, the laptop I tested on that works fine is also a nVidia card but much older. I just updated to the absolute latest drivers and I know the laptop is using much older ones. Is it possible I'm actually using much newer drivers and it's causing problems with 1.6 and the laptop is using much older drivers so it's more compatable?

I'm just trying to make sense of this whole thing, I can't recreate this problem on my other computer but it's been stopping my progress the whole night.

I'm assuming the only way to properly fix my problems will be updating to 2.0 and i'm soooo not looking forward to that. I've been working on this project for years and the source code is quite large, its going to be a hell of a mission.

Jesper Juhl

  • Hero Member
  • *****
  • Posts: 1405
    • View Profile
    • Email
Re: [GIF Included] Bizare flickering when drawing small minimap?
« Reply #7 on: July 07, 2014, 08:48:55 pm »
...
I'm assuming the only way to properly fix my problems will be updating to 2.0 and i'm soooo not looking forward to that. I've been working on this project for years and the source code is quite large, its going to be a hell of a mission.

As Nexus already said, the latest stable release is 2.1, not 2.0 and 2.2 is just around the corner.
There is going to be some work involved in a conversion, but in some cases it's as simple as a search+replace of a function name and even when it is not, the changes needed are not huge (as I see them based on the list Nexus linked).
And in the end I think you'll enjoy the result :)
« Last Edit: July 07, 2014, 08:57:09 pm by Jesper Juhl »

BesomeGames

  • Newbie
  • *
  • Posts: 8
    • View Profile
    • Email
Re: [GIF Included] Bizare flickering when drawing small minimap?
« Reply #8 on: July 26, 2014, 05:14:20 pm »
Funnily enough, it IS a driver problem! I was trying out the PCSX2 emulator and was experiencing flickering problems just like I was with SFML 1.6. The problem is with Nvidia drivers after 314.22. I rolled back my drivers to 314.22 and the problem went away with both PCSX2 AND SFML 1.6!!!

So, this is solved thankfully. I knew it was the drivers when I noticed it was fine on my laptop, which I knew had older drivers. Even though it works as expected now I'm still going to switch to SFML 2.1, as should anyone at this point. Thanks for the help, I hope someone Goggling that finds this can get some resolution from this.