Skip to content

ItsBMHere/chess2-canvas

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

About


2022-06-24_23-17-18.mp4

chess2-canvas is an in-progress board editor for David Sirlin's Chess 2: The Sequel and built using the Bevy game engine. It can be used to show off board positions, or play correspondence games (although no rules are implemented).

Usage


At current time of writing (June 24th 2022), all commands are handled via the keyboard. This utility is at a very early stage - the bare minimum functionality is all there, but there's lots of developments to look foward to.

For now, here are the keyboard commands - if you have ever used Lichess' board editor then this should feel somewhat familiar:

  • 1: 'Selection' mode - drag pieces around by left-clicking and holding; let go to drop them on a new square. You can highlight any square on the board in this mode by right-clicking it, but these will disappear as soon as you left-click.
  • 2: Draw King over hovered square
  • 3: Draw Queen
  • 4: Draw Rook
  • 5: Draw Bishop
  • 6: Draw Knight
  • 7: Draw Pawn
  • 0: Delete piece over hovered square.
  • Spacebar: Toggle between drawing White and Black pieces.
  • A/D: Cycle through the 6 armies, in the order of: 1) Classic, 2) Nemesis, 3) Empowered, 4) Reaper, 5) Two Kings, 6) Animals. I won't explain what all these new pieces do - the rulebook does a perfectly good job of introducing them.
  • Ctrl + S: Save a screenshot of the board configuration to the project directory.

Problem Decomposition


  • Draw an 8x8 grid of black and white squares.
  • Draw the midline, between ranks 4 and 5.
  • Draw notation for files (a-h) and ranks (1-8)
  • Write logic to fill up window with board
  • Write current board state to FEN2 string
  • Flip Board - pieces, and notation
  • Save board as PNG (Windows only atm)
  • 'Hand' mode
    • Highlight Piece square when clicked & held
    • Draw transparent piece on square clicked
    • Draw piece sprite that follows cursor whilst left mouse is held down
    • Draw piece on hovered-over square when left mouse is released
    • Erase transparent piece from previous square when left mouse released
    • Erase highlight from previous square when left mouse released
    • Draw circle on hovered-over square when right mouse pressed (sort of? It's more of a square than a circle...)
    • Draw arrow between right-clicked square and hovered-over square when right mouse pressed, held, & dragged
    • Erase arrows on left mouse press
    • Erase circles on left mouse press
  • 'Pieces' mode
    • Draw Piece on hovered-over square on left mouse press
    • Overwrite piece on hovered-over square on left mouse press with new piece
    • Cycle through different armies with A/D keys
  • 'Trash' mode
    • Erase piece on hovered-over square on left mouse press (OK - this one is a bit tenuous at the moment...)
  • FEN
    • Parse FEN2 to board position
    • Parse Fischerrandom to board position by value (as per the most recent ruleset)