Log In  


Cart #tetrachess_ver4-0 | 2021-04-05 | Code ▽ | Embed ▽ | No License
16

Is it Tetris, or maybe chess? Kind of both, but actually neither. Nonetheless, this is a game about strategy and sacrifice, borrowing notes from both Tetris and chess.

Tetrachess is a puzzle game in which your goal is to capture the AI opponent's chess pieces using your own chess pieces, following chess rules. However, the board is not like in chess at all. You have to drop Tetris blocks (tetriminos) containing the opposing chess pieces to the playfield. After you have dropped a tetrimino, it's time to move your chess pieces. You can capture the opposing chess pieces, earning you points, or you can eat the garbage blocks, cleaning up the playfield. After your own turn, the opponent moves their own chess pieces, potentially capturing yours.

Capturing the opposing pieces is required for getting points, but in this game it's also important to keep the playfield clean, in order to not reach the top. This is because there are two conditions for a defeat: if the Tetris blocks reach the top of the playfield, or if your king gets captured.

Controls:

In Tetris phase:

  • Left/right: move the piece left/right
  • Cross/Circle (X/Z): rotate the piece clockwise/counter clockwise
  • Up: Hard drop
  • Down: Soft drop

In chess phase:

  • Left/right/up/down: move the reticle
  • X: choose the chess piece to be moved and after moving it to the target, press again to move the piece

Tips:

  • Two of the bottom rows are safe. This means that you can't destroy them with Tetris moves. Be careful, as on the other rows you can even destroy your own chess pieces!
  • Like in chess, you can promote your pawns into a more valuable chess pieces (knight, bishop, rook, king, queen) if you get them high enough on the board. In this game, you can even have multiple kings on the playfield (could be useful just in case your previous king dies, I guess).
  • You can clear a line by filling the last spot with a chess move. Completely empty rows will be deleted and everything on top of it will be dropped down.
  • T-spins also work. However, note that doing fancy Tetris moves or clearing lines of garbage blocks will not give you points. Only captured or destroyed chess pieces give you points.
  • Points given are: 1 (pawn), 2 (knight), 3 (rook, bishop), 4 (king, queen)

Feedback will be highly appreciated!


Updates:
(2.4.2021) Made a very quick fix (hopefully) fixing a crash
(5.4.2021) Reversed the rotation buttons and added a small delay before enemy movement

16


This is fascinating! I definitely missed the transition from chess to tetris every single time, so I was very bad at dropping pieces usefully, but it's a fascinating and cool concept.


Agree that the chess-to-tetris transition is the hardest part.

Unlike tetris there isn't the time pressure of blocks arriving successively and you can (try to remember to!) plan ahead for what to do with the next tetromino before executing your chess move. But there's still a lot happening in a short time:

  • observe expected effects of your chess move
  • watch the AI chess move, process what happened
  • quickly switch focus to the arriving tetromino
    • AI has a tendency to foil your plans for clearing lines, need to have a backup plan, or else adapt quickly

I feel like I got a little better at it with some practice, but it's a real challenge. Would appreciate if the enemy chess move animation is slower so it's easier to see and understand what's going on.

Speaking of which, one time I had the AI clear a line for me by suiciding a piece into the last blank spot. Happened too fast to fully comprehend, but shouldn't the AI try to avoid doing something like that? Have not delved into the enemy AI but intuitively it's priorities should be: killing the player, preserving its pieces, and making inconvenient holes amidst the tetris rubble.

Or maybe that was the only legal move available to the AI. Would be cool to get bonus points for engineering enemy forced suicide if that's the case.

Somewhat related: since stalemate is not a thing, perhaps points can be awarded if the enemy is left with no legal moves on its turn, e.g. left with only pawns that can neither advance nor capture. (But not if it has no pieces left, which can be easily accomplished in the early game.)

\> Cross/Circle (X/Z): rotate the piece clockwise/counter clockwise

Seems reversed? I ended up using X/C as it seemed more natural.


Ok, so I made a quick update based on the feedback. I reversed the rotation buttons and also included a small delay before enemy movement (it's only 20 frames, so not too long). This should make the transition between chess and Tetris phase a bit easier to handle.

@cakepie Yes, the AI in this game isn't too smart, although it is quite aggressive in a sense. Basically the AI loops over all enemy pieces and tries to do something. If a piece can capture something, it will, but this might also be a garbage block. Only if the piece can't capture anything, it will move to an empty spot. If there are no legal moves for a piece, the AI will move on to the next available piece.

So yes, the AI could definitely use some work. If this was just a chess game, the AI would be horrible. However, I don't think a game like this necessarily needs a super smart chess AI. The game is quite challenging already, I think.


There are still some features I would like to add. A check warning would be nice and would eliminate some accidental game overs. Also it would be nice to see all of the available chess moves after you've selected a chess piece. I might need to refactor some of my code to save some tokens first, but improving the AI a bit is something I would like to do as well.


Thanks for the updates!

\> AI ... isn't too smart
\> [doesn't] need a super smart chess AI

I agree that the game is hard enough as it is.
But I shouldn't be able to leave my king in check for several turns while the AI chooses to make other moves instead. XD

\> check warning

Definitely please do this. The same code will also help solve the above AI reluctance to kill the king, and prevent illegal moves putting yourself in check (which is also currently possible). So it would kill many birds with one stone.

\> see all of the available chess moves

This could also be used for stalemate detection. Currently there is a corner case where the game will softlock if you find yourself in chess phase with none of your pieces can be moved.

\> save some tokens

At a quick glance, just call reset_game instead of duplicated code in _init, and remove a bunch of unnecessary variable initializations (top of tab 0, before _init). That frees up 160 tokens with very little effort, for a start.


@cakepie Good suggestions! And yeah, I know it's technically possible to softlock the game if there aren't any legal moves for you. Never happened to me during testing, but it's there :D

It's true there are some unnecessary initializations that could save a few tokens, but refactoring my AI code could probably save hundreds of tokens. I'll see what I can do, but I'm sure there is room for these new features eventually.



[Please log in to post a comment]