Chess-Challenge icon indicating copy to clipboard operation
Chess-Challenge copied to clipboard

Split UI and engine logic

Open eduherminio opened this issue 2 years ago • 2 comments

First of all, doing this now might would be a breaking change, so this might be disregarded short-term but brought back once the challenge is over, but: Please consider splitting engine and ui logic in two different projects.

That could bring multiple benefits:

  • You could create a nuget package out of the engine part and you would have a chess-engine programming framework for everyone to use without having to use the whole project.
  • People could create cross platform and UCI compliant engines using that nuget package without having to include raylib dependency (and its limitations/size) and all the UI part.
  • AOT compilation: When doing AOT compilation of the previously mentioned potential engine, executable bundle size is cut by half. If you do it now (creating a separated console project to support UCI that references Chess-Challenge and publishing with AOT enabled), the final binary still works but the result of the publish command is a bit of a mess due to all the UI files, raylib.dll, Chess-Challenge executable, etc and, as stated, the size of the executable we're interested on is twice the one we'd get having the UI and engine logic split into 2 separated projects.
  • Even if the nuget package isn't created yet, it gets easier for people that customize their UI runner to merge back any framework changes by spotting where the conflict is: keeping their changes in the UI project and getting yours in the engine one.

I've done the code split part myself in this branch (more specifically, in this commit), and it's pretty much straight-forward to do thanks to your existing design/architecture.

eduherminio avatar Jul 27 '23 09:07 eduherminio

So, I started working on this myself before I read this issue.

I'm strongly considering making a fork of this and publishing it myself, but I really don't want to do that if @SebLague intends to do so; I wouldn't be in violation of his license, but I'd feel scummy.

I'm also working on a UCI package, which I intend to publish as a separate nuget package, but it would potentially depend upon the work Sebastian put in. It doesn't have to, but I'd have some weird "Hey, you need this interface, and you'd have to wire that up to whatever implementation you want." situation going on.

b4ux1t3 avatar Dec 22 '23 05:12 b4ux1t3

Fo reference, and with the notion that I intend to clean it up a LOT more: https://gitlab.com/b4ux1t3/uci-bot/-/tree/main/ChessEngine

b4ux1t3 avatar Dec 22 '23 17:12 b4ux1t3