Pygame for Blender 2.49b (Windows)

Hi all,

I was having trouble getting my existing Pygame packages to work with the Blender 2.49 series on Windows, so I installed the latest Pygame for Python 2.6 and grabbed the libraries out of the site-packages folder. I thought I’d share them here to save anyone else the same trouble.

To use this package, just put the “pygame” folder in your main game folder along with the python26.dll and python26.zip files. End users of your game will be able to enjoy Pygame audio in your games without needing to have Python or Pygame installed on their systems.

Here’s the file:
www.blendenzo.com/Files/Pygame1.91-Blender2.49b-Python2.6.zip (3.0 MiB, zip)

Edit: BTW, I am aware that Blender 2.5 will have .ogg and .mp3 support. The purpose of this package is to add support for those media types to Blender 2.49b.

thanks for that

Unfortunately I have this, problem(I posted here before). The sound with 2.49b and Pygame comes after sometime and not instantly…please try to add some sound in 2.49b with pygame on a key and press it…the sound comes after 0.5 sec…do you have this problem too? Try to add the same sound on a key with blender internal sound actuator…everything is fine…but pygame plays sounds with a slowdown in 2.49b,does anyone knows a workaround?

You could make the game predict when a sound
will be played and play it 0.5 second ahead :stuck_out_tongue:

Hi,

I see you included the whole pygame release, I’m not sure how legal it is but I stripped it down as a test and found you only need a few files for it to work. These files are:
-mixer.pyd
-mixer_music.pyd
-SDL_mixer.ddl
-libogg-0.ddl
-libvorbis-0.dll
-libvorbisfile-3.dll
-smpeg.dll

I’m not sure if you can distribute a modified version of pygame but they are the only files (that I encounted) that you need to use the mixer module.

You could make the game predict when a sound
will be played and play it 0.5 second ahead

It’s impossible to predict when the player will decide to walk or stop walking or any other action that is human related.
Can someone try to use Pygame sound and tell me is there the same slowdown as it is on my pc?

@ andrew-101: Pygame is licensed under the LGPL, so distributing only the part of it needed by your project is fine.

I uploaded the whole release for a few reasons. First, I thought that some people might also want to use other parts of Pygame, and second because I hadn’t taken the time to isolate the files needed for sound and music only. Also, I wasn’t sure if removing files would require changes to be made to the init.py file.

Thanks for isolating those files, btw. It will save me in filesize on future game distributions. :smiley:

@ haidme:
I’ll give it a try and see what results I get. I seem to remember you posting about this problem a couple of months ago, but I can’t remember what types of solutions people tried.

My guess is that it is a sound buffer problem, since I found this quote in the Pygame documentation:

To get less laggy sound, use a smaller buffer size… The default size (of the sound buffer) was changed from 1024 to 3072 in pygame 1.8
If you have been using Pygame 1.71 up until Blender 2.49 (which I think most people were doing), then you are probably experiencing problems related to this change. Reducing the buffer size back down to 1024 by explicitly declaring it in mixer.pre_init() may be the solution you are looking for.

Thanks for the suggestion blendenzo, I’ve tried but…nothing happens…when I print get_init() function after setting buffer to 1024 it still returns its old values. I tried to change’em directly in ‘mixer.pyd’…same happens. It seems that there is another script that executes after my pre_init function and overrides my values with the default.