Hi all,
I’m currently developing a game in MonoGame. The game’s AI is provided by a 3rd party, open source executable binary that is written in C++ (let’s call it 3rdParty.exe). I’ve been developing the application on a Windows machine. The process for communicating with the program in Windows is easy. I have simply been spinning up a new process (launching the .exe) and then writing to the program’s stdin and reading from its stdout. Example below:
using System.Diagnostics;
...
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.UseShellExecute = false; //required to redirect standard input/output
// redirects stdin and stdout
startInfo.RedirectStandardOutput = true;
startInfo.RedirectStandardInput = true;
startInfo.RedirectStandardError = true;
startInfo.FileName = "3rdParty.exe"
Process process = new Process();
process.StartInfo = startInfo;
process.Start();
process.StandardInput.WriteLine("<<WRITE SOME COMMAND>>");
However, I’m unsure about how I would do something similar on Android. I know that I can compile the source code of the 3rd party library into a *.so binary using the Android NDK, but how would I go about starting the 3rd party process and writing to the program’s stdin and reading from the program’s stdout in Android? Can someone that has experience using native code in Monogame give me guidance?
Thanks!