Ge threads

do the GE use threads ?

i mean , can i make the GE use 2 threads of the cpu ? , n00b ? :o

unfortunately no :frowning: i want threads too

Not only threads, but most Object Oriented scripts wont work in the BGE. Someone needs to work on the BGE’s interpretation of python in general, to allow for much more complex scripts and programs.

If it was possible to run 2 instances of the game engine at the same time we could do something like this:
start /AFFINITY 1 blenderplayer.exe
start /AFFINITY 2 blenderplayer.exe
The affinity defines the core to use. For a 4 core processor you have core’s 0,1,2,3.
Do the above in a CMD or BAT file, or make a shortcut with the command in the target.You can use it from a CLI, CMD.exe or custom command prompt terminal.It is also possible from inside the game engine via Python script, so you can have a main menu modual where the player selects which core to use, and then launches the game with the affinity defining command. (start /AFFINITY 1 blenderplayer.exe)
It would be nice to include a CMD file with your game demo’s. The player could edit it to choose which core they prefer to use. If they choose a core that is not in use (usually 2 on 4 core systems) they would see a significant boost in preformance. The blender game engine uses the CPU very much.

I’m guessing that it might be possible using Python scripting? I know Python supports threading so maybe you could create a thread for AI and another thread for culling etc. Big guess in the the dark from me though :wink:

Yes, you can launch threads with Python, but I don’t know how Blender handle’s it. I think I’ll run some tests :smiley:

Threads don’t seem to work quite right. I get no errors, but I can’t get the thread to print to the console :frowning:

I’ve played with python threading in blender before, it doesn’t work. As pointed out, it doesn’t produce any errors, but the thread also doesn’t run. I think it just ignores the code.

I have success using classes, inheritance, encapsulation, even polymorphism is available since python naturally is polymorph.

Is there anything specifically BGE is lacking in this matter?