Running a Node.js app in UE5

First, really? You need to run node.js to get some simulation parameters?
How about reading them from a file?
How about connecting to a web service and reading them out as a JSON object or something?

Second, if you really do need to run a second kind of thing, I highly recommend you spawn it as a second process, and give it a port number to listen on as argument, and make it listen on 127.0.0.1:that-port, and then connect to that port from the Unreal game. Then use web requests to read the values you need, and control that app. Pick an uncommon port number, like 28656, for the port-to-use.

Don’t bind to 0.0.0.0 or ANY_HOST – this would open your user’s computer up to possible access from the rest of the network, plus it would needlessly request a firewall exception. Binding to localhost (and connecting to localhost) makes sure that the processes really only talk to each other.

Third: No, really, there has to be a better way than chaining a node-webkit-react application to your Unreal Engine game. You’re probably better off re-thinking this requirement.

2 Likes