Skip to content

How towers are defined

Dmitry Degtyarev edited this page May 19, 2024 · 1 revision

Introduction

This page explains how towers are defined in youtd2.

Tower id

Each tower is assigned a unique id.

Tower properties

All towers have properties. Properties are values which are stored in a CSV file called tower_properties.csv and loaded when the game runs.

When you add a new line to the tower CSV, the game will attempt to load that tower. It will fail until you define all of the other required files.

Tower script

Tower scripts are known as tower behaviors. Tower behaviors implement abilities, spells and other effects. They also define the tooltip text.

Only one script is created per tower family because scripts for towers of same family essentially do the same thing but with different values for each tier. This means that one script can be defined, avoiding code duplication.

Tower sprite

Tower sprites define what the tower looks like. It is simply a picture which will be attached to the tower node.

Note that tower sprites need to include some adjustments on top of the original image:

  • Position of the sprite, to center it
  • Scale of the sprite, to adjust in game size and sometimes to reuse same image for different tiers.

Tower tooltips (saved)

Tower tooltips are created by the tower script and cached in a csv. There's a config option to run the tooltip generator.

Tower ranges (saved)

Same thing as tower tooltips, but with a different generator.