Game Development Community

Interprocess communication with Torque 3D

by Ian Omroth Hardingham · in Torque 3D Professional · 07/06/2009 (10:57 am) · 1 replies

Hey guys. This is kind of a follow-up post to my previous, about MFC, but it looks like that isn't going to work so I'm going to go with something else.

Basically, I have a stand-alone process (spawned from a separate dll) which needs to communicate with Torque 3D. I've looked up interprocess communication on Wikipedia and I'm wondering if you guys have any recomendations for which method would be best, given the following parameters.

- this is windows only
- calls to Torque 3D might involve creating an object in the sim, or playing a sound effect - standard console calls really
- calls from Torque 3D to my process might involve sending a memory location
- speed is a fair priority here

I'm really a pretty big windows-programming noob; any help would be really appreciated.

Thanks,
Ian

#1
07/07/2009 (5:42 pm)

The simplest thing here would probably be using pipes. Simple bytestreams between the processes; sort of like unbounded files with fixed consumer/producer setups. Don't know how well the scheduler handles the process switching and response to waits, but I guess it should perform pretty decently with good response times (to the system, having threads within a single process blocking and unblocking should be no different then having processes do this).

Note that sending memory locations around in inter-process communication usually isn't very useful as memory is private to a process except if explicitly shared. The only use for that would be if the location is solely used for getting back to the originating process with it (given that it still is a valid address). Otherwise use some id-based handle scheme.

Given your description above, the easiest thing would be to add some code to Torque to spawn a thread that is reading from the pipe and turning all the input it reads into SimConsoleEvents. This way, you can just send arbitrary script code from your application.