Skip to content

How the Chessboard works

DuncanSzabaga edited this page Nov 21, 2025 · 1 revision

Board / Board Color System – Scalable Theme Setup

This document explains how the current board/tiles system is structured, and how to extend it in a scalable way so you can sell / unlock additional board colors (themes) via a store.


1. Overview

Image

The system is built around three main pieces:

  1. aBoard (controller object)

    • Responsible for creating all the tile instances once.
    • Stores basic configuration like tile size, scaling, and origin.
    • Uses global.initializeBoard as a flag to decide when to build the board.
  2. BoardPiece (tile object)

    • Represents a single board square (tile).
    • Many instances of this object exist, one per square (e.g. 8×8 = 64 tiles).
    • Each instance stores:
      • is_light → whether the tile is a light or dark square.
      • sprite_index → which sprite to display, based on the selected theme.
      • exported variable:
          1. pos → chess coordinate like "e4".
          1. contain → for future implementation.
Image
  1. boardColorMap (In ./Scripts)
    • Given is_light (true/false) and using global.boardColor, returns the correct sprite.
    • Acts as the single place where theme → sprites is defined.
    • This is where you plug in new themes.
    • Also need to add it to global.AllboardColors in DefaultSettings object.

See how to add a new theme here: How to add a new theme

(This separation lets the board be created once, and then “repainted” by changing the sprites, without recreating instances.)

Clone this wiki locally