Using External Data on Blender Game Engine

What I tried is that, instead of receiving the inputs from keyboard or mouse, I took a test to receive external data from another application that has a different process from Blender, and I tried to display the motion produced by the received data in real time on BGE.

This video shows how it works and how to use the source files if you download and try.

http://2.bp.blogspot.com/_d4nbesSwQqc/SNzYrRhaD5I/AAAAAAAAAp0/Rcl3HzJEIUI/s400/vid.jpg

It was done with Bullet in Blender 2.47 and it would only work on Windows. Also you need .NET Framework 2.0 or later to run the external application that sends the data to Blender.

Please visit my homepage for more details.

Amazing!
Funny how “simple” it was to use external data, using a program to write a txt and then making blender read it!

The only question I got is if the txt file is being edited, how does blender read the edition? since it should only be able to read a saved file. Or the program is all the time both reading and saving the file?

Yeah, all the time, the external software saves the file 15 times a second, and Blender reads it about 15 times a second, which depends on your pc. Both software access the file over and over with setting access flag to lock the file. It prevents the software from reading the file that is being saved.

I see, the theory is nice and easy to understand, I guess that even with limited knowledge on C anyone could do a simple command line based aplication working together with blender.
The flag to lock the file is the only “advanced” thing that I’m missing though. It is coded on the program that writes the txt right?

I guess that even with limited knowledge on C anyone could do a simple command line based aplication working together with blender.

Exactly:yes: Usually they use shared memory, kind of a pipe, socket, message queue or something for IPC, but all of them are difficult to use.

It is coded on the program that writes the txt right?

Yes. C#

Nice program.

The only suggestion that I have is if you want faster file access, you should set the txt file to have “temporary” attributes. That way, the computer doesn’t need to reload the file into memory every single time you load/save it. Just remember to return the attributes to “normal” after the program is done.

Awesome. Well done. Simple, yet amazing.

C-106 Delta:

you should set the txt file to have “temporary” attributes

Oh, what a good suggestion, I didn’t know about it, thanks. I absolutely going to use your idea the next.

B3D00:
:smiley: