Chess Game
This is a project for a Computer Graphics course at University of Siegen.
We were asked to write a game from scratch, without an engine or conventional 3D modelling. All of our assets had to be generated at runtime. So this meant just whipping up a model in Blender was unfortunately out of the question.
We came up with this concept of extruding profiles along a rotation. Which is pretty much how chess pieces are made in real life. A piece of wood is being rotated on a lathe, and a profile is carved out. This illustrates that process quite well:
To figure out profiles, we drew the outlines of a chess piece and figured out some coordinates for Bézier curves which we could then render into line segments to get the profile along chess pieces.
Those profiles along with their normals are then rotated step by step to create the rotational extrusion for the entire piece. Which of course only works for the most basic pieces. But by combining these patterns of profiles and extrusion, we generate geometry at runtime not only for all pieces, but also the clock with its feet and buttons, and faces, as well as the table this game of chess is played on.
You can validate that real quick by playing with these resolution sliders. The vertical one controls the number of line segments per profile, and the horizontal one controls the number of rotational steps. Dropping both to really low numbers doesn’t leave much geometry at all. Dialing them up to max yields very smooth geometry:
Another type of curves we used are Catmull-Rom splines. These are a bit easier to control programmatically, and we used them extensively for animations. All of the piece animations, the clock buttons, and the camera are driven like this.
We unfortunately didn’t get to implement a proper opponent. Which means you get to have a really easy opponent; they will choose random legal moves every turn. You can turn this “AI” opponent off with this checkbox:
Other than that, you can click any piece you’d like to move once to see available moves, and clicking a field or a piece on that will lock that move in. You can rotate the camera by clicking and dragging, and zoom by scrolling.
All moves are logged on a stack and can be undone one by one using the undo button. The play button starts playback of a demo game between Kasparov and Topalov