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

2007-11-15 Thread DR0ID
Hi


 # 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 )
 
   


I think the problem is pygame.Rect(0,0,0,0)! Try to use Rect(0,0,1,1)
instead. I had once a similar problem, it crashed during a collision
check with a Rect of width and height 0.

I think pygame should handle a Rect(x, y, 0, 0) correctly, if not, I
would say its a bug that should be fixed (perhaps it has already been
fixed in svn, dunno).


~DR0ID


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

2007-11-15 Thread Jake b
On Nov 15, 2007 9:24 AM, DR0ID [EMAIL PROTECTED] wrote:
 Hi


  # 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 )
  
 


 I think the problem is pygame.Rect(0,0,0,0)! Try to use Rect(0,0,1,1)
 instead. I had once a similar problem, it crashed during a collision
 check with a Rect of width and height 0.

 I think pygame should handle a Rect(x, y, 0, 0) correctly, if not, I
 would say its a bug that should be fixed (perhaps it has already been
 fixed in svn, dunno).


 ~DR0ID

that function: Map.render_test(): is working correctly, it is stable.
I'm not doing any collision test on it, ill remember that for later.

It's the Map.render(): function that causes a crash. It's dest Rect()
width and height are set to self.tile_w, self.tile_h ( which are = 32,
32 )



-- 
Jake


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

2007-11-14 Thread Sami Hangaslammi
On Nov 12, 2007 10:07 PM, Jake b [EMAIL PROTECTED] wrote:
 I have Python: 2.5.1, and PyGame: pygame-1.7.1release.win32-py2.5.exe

Check the other thread on this mailing list titled BUG: seg fault
when loading image from file object. I'm guessing your problem might
be caused by same reason (mismatching DLLs in the
pygame-1.7.1-python2.5 installer).

-- 
Sami Hangaslammi


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

2007-11-14 Thread Jake b
On Nov 12, 2007 3:40 PM, claxo [EMAIL PROTECTED] 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: 0x000A )

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 )


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

2007-11-14 Thread Jake b
On Nov 12, 2007 5:25 PM, Brian Fisher [EMAIL PROTECTED] wrote:
 On Nov 12, 2007 12:07 PM, Jake b [EMAIL PROTECTED] wrote:
  I can get an equivalent c++ program to blit tiles using libSDL to work
  fine on both computers. That's why I'm wondering could it have
  anything to do with a certain version of PyGame + Python?
 
 What version of libSDL? is it 1.2.10 or above or 1.2.9 or below? cause
 with 1.2.10 and above they changed the default video backend - which
 is how pygame could be doing completely different things that the
 libsdl c++ app

It says it's using libSDL v1.2.7 for PyGame


  I have Python: 2.5.1, and PyGame: pygame-1.7.1release.win32-py2.5.exe
 
 That installer should be using SDL 1.2.7 which means it would be going
 through your directx driver. You could try running the game with the
 windib backend, which means it would use different drivers for a lot
 of the work. To do that, put this as like the first 2 lines of the
 script you run:

 import os
 os.environ[SDL_VIDEODRIVER] = windib

 If the script doesn't hang and BSOD when run that way, it would seem
 the problem would be caused by directx drivers misbehaving with what
 pygame would be telling them to do.


Switching the driver to 'windib' didn't fix it. The problem seems to
be map.render() ( I just posted the full code in my previous post )

-- 
Jake


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

2007-11-12 Thread Jake b
The source is at: http://www.newmech.com/pics/ZombieHunt_v0.2-BSOD.zip


 If you want more feedback, post more code ( from the non numeric
 version, to keep it easy)
 Cheers

 claxo


I attached the source of the version that always crashes on one
computer, but never on the other. ( So maybe it's a driver issue? But
I can get SDL on this computer working fine if I use c++ ( + libSDL ).
And most games run fine. ( They sometimes crash, but they don't do a
BSOD, they do a regular segfault/crash that the system stays intact.
I've also been updating my graphics and bios drivers incase, but that
didn't help. )

If there's something wrong with the way i'm init-ing video, or
blitting, that could be the problem, I would think it's in
ZombieHunt.py or Map.py. The other files don't do much, and I've used
those 3 in other programs.

ZombieHunt.py : initializes video, main game loop.
Map.py : stores Array2D() of the map, and blits tiles. ( using static
tile ID to rule out the .get() function causing problems )

fps.py : renders FPS to screen.
Helpers.py : only has the load_image() function from the official tutorial
Array2D.py : haven't updated with your changes yet, but it works.

On Nov 10, 2007 8:34 PM, claxo [EMAIL PROTECTED] wrote:



 On 10 Nov 2007 at 15:30, Jake b wrote:

  I've started on a very basic game, right now all it does is blit
  tiles to the screen. I used a NumPy tutorial to create a 2D array to
  store tileID's for rendering. But running it, caused my computer to
  get a Blue Screen Of Death.
 
  The code was x = ones( ( 3, 4 ) )
 
  I was surprised because I was running my game in windowed mode, if I
  called blit() witih an invalid value, or accessed an array out of
  bounds, I thought it would at worst crash to desktop. I have also
  tried the game Snowballz, ( it uses PyGame ) So my first guess was
  that it was NumPy that did it.
 
  I removed NumPy, creating my own basic 2D array class that seems to
  be working correctly stand-alone. I started to place it into my tile
  code, and I got the BSOD again. Now I know it's not NumPy. The wierd
  thing is even when it crashes, it seems to render the tileset at
  least once. Sometimes it had been running for a few seconds ( at 60
  renders per second ), but once it was the very first render that
  crashed.

 A BSOD is strange.
 Checking basics:
 Are you sure your alternative code has loaded ? I mean, if you run
 from the cmd prompt, by example
 c:\python24\python.exe myprog.py
 all modules are reloaded, but if you are runing from inside an IDE
 maybe you need to restart the IDE.

 Make sure the dir and files have standart attribs, ie no ReadOnly ,
 no Hide, etc. I remember a time when editing in IDE and running  from
 command line ,when IDLE writes the sources but the interpreter keeps
 loading the prev compiled module. Really weird. No warning messages.
 Just in case try deleting the .pyc before run the alternate (non
 Numpy) code.

I'm using SciTE, and running from a console. To check I wrote a script
to delete all of the *.pyc files, then run c:\python25\python.exe It
didn't fix anything.

None of the files are readonly, system, hidden, etc.

-- 
Jake


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

2007-11-12 Thread Jake b
On Nov 10, 2007 10:36 PM, Brian Fisher [EMAIL PROTECTED] wrote:
 On Nov 10, 2007 1:30 PM, Jake b [EMAIL PROTECTED] wrote:
  for rendering. But running it, caused my computer to get a Blue Screen Of
  Death.
 
 Blue Screen of Death on Windows XP means an error in kernel mode,
 always, no exception. No pygame or python module ships a driver or
 kernel mode component that I'm aware of. What this means is that the
 only way running a particular python + pygame project could cause a
 blue screen is by it making a call that makes a driver go do
 something, and it's the driver that crashes. For a game, this almost
 always means the video card driver - some other options would be sound
 card driver, virus protection program, bad memory, network driver.
 It's almost definitely video card, but if you look at the blue screen

I just replied to claxo, and I elaborated on this. I've updated my
BIOS and video driver and they didn't help. Or, instead of getting
BSOD's i'm now getting a crash where nothing responds. ( Not a 100%
cpu usage ) but keyboard, mouse, windowmanager, everything doesn't
respond. Sometimes it even does wierd graphical artifacts, and even
can on crash generate sounds when I was using no sound.

I have the same AVG ( grisoft ) on both computers, the one that the
game crashes, and the one that it doesn't.

I can get an equivalent c++ program to blit tiles using libSDL to work
fine on both computers. That's why I'm wondering could it have
anything to do with a certain version of PyGame + Python?

I have Python: 2.5.1, and PyGame: pygame-1.7.1release.win32-py2.5.exe

 before rebooting, you can often find the name of the driver that is
 faulting and then be sure about which component it is (look for
 drivername.sys near the top after The problem seems to be caused by
 the following file or on the very last line after a few asterixes)

In the past I have seen where it says driver nv.dll or a specific
message, but the BSOD's I was getting from this game would only say
Stop: 0x0 ( I don't remember the exact hex offset, but thats the
only info it gave. No driver listings, no event name ( like
DIVIDE_BY_ZERO  ) ), just Stop.

Now it's not always getting a BSOD, but it is still completely
freezing like a BSOD 100% of the time. I see my desktop but the only
option is hitting the power.

 As far as what pygame thing could be triggering the driver to crash -
 are you making your surfaces with the HWSURFACE flag? Are you using
 OpenGL? If so, try not using either of those, it might turn into a

I'm using the default arguments, I'm not passing any flags to the
surface creation, so its a software surface. I am not using any
OpenGL.

 segfault or a normal error. Are you playing music or sounds? Turn that
 off and test. Also, it's possible pygame stuff is only triggering

I'm not using any sounds in the game I wrote. It did crash once with
winamp playing, so after that I quit winamp on the next reboot, and it
still crashes. ( Sometimes creating sounds at the crash )

 things by being a busy and active game. If the problem is heat or bad
 memory related, desktop use may never trigger it.

Because of the 'nice cpu boolean' It uses almost nothing, like 2% CPU
usage. I don't think it can be heat since this was from a fresh start,
after it had been off for hours. ( While it has no problem playing
full 3D accelerated games )

 Do other games give a Blue Screen?

No. I sometimes get crashes in other games, but they crash to desktop,
nothing is broken. I can re-run the game and everythings fine.

That's the confusing part, libSDL with c++ works, much higher hardware
accelerated games work, but a simple blit isn't working, and a full
system crash at that.

Thanks ( to everyone ) for the help

-- 
Jake


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

2007-11-12 Thread claxo
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

On 12 Nov 2007 at 14:02, Jake b wrote:

 The source is at: http://www.newmech.com/pics/ZombieHunt_v0.2-BSOD.zip
 
 
  If you want more feedback, post more code ( from the non numeric
  version, to keep it easy)
  Cheers
 
  claxo
 



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

2007-11-10 Thread claxo


On 10 Nov 2007 at 15:30, Jake b wrote:

 I've started on a very basic game, right now all it does is blit 
 tiles to the screen. I used a NumPy tutorial to create a 2D array to 
 store tileID's for rendering. But running it, caused my computer to 
 get a Blue Screen Of Death.
 
 The code was x = ones( ( 3, 4 ) )
 
 I was surprised because I was running my game in windowed mode, if I 
 called blit() witih an invalid value, or accessed an array out of 
 bounds, I thought it would at worst crash to desktop. I have also 
 tried the game Snowballz, ( it uses PyGame ) So my first guess was 
 that it was NumPy that did it.
 
 I removed NumPy, creating my own basic 2D array class that seems to 
 be working correctly stand-alone. I started to place it into my tile 
 code, and I got the BSOD again. Now I know it's not NumPy. The wierd 
 thing is even when it crashes, it seems to render the tileset at 
 least once. Sometimes it had been running for a few seconds ( at 60 
 renders per second ), but once it was the very first render that 
 crashed.

A BSOD is strange.
Checking basics:
Are you sure your alternative code has loaded ? I mean, if you run 
from the cmd prompt, by example
c:\python24\python.exe myprog.py
all modules are reloaded, but if you are runing from inside an IDE 
maybe you need to restart the IDE.

Make sure the dir and files have standart attribs, ie no ReadOnly , 
no Hide, etc. I remember a time when editing in IDE and running  from 
command line ,when IDLE writes the sources but the interpreter keeps 
loading the prev compiled module. Really weird. No warning messages. 
Just in case try deleting the .pyc before run the alternate (non 
Numpy) code.

If you want more feedback, post more code ( from the non numeric 
version, to keep it easy)
Cheers

claxo


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

2007-11-10 Thread Brian Fisher
On Nov 10, 2007 1:30 PM, Jake b [EMAIL PROTECTED] wrote:
 for rendering. But running it, caused my computer to get a Blue Screen Of
 Death.

Blue Screen of Death on Windows XP means an error in kernel mode,
always, no exception. No pygame or python module ships a driver or
kernel mode component that I'm aware of. What this means is that the
only way running a particular python + pygame project could cause a
blue screen is by it making a call that makes a driver go do
something, and it's the driver that crashes. For a game, this almost
always means the video card driver - some other options would be sound
card driver, virus protection program, bad memory, network driver.
It's almost definitely video card, but if you look at the blue screen
before rebooting, you can often find the name of the driver that is
faulting and then be sure about which component it is (look for
drivername.sys near the top after The problem seems to be caused by
the following file or on the very last line after a few asterixes)

As far as what pygame thing could be triggering the driver to crash -
are you making your surfaces with the HWSURFACE flag? Are you using
OpenGL? If so, try not using either of those, it might turn into a
segfault or a normal error. Are you playing music or sounds? Turn that
off and test. Also, it's possible pygame stuff is only triggering
things by being a busy and active game. If the problem is heat or bad
memory related, desktop use may never trigger it. Do other games give
a Blue Screen?