Running standalone NodeJS app from within Unity game, or alternatives - c#

Is it possible to run a local NodeJS server from within a unity build?
I do know that we can use the "pkg" NodeJS package to build standalone executables that can run without NodeJS installed on the machine. However it is a separate executable. It is required that there exists only one executable that is the game itself.
Other than this, I found it mentioned on a sketchy Quora answer that it is possible to make a JavaScript plugin (.jslib) for Unity that imports node.JS so Unity doesn't compile it. All communications would have to go through a wrapper using extern calls with interop services, like any other native code plugin. However the technical details were not mentioned.
It is also possible, that for the limited purpose of my work, that I rewrite the Node packages which I require in C#. This I think would be very lengthy and might face a wall at some point.
Please point me in the feasible directions
I have tried with a separate NodeJS application and the Unity game communicates with this local server. However I require the Unity game to have a single executable and without needing to install nodejs separately.

Related

Is there a way to have some kind of installer built into a C # application itself?

Is there a way to have some kind of installer built into a C # application itself? So that the installer is as small as possible so that the rest of the app is downloaded in the app itself?
My goal is when I publish my C # app that the user has a normal installer that is as small as it can be. And the rest of the app is downloaded in the app itself.
Sure. Most modern software comes with an in-app updater. What you can do is, ship your App with just the updater component. Call the updater on first start and tell the user that the update is required.
Best achieved by a pre-compiled binary that does not require external frameworks to run. (E.g. select .NET target version of the lowest Update/OS you want to support).

Unity3d Android/Windows app integration with a library

I have a Windows application built using unity3d. The same source code is also used to build an android app. And for this app to access a remote database, I created a Restful service available as a .dll
My question is, is there a way my unity3d based android app use this .dll? I read about ELF32 formats. Not sure how to generate one.
I have the source code for the .dll and ideally I would like a common library to be used/called by both my windows/android app. But am not sure about a common format. Any ideas ?

Is there a cross-platform way of getting the java path in .net core?

Currently I am working on a .net core console app with a embedded jar. There is no such thing as a java console app, right? So I would want to run my jar file inside my console app. I know the .net process API but I don't know if there is an environment variable telling me the java runtime location so that I can execute it.
Registry keys are not cross-platform, please don't give answers using some Windows-only solutions, please.
You can get environment variables in a cross platform way using .NET Core
Console.WriteLine("JAVA_HOME: " + Environment.GetEnvironmentVariable("JAVA_HOME"));
As everyone is pointing out, making a cross platform 'runner' is a bad idea in that its difficult to maintain.
JAVA_HOME isn't created by default upon install, and it will be a flaky interface, but you could make it work.

How to run c# app having dll files on linux

My c# apps developed on windows run nicely on ubuntu, but the ones having dll files don't. Is there a work around or i have to recompile the code on linux
Interop.SpeechLib.dll is part of Microsoft's Speech API (SAPI).
That doesn't exist on Linux, so you'll have to find an alternative API to call there.
You won't necessarily have to maintain two separate code bases, though. You could execute a run-time check for the host platform/environment, and call the appropriate API for that environment.

.NET Service to Linux Daemon

I am writing a portable service/daemon using .NET 3.5, my windows service is running, but I was wondering about the mono port...
Mono-service is what I am looking for if I understand correctly. How exactly does this work though? I assume I need mono compatible code throughout my service, right? For example, I am using SQLite. Is it correct that in order to use this with mono I should refactor my code to use mono namespaces etc, such as Mono.Data.SQLite? May I still use Settings.settings?
Also, I've read that daemons don't implement onStart/Stop methods, so do I need to change my code to run under mono/linux? i.e. is it ok to have these methods in my code, and ok to run ServiceBase.Run()? Does Mono-service accommodate these?
You should create your programs from the beginning for use with Windows and Linux.
You need Visual Studio with Mono Tools or the free MonoDevelop-IDE to create a Mono-Application. MonoDevelop can import your Visual Studio Project. This IDE helps you to get the right namespaces.
Use Mono-Service to run your Assembly as daemon. Linux Daemons are using Signals to communicate with the System. Please read the documentation.
We already had a similar question, so please read this to see, how to process Unix-Signals.

Categories

Resources