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

 
 
Latest News
SGE 1.5.1 Released posted by onpon4, Wed 19 Jul 2017 08:20:36 PM UTC - 0 replies
SGE 1.5 Released - What A Mess posted by onpon4, Sun 11 Jun 2017 01:43:28 PM UTC - 0 replies
Pygame SGE 1.4.4 Released posted by onpon4, Wed 05 Apr 2017 05:17:49 PM UTC - 0 replies
Pygame SGE 1.4.3 Released posted by onpon4, Mon 30 Jan 2017 02:16:32 PM UTC - 0 replies
SGE 1.4.1.1 Released posted by onpon4, Sat 05 Nov 2016 08:46:04 PM UTC - 0 replies
[Submit News]
[32 news in archive]

A warning about a Pygame (or SDL?) bug

Item posted by Julie Marchant <onpon4> on Thu 09 Oct 2014 01:54:58 PM UTC.

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