newsSGE Game Engine - News: A warning about a Pygame development version bug

 
 
Latest News
Pygame SGE 1.4.4 Released posted by onpon4, Wed Apr 5 17:17:49 2017 - 0 replies
Pygame SGE 1.4.3 Released posted by onpon4, Mon Jan 30 14:16:32 2017 - 0 replies
SGE 1.4.1.1 Released posted by onpon4, Sat Nov 5 20:46:04 2016 - 0 replies
SGE 1.3 Released posted by onpon4, Wed Nov 2 14:52:55 2016 - 0 replies
SGE 1.2 Released posted by onpon4, Mon Oct 17 18:23:35 2016 - 0 replies
[Submit News]
[30 news in archive]

A warning about a Pygame (or SDL?) bug

Item posted by Julie Marchant <onpon4> on Thu Oct 9 13:54:58 2014.

Today, I noticed something odd and extremely frustrating: when a game I'm working on for Pyweek was switched to and from fullscreen, it was often (seemingly randomly) shutting down all keyboard controls. The game acted like the keyboard didn't exist. This is especially frustrating when the game is in fullscreen, because at that point, X gives the game full control over everything, so there was nothing I could do except reboot with the magic SysRq key.

Well, I did some digging, and I found that it's a Pygame bug, specifically a bug in the pygame.display.set_mode function that occurs when this function is called more than once in a run (removing these calls caused the problem to disappear). It seems to affect all versions of Pygame on my system (Trisquel 6), so it could be that this is an SDL bug (and a quick search for the problem in relation to SDL seems to confirm this).

So, what to do about this? Well, I'm honestly not holding out on the bug being fixed. The Pygame project seems to have been dead for quite some time, and SDL 1.2 (which is what Pygame uses) is an old release which I believe is unmaintained. But we can work around this.

The first way is to never attempt to change the window size or fullscreen state while the game is running. This is absolutely sub-optimal, of course.

The second way is to make it possible to close the game with a mouse click somehow. There could be a close button somewhere, or if the game doesn't use the mouse, clicking can simply cause the close event.

The best solution right now is probably the second workaround: make it possible to exit the game with the mouse and clearly warn players about this problem (and the mouse-exit fallback) in the documentation.

Ultimately, though, the proper solution would be for this bug to be fixed in Pygame or SDL 1.2, wherever the problem lies, so if anyone can do that, please do so.

Update: I originally only observed this problem with Pygame 1.9.2a0, but now I've seen it in Pygame 1.9.1 as well. I'm not sure why I didn't see it previously in Pygame 1.9.1.

Comments:

No messages in A warning about a Pygame (or SDL?) bug

 

Back to the top


Powered by Savane 3.1-cleanup1