Hello,
I’m developping an Android application with Unity3d.
It has many functions (it’s a chatbot) and I’m currently mostly working on the chess game part which is working pretty well, but I’m stucked around 1200-1300 ELO with 6 plys so I wanted to implement stockfish instead of my own engine.
So my problem is not any more about chess engine itself but how to use stockfish engine on Android. Note that stockfish is working fine in Unity3d editor, it’s really about sending command to stockfish file, receiving answers and basically just beeing able to put the file in the right directory while beeing on Android.
public void Communicate()
{
string intro_android_path = Application.persistentDataPath + "/stockfish-android-armv8.so";
string filePath = "";
#if UNITY_EDITOR
filepath = "C:\\Harumi 3d\\StockFish\\stockfishx86";
#elif UNITY_ANDROID
filepath = intro_android_path;
#endif
// creating the process and communicating with the engine
mProcess = new Process();
ProcessStartInfo si = new ProcessStartInfo()
{
FileName = filepath,
UseShellExecute = false,
CreateNoWindow = true,
RedirectStandardError = true,
RedirectStandardInput = true,
RedirectStandardOutput = true
};
mProcess.StartInfo = si;
mProcess.OutputDataReceived += new DataReceivedEventHandler(MProcess_OutputDataReceived);
mProcess.Start();
mProcess.BeginErrorReadLine();
mProcess.BeginOutputReadLine();
SendLine("go infinite searchmoves e2e4 d2d4");
}
So everything works fine in Unity3d, but when I compile as an apk and launch it on smartphone, nothing happens, I don’t even see the log. What could possibly went wrong?