I am trying to make this app run in UE5 to later use websockets or blueprints to get information to use for game mechanics. So far, I have been able to successfully run it on Windows.
Now, I tried using this plugin to be able to run a Node.js script in UE5 but as soon as I use it, UE5 crashes, no errors.
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.
Thank you for your kind feedback!
I am more of a game designer than a backend programmer, so all this info is invaluable to me.
I am trying to make this EEG device work with Unreal and I am throwing stuff at the wall to see what sticks.
I mean, gotta do something while the Neurosity devs cook up native support for Unreal, right?
I would still be very grateful for all your tips on this matter!
It’s pretty likely that your EEG device doesn’t natively speak HTML/CSS.
Maybe you can figure out what their webapp is doing for communicating, and then do the same thing from your game instead?
That might end up being simpler.
Fascinated by these new interfaces and kudos for thinking big. I have been experimenting with socket.io for different purposes but I think it does run a node server, not a big perf impact so far. I’m interested to learn more about this so just wanted to throw a comment in here. I would tend to agree with @jwatte but all I can find in their API is JS stuff so IDK. I wish this device was cheaper. I want one now! lol
Luckily, web stuff is pretty easy to reverse engineer with a bit of Wireshark.
You’re quite correct, the Neurosity Crown does not natively speak HTML/CSS… kinda. You can try using the BrainFlow plugin but I have had some issues with that as well.
And you were right, the Web App is a bit too much of a hassle, so the device developer suggested I try with something smaller. So, I used Node.js plugin to run this example. It worked:
Now I’ll reverse engineer the functionality of the Node web app I wanted to run directly in Unreal… and see if I can pull this off in UE5 as well.
Quick update: I was able to upgrade to UE5!
A question about this thread was asked of me in direct message. I don’t do code consulting in direct messages, but I’m happy to answer questions in the public thread where others can also benefit from the answer. The question was approximately “how would I really go about integrating Unreal and Node.js”
- If the data is actually static, then run the webapp as part of your build, request the data you need with curl, and bake the data files into your Unreal executable.
- If the servers can run separate from the client, then run the servers on Amazon or Heroku or your own server or somesuch, register DNS to get to the service, and make a HTTP request from the Unreal client to the service.
- If the Node code must run on the same client machine as the Unreal client, then ship the Node executable as a bundled executable, make it respond to some custom port (like 28282 or whatever) and when the client starts up, check whether something is already responding on that port; if not, call the OS to start the Node server that you bundled. When the client needs the data, make a HTTP request to this port, posting the parameters, and reading the data back.
Trying to integrate the node.js code base into the Unreal code base sounds like it is going to be extremely painful, and be very hard to maintain going forward. I highly recommend using one of the other methods I suggest above.
Thanks a bunch for the info!
Honestly, the jargon surpassed my limited programming skills by a lot, but I have forwarded your advice to the Neurosity developers who may be able to make use of this info to create a proper SDK for their EEG device to interface with Unreal… eventually.
And, yes, I found integrating the Node.js code to be extremely painful and unsustainable. The neurogame template I made only works in one machine and I don’t know why. So, I just gave up on the project altogether. I am now trying my luck with Unity and a third-party SDK. It is not game dev friendly either… X-D
ive been messing around with a node js server, putting it in docker containers, kubernetes, linux server security, and all this time i could have just packages it up as an executable with the game and not worried so much or need to host it. Didnt even know it could do that.
Thanks for this info!