Importing Stockfish AI
This section is for people who own The Coolest Chess Unity Asset Store asset who wish to introduced Stockfish AI into it.
Last updated
This section is for people who own The Coolest Chess Unity Asset Store asset who wish to introduced Stockfish AI into it.
Last updated
Stockfish is a very powerful chess position analytic chess engine, well-known by the chess community. I did make it as a plug and use AI Engine awhile ago on top of The Coolest Chess, it supports up to five major platform including Windows, MacOS, Android, WebGL and iOS
For those who do not own The Coolest Chess Asset Store package, it's reluctant to read this section. The official Stockfish website can be found on the link.
If you did not import Stockfish to this asset during build, remove the StockfishBridge.cs, WebGLTemplates folder and ChessWithStockfish scene asset. And all scripts that causes error after the deletion of the script.
The prepared scene for Stockfish
There is one scene made as a demonstration of using Stockfish with The Coolest Chess package named ChessWithStockfish. In order for this scene to work, Stockfish must be imported from github page.
Instruction on how to import Stockfish to Unity
Go to Windows -> Package Manager. Then select + dropdown button and then select Add package from git URL as shown in the gif above. Copy and paste the Stockfish dependency url https://github.com/githubvickson/sf.git to the input field and click Add button, the dependency will be added to Packages folder automatically. The ChessWithStockfish scene is ready at this stage. However, for WebGL, there are a bit more work to be done.
If things go right, you will see these results.
1) Move WebGLTemplates folder to root folder, it is necessary for when building the index.html containing working Stockfish.
2) Copy files from the dependency installed into StreamingAssets folder
In folder Packages\Multiplatform ChessStockfish AI\jsfiles, copy all of the files inside the folder to Assets\StreamingAssets folder, do it by using copy and paste through Windows File Explorer, dragging into Unity Editor project tab won't work. Look at gif below for visualisation.
3) In order for build to show up the index.html from WebGLTemplates folder,
From Unity Editor Toolbar, select Edit -> Project Settings -> Player -> WebGL settings(the one with html 5 icon) -> Resolution and Presentation -> WebGL Template -> from Default switch to stockfish. Check gif below for visualisation. Everything is done at this stage, Stockfish in WebGL build will work just fine at this point.
Tested Skill And Time Settings (Note that the purpose of skill is to enhance the AI to make moves without blunder while time is to allow it to see through future if the move are the best)