Rewriting LaserChess in the Godot Engine


Download link a the bottom of this post

About 8 years ago now, I created a computer version of the board game Khet, an Egyptian-themed, chess-like game involving mirrors and lasers. I changed it to a space theme and gave it the creative title of LaserChess.

I wrote LaserChess in the now ancient SDL 1.2 and targeted the GPH Caanoo open source handheld. SDL has sinced moved on, and this made trying to recompile it on a modern Linux installation a bit of pain. So I took this as a fun excuse to dive a little bit into the Godot Engine. Godot is an open source 2D/3D game engine and editor.

With Godot's editor and scripting language, it was pretty easy to get a quick prototype of the basic gameplay functionality up and running. Implementing the game's logic in GDScript was also surprisingly easy. LaserChess being a turn-based board game with strict rules certainly helped make things a bit simpler. Most of my time was actually spent on the user experience, trying to make buttons and menus look fancy (I hope somewhat successfully).

LaserChess also features an AI opponent, built from scratch in C, using well established techniques from chess AI engines. Godot has a feature that it calls GDNative which allows you to compile C code for integration into a Godot application. So using GDNative, I was able to re-use my old AI code to include in the Godot version of LaserChess. Despite the AI missing many optimizations, it still poses quite a challenge and I have yet to beat it on higher difficulties.

In the end, I was really impressed at what Godot was able to do with relative ease. Getting a functional prototype running was so quick I can see it being a great tool to evaluate gameplay ideas without having to start something from scratch. GDNative is also a pretty attractive feature by letting you interface with so much other code; you're not restricted to staying within Godot's scripting language.

If you're interested in the game itself, give it a try on Windows or Linux.


Tags: