Dimensional Draughts Documentation

(Sept. 2014, published May 2016, revised Jan. 2022) 🅭🅯🄎 4.0 Daniel Woodworth

Dimensional Draughts is a three-dimensional generalization of checkers: the rules are nearly the same, but there is an extra axis of movement and the “board” is a stack of normal checkerboards. The original version was built at a hackathon; this version is updated with better comments and some compatibility fixes, but still most of the same extremely hacky logic.

How to Play

The board is rendered as a graph: the squares (nodes) are spaces on the board and the edges are valid connections between them. Nodes with a player piece on them are colored red or blue depending on which player owns the piece and nodes with no player are colored gray. There are two phases to each turn:

  1. Selecting a piece to move. The currently selected piece blinks more brightly and out of sync with the others and can be changed by clicking near a different piece with the mouse or by using the WASDQE keys. The mouse controls are almost always a better choice since the keyboard ones aren't very intuitive. Enter confirms the selection and advances to the second phase.
  2. Selecting a space to move the piece to. The selection process and controls are the same as in the first phase. Esc cancels the second phase and returns to the first.

As in normal checkers, enemy pieces can be captured by jumping over them to blank spaces and an arbitrary number of pieces can be captured by a piece in a turn. Capturing isn't mandatory in this version of the game and a sequence of captures can be stopped short with Esc. Also as in normal checkers, when pieces reach the far plane they will be “kinged” and can move in all twelve directions.

Since many mobile devices don't come with keyboards, the web version also includes Confirm and Cancel buttons, which simulate pressing the Enter and Esc keys respectively.

How to Win

I'm not actually much of a checkers expert, so I haven't worked out any good strategies for this game. I think strategies from normal 2D checkers would still apply. In any case, a full game would take a very long time given how many pieces there are, so I don't have anything coded to happen if someone actually finishes a game.

Dependencies

Besides a working C++11(+) compiler and OpenGL (3.3 or higher) for rendering, this game uses:

Building and Running

The whole game is in one giant hacky source file, ddraughts.cpp. To run it, just install the dependencies listed above, download ddraughts.cpp, and compile as shown in Listing 1:

$ g++ -std=c++11 -O3 `pkg-config --cflags glm glut glew` ddraughts.cpp `pkg-config --libs glm glut glew` -o ddraughts
$ ./ddraughts
Listing 1: How to compile and run Dimensional Draughts.

With the magic of Emscripten, it's also possible to compile Dimensional Draughts for web browsers (as seen on this site) by running the command in Listing 2:

$ emcc -s ENVIRONMENT=web -s INCOMING_MODULE_JS_API='[canvas]' -s EXPORTED_RUNTIME_METHODS='[setCanvasSize,GLUT]' -s MODULARIZE -s EXPORT_ES6 -s NO_DYNAMIC_EXECUTION -s EMIT_EMSCRIPTEN_LICENSE -s NO_FILESYSTEM -Os -I /usr/include/glm/ ddraughts.cpp -o ddraughts.js
Listing 2: How to compile Dimensional Draughts for web browsers with Emscripten.