Open andrew-wilkes opened 2 years ago
So, now I regained interest in this feature. My idea is to code it in Rust via a GDExtension since Rust is supported for GDExtensions https://github.com/godot-rust/gdext
A quick search for Chess Engines implemented in Rust led me here: https://github.com/pleco-rs/Pleco/tree/main/pleco
So there are various ideas to explore:
At the moment, I am still learning Rust before I can do much to implement these ideas.
So I have a plan:
Implement a GDExtension using Rust that uses the process(delta) function to poll a message that needs to be sent to the Chess Engine, then it waits for a few ms where error signals may be sent, then it sits on a blocked IO read until a line of text is received, and then it outputs this text, and the state goes back to polling the send message text value.
I could not find any way to implement non-blocking IO. The expectation here is that the Chess Engine will always output a response to an input. We can have a delay before we start getting an expected response from stdout. If the Chess Engine does not respond, then our App. will crash (forever locked/unresponsive).
It's better to have a code library such as a .dll file for the interface to a Chess engine and connect to it with GDNative.
Golang bindings are available but the available code is no longer supported (so it should be regarded as deprecated) , yet there is ongoing support for other languages such as D and Nim.
Action: Code a DLL using D lang - my personal preference.
Godot game engine language bindings
Related Docs: Supported Languages
Note: I personally don't want to write C or C++ code since I want to use modern alternatives. But I am happy to have a range of solutions in any language submitted here.