Python questions: publishing; sound actuators

  1. We use some functions from the math module. When publishing a game executable, the game won’t run on a system where Python is not installed.

This problem does not occur when we do not use the math functions. Of course we do not want users to install Python to run our game - what is the best way to tackle this problem? [Maybe I am overlooking something stupid?]

  1. Sometimes our sound actuators won’t work when activated from a script. A particular actuator will only play its sound every so often. When connected directly to a keyboard sensor and AND controller, they work every time. Any ideas?


I don’t know the answer for your math problem. My only suggestion would be to find the SDL.dll or Python24.dll (whichever one has the math in it) from the full Python install, and try to see what’s different about it that Blender doesn’t have (Blender’s is a little stripped down, I think). Maybe you could combine the two to make a better .dll for running your game. (I may be being stupid here. I don’t even completely understand how .dll’s work.)

As for the sound, I’ve experienced the opposite problem as what you are describing. When I have used logic bricks (keyboard --> AND --> sound) I have had sporadic performance. If you are only publishing to a windows runtime, then I suggest using ST150’s Pygame package to run your sound (at blending-online). In my experience, it works every time. If you plan to release runtimes for any other OS, pygame would prove impractical (since players would need to install Python 2.4 and Pygame to their PC’s to hear sound.)

The few functions we use I will replace with our own, so it’s not a big problem.

As for the sound, have you tested pygame with Blender 2.42? It makes my Blender crash… In any case, we’d like to keep the game as platform indepent as possible.

Thanks for the suggestions.

Pygame 1.71 full install works fine with 2.42 RC3 on my PC running from the .blend file. I don’t know about ST150’s Pygame package for distributing with games. It’s from an older Pygame version (uses Python 2.3), so maybe something in it is deprecated? Also, I haven’t tried a runtime with it yet. Are you having the problem in both .blend and runtime, or just in the runtime? I’ve been thinking about trying to update the Pygame package, since the new mixer includes support for more filetypes. Maybe I’ll put it on my list of things to do in the near future.

(BTW, here’s my PC setup that runs Pygame fine: Win98SE with Python 2.4 fully installed and PYTHONPATH set in the system files. Also, Pygame 1.71 is installed to the Python24 directory. To run music “in blend” I open the blend file directly, not from Blender with File>>Open.)

Hmmm, I will check it out, maybe it was because I was using an early preview version of Blender.