36% DNW! Aaah!

Bottom half of the table. I am crushed :-)

I should be happy though, because the main reason I do pyweek is to test and debug my game graphics library. So I suppose I have some work to do...

The other comments about camera position and steering were, sadly, completely fair :-(

(log in to comment)

Comments

Added a fixed version of vortex racers, so those who couldn't run it during judging might now be able to dislike it on its own merits. :)
  • Patched the crash bug in texturefont.py,
  • widened the camera angles,
  • added alternative steering and braking keys to avoid finger cramp,
  • documented the secret 'auto-steering key', so you can experience life as a very stupid AI-driven vehicle.
Still crashes on me :( (Ubuntu Feisty, amd64 python 2.5 (though 2.4 doesn't work either) )

$ python run_game.py
Traceback (most recent call last):
File "run_game.py", line 15, in
main.main()
File "/home/bjorn/Desktop/pyweek/vracers-1.0/lib/main.py", line 54, in main
choice = gamescreens.run_title_screen()
File "/home/bjorn/Desktop/pyweek/vracers-1.0/lib/gamescreens.py", line 829, in run_title_screen
t = TitleScreen()
File "/home/bjorn/Desktop/pyweek/vracers-1.0/lib/gamescreens.py", line 158, in __init__
skyball=sky.SkyBall('sky')
File "/home/bjorn/Desktop/pyweek/vracers-1.0/lib/sky.py", line 23, in __init__
super(SkyBall,self).__init__(name,**kwd)
File "/home/bjorn/Desktop/pyweek/vracers-1.0/lib/tdlib/backdrop.py", line 45, in __init__
super(TextureBackdrop,self).__init__(name,**kwd)
File "/home/bjorn/Desktop/pyweek/vracers-1.0/lib/tdlib/backdrop.py", line 26, in __init__
self.restyle()
File "/home/bjorn/Desktop/pyweek/vracers-1.0/lib/tdlib/part.py", line 78, in restyle
self.prepare()
File "/home/bjorn/Desktop/pyweek/vracers-1.0/lib/sky.py", line 31, in prepare
self.tex = texture.get_texture(filepath(texname))
File "/home/bjorn/Desktop/pyweek/vracers-1.0/lib/tdlib/texture.py", line 62, in get_texture
tex = Texture(filename)
File "/home/bjorn/Desktop/pyweek/vracers-1.0/lib/tdlib/texture.py", line 45, in __init__
img_data)
OpenGL.GLU.GLUerror: [Errno 100901] invalid value

bjorn, I need to fix that for sure. The call is:
gluBuild2DMipmaps(GL.GL_TEXTURE_2D, GL.GL_RGBA8, width, height, GL.GL_RGBA, GL.GL_UNSIGNED_BYTE, img_data)
The error is 'invalid value'. So one of the parameters is maybe not valid for your version of OpenGL? But I can't tell which without knowing more.

Try replacing GL.GL_RGBA8 in the second parameter with just 4.

Is it possible the texture image is not loading correctly? The spec says Invalid Value is the error for width or height being less than 1. Maybe add:

assert width >= 1 and height >=1
on the line before, and see if the assert fails before the GLU call.

Oh, and if you know which version of OpenGL and GLU you have, that would help too.

Thanks

I'm not sure, but I know when I build textures/mipmaps, that error gets thrown when I have a texture with a width/height that is not a power of 2, ie(256, 1024, etc.)

I don't know if that is my graphics card(I have an older - 5years - laptop, which is kinda funky ;) ) or what, but I know this happens.

The workaround I used is to use pygame to scale the image to a power of 2 before sending it to Opengl, basically you have a function like this:
def get_correct_dimensions(image):
    oldx, oldy=image.get_size()
    newx=newy=2
    while newx <= oldx:
        newx*=2
    while newy <= oldy:
        newy*=2
    return newx, newy
I'm still not sure if that is correct, but it sounds like the same problem, so I thought I'd let you know :)
All the textures in the game are 2^n x 2^m, most are 64x64. However, maybe the problem is textures (like the sky or the Start signpost) that are larger. I don't know what the usual limit is on graphics cards these days, but OpenGL only requires that implementations cope with 64x64. Older graphics cards may have severe limitations I've grown used to ignoring :(

(bjorn: I'm not suggesting your graphics card is crap, it's probably something else. But if you're still mildly interested in playing the game, you could try with the --snow option, which disables most textures entirely, or try replacing the larger textures with scaled-down versions).

Other than that, I'm out of ideas until I can replicate the problem somehow.

The texture it crashes with is data/stormy.jpg which is 128x128 (according to the width and height); I don't think it's a problem with the texture. AFAICT my opengl version is:
python-opengl 2.0.1.09.dfsg.1-0.3
libgl1-mesa-glx 6.5.2-3


using the --snow option didn't help. I've got a bit of time this evening so I'll look into it a little; unfortunately I'm not experienced w/ opengl.
OK thanks, bjorn. The dev version is up on sourceforge svn. You can get it with
svn co https://tdelusion.svn.sourceforge.net/svnroot/tdelusion/trunk tdelusion
The game is in vracers (the graphics library is in tdgl; there should be a symlink from vracers/lib/tdgl there if I've done it properly)

In case it's a texture size thing, I've scaled some of the textures down a bit, but the title banner image is still quite large, (and that's shown even with --snow on).

I think I'm going to have to catch errors, print a warning, and carry on with a null texture in cases where it goes wrong inexplicably like that. :(

Ok, so I grabbed the dev version but it's still crashing. One thing I notice is, if I run it with python2.4 the window opens and it doesn't crash, but I can't see anything. With 2.5 (the default on my system) it dies here:
File "/home/bjorn/source/tdelusion/vracers/lib/tdgl/texture.py", line 45, in __init__ img_data)
OpenGL.GLU.GLUerror: [Errno 100901] invalid value

with either version, if I run it with --snow it crashes here:
bjorn@berserker:~/source/tdelusion/vracers$ python2.4 run_game.py --snow
Traceback (most recent call last):
File "run_game.py", line 14, in ?
main.main()
File "/home/bjorn/source/tdelusion/vracers/lib/main.py", line 47, in main
materials.NOTEXTURES = True

not sure if that sheds any insight, or how to debug this further. Seems likely there may be a bug in the 64 bit python opengl stuff on my system though.
it does run in my 32bit chroot though. . . I don't know why I didn't think to try that before :p.
Bleh - I re-named the "materials" module "material" when I moved it into tdgl, and obviously forgot to change "materials.NOTEXTURES" to "material.NOTEXTURES" for the --snow option.

Anyway, hope the game compensates you for all your effort with a few minutes of fun at least.