nescitus / rodent-iv

trying to start a community effort based on Rodent IV
GNU General Public License v3.0
18 stars 16 forks source link

Add UCI option "EngineHome" if basic.ini was not found #19

Open gkalab opened 3 years ago

gkalab commented 3 years ago

Adds the possibility to set the engine home directory via an UCI option. Useful on Android when the personalities and books directories are located in one of the apps private files directory, even if the engine binary itself is located somewhere else (e.g. as an OEX engine). Also file permissions are not needed if the additional files needed by the engine are not in the default directory /sdcard/Rodent4

bcm314 commented 3 years ago

Thank you for participating.

I've got also the same idea in the past ;-) Unfortunately it isn't working.

Rodent needs basic.ini to build the list of personalities to tell it the GUI. So after the GUI sends "EngineHome" to the engine, it must reread all uci-options, which is not possible in uci specification.

by the way: you can use "Chess Engines OEX" from Karl Schreiner. You need to run (!!!) it, so additional files are coppied to the right place. Not yet all files, but heavily working on it.

gkalab commented 3 years ago

True, the list of personalities cannot work this way. This PR is for enabling a GUI to load a specific personality via the PersonalityFile option. Of course the GUI then itself needs to know about personalities. That would be fine by me.

So the GUI would need to set the EngineHome option first and then could set the PersonalityFile option: setoption name EngineHome value ... setoption name PersonalityFile value ...

This works in my app and I've tested it in Arena: there you need to configure the engine twice because Arena does not know that it needs to set the EngineHome option first.

I've seen the Chess Engines OEX package which is really nice. I see two issues here though:

gkalab commented 3 years ago

One other thought I had to solve this was to use an environment variable, which is currently not used on Android in rodent-iv source: GetEnv("RODENT4HOME") This would be simpler for rodent-iv and it would mean full support of personalities via the UCI options.

The OEX interface would need to get extended so the GUI would know to set a specific env variable for the engine home directory. In the future it could even copy the required resources itself if the OEX engine interface provides them.

What do you think?

Edit: I've just tested it and setting the environment variable within the Android app works well, with full support for personalities via UCI options.

Extending the OEX interface is a bit more ambitious though :-)