Open Source with Java or C#

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

kinderchocolate
Posts: 454
Joined: Mon Nov 01, 2010 6:55 am
Full name: Ted Wong

Re: Open Source with Java or C#

Post by kinderchocolate »

Hi,

I just want to share my personal experience.

I'm also writing a chess GUI software. It's designed as a cross-platform, targeted for iPhone, iPad, Android, PCs, Macs and even Linux. I think the best programming language is C++. C# is not really portable, as stated, Mono is not a real substitute. Java is a great programming language, but not as portable as C++.

In my project, platform independent code is written in C++. This ensures any changes would reflect to all platforms. I would compile the code into Java JNI if necessary. This way, I also have native Java support.

Visual chessboards are classified as platform dependent code by me. I had considered QT, it's great but I don't like its visual effects. I'm actually looking for native looks. For example, I want my GUI to look like any other Apple software. I'm seriously considering whether I should build a GUI for Mac and Windows separately.

By the way, you could also build a platform independent GUI by Flash. The Flash compiler could even translate your GUI into native Objective-C. I don't use it because I'm more comfortable with native C++ and Objective-C.
User avatar
OliverUwira
Posts: 170
Joined: Mon Sep 13, 2010 9:57 am
Location: Frankfurt am Main

Re: Open Source with Java or C#

Post by OliverUwira »

Don wrote: If you make a quality GUI for chess it will be a nice alternative to Arena as they do not really seem interesting in any platform other than Windows.
That is my intention, although it is unrealistic to expect even a beta in the short run. I also want to work on my engine and I'm writing my thesis so there's quite some workload (-:

But in one year's time I should have something ready. Actually I am a big fan of tabbed main windows and I want my GUI to go in this direction. So imagine having a tab for board along with scoresheet and analysis output, another tab for the current tournament, and yet another one for a database/game list.

I also want to design it such that other games can easily be incorporated by implementing a plugin.

Another idea is an incorporated parameter tuning framework... *dreaming*
I would expect any high level language to be slow as it takes time to create PGN files correctly - it is like doing a shallow search and not quickly done in high level languages. In tcl I could only do 2 or 3 games scores per second.
I still can't understand why the PGN specification hadn't forced disambiguation even if one of the two pieces is pinned. In my opinion this is an awful design flaw that effectively forces each parser to do a one ply search...
User avatar
OliverUwira
Posts: 170
Joined: Mon Sep 13, 2010 9:57 am
Location: Frankfurt am Main

Re: Open Source with Java or C#

Post by OliverUwira »

kinderchocolate wrote:Hi,

I just want to share my personal experience.

I'm also writing a chess GUI software. It's designed as a cross-platform, targeted for iPhone, iPad, Android, PCs, Macs and even Linux. I think the best programming language is C++. C# is not really portable, as stated, Mono is not a real substitute. Java is a great programming language, but not as portable as C++.

In my project, platform independent code is written in C++. This ensures any changes would reflect to all platforms. I would compile the code into Java JNI if necessary. This way, I also have native Java support.

Visual chessboards are classified as platform dependent code by me. I had considered QT, it's great but I don't like its visual effects. I'm actually looking for native looks. For example, I want my GUI to look like any other Apple software. I'm seriously considering whether I should build a GUI for Mac and Windows separately.

By the way, you could also build a platform independent GUI by Flash. The Flash compiler could even translate your GUI into native Objective-C. I don't use it because I'm more comfortable with native C++ and Objective-C.
I was always under the impression that a C++ GUI is anything but portable unless a widget library like Qt or Gtk is used. Neither produces widgets that look 100% native. I actually like the looks of Qt and the possibility to define UI stuff by means of XML descriptions.

This is something I would like to see in Java. I have a fair share of experience with Swing and what I always found annoying is the need to either use the very clumsy GridBagLayout or nest heaps of container panels just to group UI controls in a way that actually meets the eye.

By the way, in Java, you don't have to stick to the Swing look and feel. It supports plugable look and feels for Mac, Windows and Linux/Unix. At least the Mac and Windows look and feels are very close to native.

It takes five to ten lines of code to check the OS and load the appropriate look and feel :D
User avatar
Don
Posts: 5106
Joined: Tue Apr 29, 2008 4:27 pm

Re: Open Source with Java or C#

Post by Don »

OliverUwira wrote:
Don wrote: If you make a quality GUI for chess it will be a nice alternative to Arena as they do not really seem interesting in any platform other than Windows.
That is my intention, although it is unrealistic to expect even a beta in the short run. I also want to work on my engine and I'm writing my thesis so there's quite some workload (-:

But in one year's time I should have something ready. Actually I am a big fan of tabbed main windows and I want my GUI to go in this direction. So imagine having a tab for board along with scoresheet and analysis output, another tab for the current tournament, and yet another one for a database/game list.

I also want to design it such that other games can easily be incorporated by implementing a plugin.

Another idea is an incorporated parameter tuning framework... *dreaming*
I would expect any high level language to be slow as it takes time to create PGN files correctly - it is like doing a shallow search and not quickly done in high level languages. In tcl I could only do 2 or 3 games scores per second.
I still can't understand why the PGN specification hadn't forced disambiguation even if one of the two pieces is pinned. In my opinion this is an awful design flaw that effectively forces each parser to do a one ply search...
By the way, if you decide to do this in Java I can give you my chess class which has all the stuff you would need to deal with san and legal move generation and game checking. If you don't like it you can throw it out or change it, etc.. I don't know how to write Java code but I put this together for the performance because my tcl version was not satisfactory in speed and my C version was not cross platform.
User avatar
OliverUwira
Posts: 170
Joined: Mon Sep 13, 2010 9:57 am
Location: Frankfurt am Main

Re: Open Source with Java or C#

Post by OliverUwira »

Don wrote:
OliverUwira wrote:
Don wrote: If you make a quality GUI for chess it will be a nice alternative to Arena as they do not really seem interesting in any platform other than Windows.
That is my intention, although it is unrealistic to expect even a beta in the short run. I also want to work on my engine and I'm writing my thesis so there's quite some workload (-:

But in one year's time I should have something ready. Actually I am a big fan of tabbed main windows and I want my GUI to go in this direction. So imagine having a tab for board along with scoresheet and analysis output, another tab for the current tournament, and yet another one for a database/game list.

I also want to design it such that other games can easily be incorporated by implementing a plugin.

Another idea is an incorporated parameter tuning framework... *dreaming*
I would expect any high level language to be slow as it takes time to create PGN files correctly - it is like doing a shallow search and not quickly done in high level languages. In tcl I could only do 2 or 3 games scores per second.
I still can't understand why the PGN specification hadn't forced disambiguation even if one of the two pieces is pinned. In my opinion this is an awful design flaw that effectively forces each parser to do a one ply search...
By the way, if you decide to do this in Java I can give you my chess class which has all the stuff you would need to deal with san and legal move generation and game checking. If you don't like it you can throw it out or change it, etc.. I don't know how to write Java code but I put this together for the performance because my tcl version was not satisfactory in speed and my C version was not cross platform.
That would be a nice contribution (-: I'll write a PM once I get going. It probably won't be before February, though. Kurt's evaluation has second priority at the moment, with my thesis being first 8-)
jwes
Posts: 778
Joined: Sat Jul 01, 2006 7:11 am

Re: Open Source with Java or C#

Post by jwes »

Don wrote:
Dann Corbit wrote:How about a web interface?

TCL/TK is another possibility.
That's what SCID uses.
tcl/tk is great and I'm an expert in it. However, the chess package I wrote for it tends to be slow at producing PGN files. I made no effort to produce fast code but perhaps I should have. There is a small but noticeable delay make a PV output in SAN notation in a chess gui I did in tcl/tk. Even though some UI's including Arena do not do that, I think a good one should, anything less just seems cheesy to me.

One thing I value in a User Interface is snappy responsiveness. It's one of the reasons I like xboard.
Another idea is to write most the code in tcl/tk with small c/c++ routines where speed is needed.
Nettogrof

Re: Open Source with Java or C#

Post by Nettogrof »

There's a nice Java Library ( API ) that I had already use http://ictk.sourceforge.net/

If that could help..
User avatar
Don
Posts: 5106
Joined: Tue Apr 29, 2008 4:27 pm

Re: Open Source with Java or C#

Post by Don »

jwes wrote:
Don wrote:
Dann Corbit wrote:How about a web interface?

TCL/TK is another possibility.
That's what SCID uses.
tcl/tk is great and I'm an expert in it. However, the chess package I wrote for it tends to be slow at producing PGN files. I made no effort to produce fast code but perhaps I should have. There is a small but noticeable delay make a PV output in SAN notation in a chess gui I did in tcl/tk. Even though some UI's including Arena do not do that, I think a good one should, anything less just seems cheesy to me.

One thing I value in a User Interface is snappy responsiveness. It's one of the reasons I like xboard.
Another idea is to write most the code in tcl/tk with small c/c++ routines where speed is needed.
I came real close to doing that, but I abhor mixing languages like this. The primary reason for tcl is easy cross compatibility and I refuse to be reduced to producing packages for each separate platform, which is what was to be avoided in the first place.
User avatar
OliverUwira
Posts: 170
Joined: Mon Sep 13, 2010 9:57 am
Location: Frankfurt am Main

Re: Open Source with Java or C#

Post by OliverUwira »

Nettogrof wrote:There's a nice Java Library ( API ) that I had already use http://ictk.sourceforge.net/

If that could help..
This sounds pretty good as well. :D
Dann Corbit
Posts: 12540
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: Open Source with Java or C#

Post by Dann Corbit »

kinderchocolate wrote:Hi,

I just want to share my personal experience.

I'm also writing a chess GUI software. It's designed as a cross-platform, targeted for iPhone, iPad, Android, PCs, Macs and even Linux. I think the best programming language is C++. C# is not really portable, as stated, Mono is not a real substitute. Java is a great programming language, but not as portable as C++.

In my project, platform independent code is written in C++. This ensures any changes would reflect to all platforms. I would compile the code into Java JNI if necessary. This way, I also have native Java support.

Visual chessboards are classified as platform dependent code by me. I had considered QT, it's great but I don't like its visual effects. I'm actually looking for native looks. For example, I want my GUI to look like any other Apple software. I'm seriously considering whether I should build a GUI for Mac and Windows separately.

By the way, you could also build a platform independent GUI by Flash. The Flash compiler could even translate your GUI into native Objective-C. I don't use it because I'm more comfortable with native C++ and Objective-C.
For a consistent GUI are you using wxWidgets or something else for your C++ code?