Where to? Top > Physics Simulation > Using External Data on BGE
Video | Source Files | BlenderArtists
This page last modified: 2011/02/13
The 3D work finished: 2008/09/03

Using External Data on Blender Game Engine

Displaying external data in real time on BGE (video) [Zoom]

When you want to show someone kind of a motion in real time on a PC display, then we have the powerful real time engine, Blender Game Engine (BGE).

What I tried is that, instead of receiving the inputs from keyboard or mouse, I took a test to receive external data from another software 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.

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 software that sends the data to Blender.

The setup to call the python code (source files) [Zoom]

How to Transfer the Data

The external software creates a file and writes the data that you want to send to Blender each time the data is updated. On Bledner side, one of Controller in Logic panel is setup to call the python code that opens the file and reads the data each time.

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.

Using a file for the communication between the two software seems to be a very low-level way to transfer data, but I have come up with no idea but this.

Transfer Performance

It appears that using a file for the communication slows down the transfer speed, but actually it doesn't so much. The two software reads and writes the small size of the data in the same part of the file frequently, so the part has been cached on the memory and it becomes to transfer as fast as memory. At least in this case, it works well.

Using a file for the communication between the two software [Zoom]

In What Situation is It Useful?

I created this test to use in the laboratory room in real world. The room has an equipment for some experiment, and it can move with motors for demonstration. However, ordinary people will never understand what the equipment represents and what the motion means when they come and take a glance in kind of a study tour.

So it will make the demonstration understandable to show them how it will be used in our life with a CG movie, that is BGE, moving objects in the CG in the same way as the equipment does. In order to synchronize the CG with the equipment, real time rendering system with reading external data is needed, and BGE is the best to do such kind of things.

Copyright (C) 2006 - 2019 Hans.P.G. All Rights Reserved. Hans.P.G. | Contact
inserted by FC2 system