Skip to content

Data-Driven Pieces #854

@Naviary2

Description

@Naviary2

Currently, information about each piece and how they work are sprawled out across the codebase- typeutil, movesets, pieceThemes, specialdetect, specialmoves. Bringing all data about a single piece into one location would make them both easier to manage, and add new pieces. Take inspiration from how variants are data-driven within variant.ts. Since each piece needs considerably more data than a single variant, let's give each piece its own dedicated file, with one management file for storing the Type Definitions, and reading data from the piece entries.

Each piece needs to store (with their existing info location in parenthesis):

  • Moves: individual, sliding, blocking function, ignore function, special detect function, special vicinity. (movesets.ts, specialdetect.ts)
  • Special move function (specialmove.ts)
  • 2 letter icn code (icnconverter.ts)
  • svg location on the server, and color overrides (pieceThemes.ts)
  • whether it is a royal
  • whether it can castle with royals
  • whether when moved it resets the 50 move rule.
  • In addition, for pieces with a specific vector of travel, such as pawns, their movement must be 90-degree rotatable, to prepare for 4 Player games.

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions