Getting data into the BGE.

What is the best method for getting data from an external application into the BGE? Right now, I have a server-client thing going, and it works pretty well. But I don’t like the overhead and time it takes to create and destroy sockets. It runs well on my Core 2 Quad, but if I go much less, the framerate drops fairly fast. There has to be a more direct method. Does anyone have any ideas?

You could try and use a memory mapped file,
Check the last reply of the following threat:

I’ve done write and reading files as an alternative, but it suffers a similar problem of overhead and lag. I’m interested in what you said about giving the memorymap a tagname. I can’t find much info on what tagnames are. Where you able to freely exchange data with Blender without using files, sockets, etc?

I think a could, but I am not 100% sure anymore
I will have to dig into my old files; due to a compleet computer burnout I will have to get data from the harddrive of this burned machine first and this takes time.
If you have some patience I will look after this.

Anyway, the tagname is the name for windows to use for the memory block.
When you use memorymaped files you don’t read/write to a disk; In fackt you just use a part
of the computermemory to write to and read from. This proces is very quick.

Give me a few days to search


Sounds good. I’ll look into this myself.

Hey Jimmux,

I just found a little non-Blender program (written in Pascal eg Delphi) that opens a memmoryblock,
this block will have a name so other programs can get access to this memoryblock too.
I changed it a bit to suite my needs.
Then I tried a simple script in Blender using the mmap.mmap(…) procedure to read the content of
the memoryblock.
And . . . . . Yes this worked.
So it is possible to send data from the outside world to your BlendeGE-world.

Then I tried to let Phyton make a memmoryblock and tried to acces it with a little non python
program (again Delphi), but this did not work (yet).

Got interessted?
Just tell me and I will post these programs on my webspace (I am out of time now)

Greetings to you


Don’t know if I’ve missed the point entirely here, but I used ctypes in python to get information from another application into blender.

This example is getting input from the Velleman USB board.

from ctypes import *

D1 = windll.K8055D.ReadDigitalChannel(1)

Where K8055D is the name of the dll and ReadDigitalChannel is one of its auguments.