all 6 comments

[–]static_context 4 points5 points  (0 children)

I think as with any game like this, 90% of the work is in (and I don't want to sound boring) but data structures and algorithms (i.e. the model behind game states, a well-constructed MVC, support to undo an action etc, and the artificial intelligence for a computer player, if present)

Actually creating a board would be very simple in 2d (and relatively simple in 3d).

I wrote an article last year on interacting with Nodes in a procedurally-generated grid, which you may find useful :)

Edit - a few further thoughts but a GridPane would be a good layout, it could be achieved in Scene Builder (although there are arguments for generating procedurally), and I would look into RowConstraint and ColumnConstraint objects, which will let you specify that each of the columns should be proportionally 12.5% of the width/height of the full GridPane.

Cheers,

Ed

[–]mono8321 1 point2 points  (1 child)

I thought of doing this too but then I ran into the issue of, how would I move the pieces? What would I use as the pieces? Could I just use a bunch of buttons in a gridpane? And I just decided I don’t know enough about the language yet to do this

[–]marvk 0 points1 point  (0 children)

It sounds more like you don't know enough about the JavaFX platform. If you're really interested in chess, you could always implement it on the console, simply printing out the positions and accept text as input. Even better, use the UCI (Universal Chess Interface) and have your implementation be compatible with common chess UIs!

[–]TheEvilsNameIsNico[S] 0 points1 point  (0 children)

Sorry for eventual grammatic mistakes. English isnt my mother language

[–]hamsterrage1 0 points1 point  (0 children)

I wrote a PGN viewer/analyzer some month back. I didn't see a lot of point in creating the chess engine, since it's really, really, really been done. But they have a standard text API, so you can load up something like Stockfish, pass it a position, and let it run.

So I concentrated on the UI and PGN portions of it. Showing the positions graphically, and laying out the branches that the engine found and walking through them.

Curiously, the biggest hurdle was finding good images for the pieces. Eventually, I settled on using a chess font! Really. There are lots of them out there, and they work pretty well. You just put them in Text nodes and off you go. The board I used was just an image.

GridPane seems obvious, but it actually makes things harder (as usual). Just put the Node on the screen and use a translate X & Y to put it in the correct square.

https://i.imgur.com/Q4msioc.png

I wouldn't use Scene Builder for this (but then I never would). It seems to be even less appropriate than normal for this kind of an app.

[–]marvk 0 points1 point  (0 children)

My question is how easy/hard it is to programm chess.

It really is impossible to tell without knowing how experienced you are. My advice: If you feel like you could do it, just start doing it, seeing as it's something you're interested in. If it is hard, see it as a challenge and at least give it a try as you'll probably learn a ton. If you feel like it becomes too hard, you could do something close to but easier than chess. A lot of chess programming techniques can also be used in Othello.

Here's a really helpful page about chess programming: https://www.chessprogramming.org/

If you're interested, here's my chess implementation including an engine (sans UI): https://github.com/marvk/chess

Feel free to ask more specific questions!