View on GitHub

maschere's blog

data, science, art

UE5 runtime Python interop

30 May 2021

Unreal Engine 5 runtime interop with Python in real-time using TCP sockets


For several planned projects I need reasonably fast, but flexible (cross-platform) two-way communication between UE5 (should work the same for UE 4.26) and an external Python process. Though named-pipes or shared memory might produce a little less overhead, I opted for TCP sockets for their ease of use, platform-independence and flexibility. Particularly if remote communication becomes a requirement down the line.

The video above shows a rudimentary proof-of-concept I got running this afternoon. It uses Unreal’s C++ FSocket class and Python’s socket / socketserver.

Next, I will extend and clean up the code to make the whole thing easy to (re-)use. Maybe I’ll look into compiling into a UE5 plugin. The code will be open-sourced on my Github in any case.

RSS