Now that we've got Ludum Dare out of the way, back to chess! Last time, we defined all of the pieces, which is all well and good, but what we really need is a board. More specifically, we want something that can:
- Represent an 8x8 chess board, storing the location of pieces (including the owner of each)
- Add logic for collisions, so that when moving a piece, you cannot move through others or capture allies
- Add rendering code to display the current chess board (must be flexible enough to handle arbitrary glyphs for fairy chess pieces)
I think that's about enough for the moment. Let's do it!
Quick update this morning: I managed to get a 'demo mode' working. Now when you first start the game, the boxes will be whizzing around in the background giving you an idea of what you're about to get yourself into!
A few hours later and we've already finished (or at least made good progress on) two of the goals that I was hoping for:
- AI players; at the very least one that moves randomly, but optimally several different kinds
- Pending the previous, a selector on the options screen that can turn each player either off, on, or to any of the current AIs
- Stylings around the page; probably some sort of thick border that bleeds a little in and out, looking different per player
Here we are, 24 hours into the competition.
A lot of the last few hours has been spent doing a fair amount of restructing. Before, I had a single 'thread' for each of the tiles, along with another thread listening for user input. Unfortunately though, that lead to all sorts of race conditions. Specifically, whenever two tiles overlapped, it was often the case that one was doing the falling step (which copies from one internal buffer to another) while the other was in the swap step (which copies from tile to another). Then after the first finished, it would copy the second buffer over... overwriting anything that had been swapped.