Python's functions in exported runtimes?


(PaKr) #1

I have one question:
Can I use Python modules ( random or so ) in exported runtimes.
I created scene with Python controller, the script uses random module. In Blender’s environment it works 8) , but when I export runtime (static), it does not work :frowning: . I use Python 2.2


(lizard809) #2

if you just want a random float use GameLogic.getRandomFloat()


(PaKr) #3

But is it possible to use Python modules (not built in Blender) in runtimes?


(saluk) #4

If you use a dynamic runtime, then I think you can; a non-dynamic runtime does not support external python.

I could be wrong though.


(guru202) #5

You are correct, Saluk.

The Dynamic runtime is used mainly to allow the use of external resources (png, jpeg, mp3, wav, txt, python, etc.) as long as they can be read by Blender. Since the resources are not packed (i.e static), they can be dynamically opened and saved.

For example, you can command the game engine to make changes to a UV texture and save it while the player is enjoying the game and totally unaware of the UV activity.

Lastly, make sure that you set your directory paths correctly. Otherwise, your resources will not be found by Blender.