[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] I'm getting BSOD while using PyGame.



On Nov 12, 2007 3:40 PM, claxo <clazzt@xxxxxxxxxxxx> wrote:
> Try to shortcut all the fps - cpu caping in your code, see if it
> crash or freezes.  Its seems to me that that all the restrictions are
> fighting. If doenst crash, we know the problem is in the caping.
>
> claxo

updated code: http://www.newmech.com/pics/ZombieHunt-BSOD_update.zip (
updated, one line toggling on/off will either crash or not. see below
)

I removed everything from the program except screen.fill() and
screen.flip() calls and it ran. I then added everything back one at a
time until I found out what was crashing it.

Added Fps.py , and even toggling bLimitCPU it would not crash.

Added Map.py, but I only created the object, did not call map.render.
So that Map.__init__() gets called to make sure the problem is not the
map array initialization. It works.

I then tried calling self.map.render() , and this would run for about
5-15 seconds, blitting the tiles, then the BSOD. ( Stop: 0x0000000A )

To test if it was a surface problem, I wrote a new function
map.render_test() which blits the whole tileset surface to screen,
with no source rect's. It runs good.

So I know the problem is Map.render(). I elimiated getting the
tileID's at the render. Instead I use a static tileID 1. ( So the
source rect is always the same. ) To make sure it's not a dest rect
blit to offscreen causing problems, I skipped the outside tiles.

The line "self.map.render()" still crashes. Replacing it with
"self.map.render_test()" does not crash. I don't get it.

# snippet of: Map.py ( also in the zip )
    def render_test(self):
        """this render works"""
        dest_rect = pygame.Rect(0,0,0,0) # dest rect()'s ignore w,h values
        self.screen.blit( self.tileset, dest_rect )

    def render(self):
        """this render crashes to BSOD after about 5-15 seconds"""
        for y in range( 1, self.tiles_y -1 ):
            for x in range( 1, self.tiles_x -1 ):

                dest_rect = pygame.Rect( x*self.tile_w, y*self.tile_h,
                    self.tile_w, self.tile_h )

                # src_rect.x is tileID*tile_width ( I made it constant
for the test )
                src_rect = pygame.Rect( 1*self.tile_w, 0,
                    self.tile_w, self.tile_h )

                self.screen.blit( self.tileset, dest_rect, src_rect )