Entities need IDs for serving translations (even English is pulled in through the TranslationServer) and judging comparisons.

structure

translation key

Translation IDs are 6-or-8-character strings. I like to use letters and follow a pattern, so random words can bubble up through the babble.

TL keys are 6 characters (favoring letters), and "de" is prefixed for their description. The first 2 letters indicate the category, while the last 4 indicate the individual. The last four are kind of freeform, usually the first 2 letters of each word of the English display name. If it's only one word, then it's its first 4 letters. If it's too short, "a" is suffixed for padding. If that pattern would recreate an existing code, I smudge which significant name characters are taken. If "a" is already used, I use "b," "c," all the way to 9.

ID category prefixes:

base ID

Base IDs apply to a few other things, but it's virtually only for entities. They identify a specific type of entity, not a particular instance of that entity. They are 6-character hexadecimal strings (favoring numbers). I like that they correspond to color hex codes, so I can find out everyone's secret color. Generally, a category's earliest and most representative entities are the purest in hue.

The first three digits represent categorization, while the last increment by one for each member within that group. Commons start at 000 and increment numerically, while elites and bosses start at aaa and increment alphabetically.

ref ID

Every entity with the base.gd script has a ref ID that is an integer between 0 and ∞. It identifies a specific instance of an entity.

structure

translation key

Every entity has an exported String name_key variable, and its desc_key can be derived from it by prefixing it with "de."

Every entity also has the get_display_name and write_name methods (same thing), plus write_desc. Use these to get the name and desc.

base ID

Every entity has an exported Color base_id variable. It also has a reference to the player_base_id and perk base ids.

Get the base_id with get_base_id() (as Color) and get_base_id_in_hex() (in a String).

To determine if the entity is the player, call get_is_player(). To determine if the entity is a perk, call get_is_perk().

ref ID

The MessageBus assigns them sequentially as integers starting at 0 during the _ready stage of each entity. The earlier the ref ID, the older the entity.