Delphi FMX Chess Game

This is a simple cross-platform implementation of a chess game I wrote in Delphi/FMX, supporting player vs player, and player vs a very weak computer engine. I took about three weeks to build, as I had just rediscovered Delphi after 10 years, and needed to pickup the language again, and the new FMX framework. Thankfully FMX is very intuitive for developers familiar with VCL.

It was really an exercise to give Delphi a bit of a push to determine if it was suitable for cross platform development. I must say, I really enjoyed the experience.

FMX is component based, it was so simple to add inner glow effects like you can see on the highlighted knight piece (b8) and the movement options (a6, c6, d7):

Another component was used for the outer glow effect on the active player piece:

Having just returned to Delphi, I used a familiar approach. I created two custom components to represent a chess square and a chess piece. In hindsight, I would now just use frames. TFrame is really the basic building block of modern FMX UIs. Combined with layouts, and component composition, you have so much flexibility.

If Embarcadero invests heavily in FMX it could become the best cross-platform framework by far.

bluebelt

14 thoughts on “Delphi FMX Chess Game

    1. Hi Angelo, thanks for your comment. I’m in the middle of rewriting it, the database which the AI depends upon grew to 4GB. Splitting it into client/server, and targeting mobile. Will post an update here soon with access to the new code base.

      Like

  1. Bonjour, j’ai une représentation 3D d’un jeu d’échec en FMX Berlin si vous le souhaitez nous pouvons fusionner les sources.
    Hello, I have a 3D representation of a chess game in FMX Berlin if you wish we can merge sources.
    Alain Weber -Paris France

    Liked by 1 person

    1. Hi Alain, thank you for your comment and kind proposal to work together. I’m too busy at the moment with my job, and I’m also half-way through moving my Chess Application to client/server (I want to test FMX on mobile, and I’m learning the Delphi way of doing things – devouring Nick Hodges books atm). But perhaps in a few of months we could discuss? In the meantime, I would be very interested to see what you have done. Do you have a screenshot you can link to? I’m quite new to FMX and appreciate seeing what people are doing with it.

      Like

    1. Thanks Paulo,

      I wrote it as fast as possible, the AI isn’t that smart atm.

      After I saw the Delphi BootCamp videos I wanted to take FMX for a test-drive, so I built this game.

      I enjoyed the exercise so much, I’ve decided to use FMX for a mobile game I have in mind.

      Right now, I’m busy trying to catch up with the community – best practices, idioms, Spring4D etc.

      Absolutely love programming in Delphi.

      Like

  2. wow, it is so hard to find a Delphi Chess engine! i need some for Android to create a chess game for my almost blinded grandfather

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s