User Tools

Site Tools


dev:arch_handbook_overview

Crossfire Archetype & Treasure System: Handbook Overview

This page is a navigational summary of the Crossfire Archetype & Treasure System: Developer Handbook. Each section below describes what the corresponding handbook section covers and what you will find there.


Section 1 — Asset Overview

Lists every file type in the arch repository, what consolidated file it packs into at build time, and its role in the engine. Covers .arc, .trs, .face, .png, image_info, .artifact, .formulae, and .quests.


Section 2 — PNG Image Files

Explains the three-part filename convention (objectname.faceset.frame.png), how the three-digit frame code encodes direction and animation index, and the two shipped facesets (base and clsc) and their fallback relationship.

  • 2.1 Naming convention — frame code breakdown (XYZ digits)
  • 2.2 Facesetsbase vs clsc, fallback rules, adding variants

Section 3 — Face Files (.face)

Covers the two things a .face file can contain: static face declarations (face … magicmap … end) and animation sequence blocks (animation … mina). Includes the facings keyword for 1, 2, and 4-direction sprites.

  • 3.1 Simple face entry — fields: face, magicmap, end
  • 3.2 Animation block — fields: animation, facings, frame list, mina

Section 4 — Archetype Files (.arc)

The core reference for authoring .arc files. Covers the full set of fields organised by category, plus structural features such as embedded inventory, multi-tile parts, and compound animations.

  • 4.1 Basic structureObject … end syntax
  • 4.2 Common fields — grouped into: identity, visuals, physical stats, combat stats, ability stats, movement, equipment body slots, weapon fields, treasure/linking, and message/dialog blocks
  • 4.3 Embedded inventory — inline arch … end sub-objects (spells in potions, event connectors, pre-filled containers)
  • 4.4 Multi-tile objectsMore keyword, head/part chain, x/y offsets
  • 4.5 Compound animationsanim_suffix field and how the engine applies temporary animation overlays during combat, spellcasting, and skill use
  • 4.6 Object type IDs — reference table of all type constants (PLAYER=1 through LIGHTABLE=163)
  • 4.7 Material bitmask values — M_PAPER through M_SPECIAL, combining values for composite materials
  • 4.8 Attack type bitmasks — AT_PHYSICAL through AT_DISEASE, and the matching resist_xxx field names
  • 4.9 Temporary archetypes — auto-created for customised map objects; not authored directly

Section 5 — Treasure List Files (.trs)

The format reference for .trs files. Explains the difference between treasure (all items rolled independently) and treasureone (only one item chosen), all entry-level fields, and the yes/no/more/end branching structure.

  • 5.1 Linking an archetype to a treasure list — the randomitems field in .arc files
  • 5.2 Treasure file format reference — fields: arch, list, artifact, chance, nrof, magic, list_magic_value, list_magic_adjustment, change_name, change_title, change_slaying; branching: yes, no, more, end; generation rules including difficulty gating and the 100-attempt limit

Section 6 — treasures.trs Annotated Walkthrough

Ten annotated real examples drawn from treasures.trs, showing how the format features work in practice.

  • 6.1 Skill injection liststreasure (not treasureone) used to guarantee all skill objects are given
  • 6.2 Random knowledge (scroll) list — weighted treasureone for skill scrolls with rarer skills at lower weight
  • 6.3 Weapon and armour selection — top-level lists that delegate to slot sub-lists
  • 6.4 Mushroom foraging pattern — deep no fallback chain as a rarity ladder
  • 6.5 Coin and wealth lists — same archetype repeated with different nrof to distribute stack sizes
  • 6.6 Artifact injection with magic difficultylist NONE and magic field gating; artifact keyword usage
  • 6.7 yes/no branching: bow + arrowsyes guarantees arrows when a bow is generated; no cascades through weapon fallbacks
  • 6.8 Standard monster treasure setspoor, standard, rich and the humanoidpockets lists
  • 6.9 Named character class listself, warrior, mage etc., showing cross-file list reuse
  • 6.10 Restoration potionstreasureone with artifact field forcing a specific named potion

Section 7 — Common Patterns and Tips

Practical guidance for day-to-day arch work: naming uniqueness, face reference format, adding new objects without registration, global vs local treasure list scope, the NONE no-op list, difficulty gating with magic and list_magic_adjustment, and attaching Python scripts via event connectors.


Section 8 — Case Study: Dissecting ''treasureone random_armour''

An end-to-end worked example tracing a single treasureone list through all its sub-lists. Explains what chance actually means in a treasureone context (relative weight, not percent) with a ticket-draw analogy.

  • 8.1 The block in full — full verbatim quote of random_armour
  • 8.2 How chance works — total weight = 158, real probabilities calculated for all six entries
  • 8.3 Line-by-line explanation — every keyword and field in context
  • 8.4 Sub-lists expandedrandom_gauntlet, random_helmet, random_mail, random_shield, random_boots each broken down with their own probability tables and magic-threshold notes
  • 8.5 Combined probability formula — multiplying stage probabilities; worked examples for gauntlets (~1.4 %) and plate_mail (~3.1 %)

Section 9 — ''treasureone'' Probability Tables — Full Reference

A complete probability table for all 35 treasureone lists defined in treasures.trs. Each entry shows: item or sub-list name, magic difficulty requirement, nrof, raw chance weight, and calculated probability percentage.

  • 9.1 random_knowledge — 31 skill scrolls; scroll_missile_weap and scroll_praying share the top weight (6.1 % each); scroll_throwing is the rarest at 0.4 %
  • 9.2 needle_diseases — 9 diseases; 7 share equal weight (13.3 %); athlete's foot and tooth decay are notably rarer (3.3 % each)
  • 9.3 random_weapon — two-entry list; melee is twice as likely as missile (66.7 % vs 33.3 %)
  • 9.4 random_armour — body armour most likely (32.9 %); see §8 for full breakdown
  • 9.5 random_special — wand leads at 13.9 %; scroll_new appears three times at different nrof values to spread stack quantity
  • 9.6 random_coin — 14 equal-weight entries (7.1 % each) spreading gold, silver, and platinum across stack sizes
  • 9.7 random_wealth — 24 equal-weight entries (4.2 % each); extends random_coin with gems
  • 9.8 random_gem — 6 main gems in two-entry pairs for quantity spread; topaz and bloodstone rarer at chance 3 vs 5
  • 9.9 starting_wealth — three equal entries; one-in-three chance for each coin type
  • 9.10 random_plantflowers_permanent most likely (19.7 %); random_mushroom locked behind magic ≥ 15
  • 9.11 random_alchemy — plain cauldron dominates (18.6 %); fix_mercury rarest at 1.0 %
  • 9.12 random_potion — self-referential; random_potion references itself at four escalating thresholds (10, 12, 12, 14)
  • 9.13 special_uncommonbracers_ac and lockpicks lead at 10.3 %; mithril_chainmail and ring_spell at 1.0 % each; list NONE deliberately produces nothing 5.2 % of the time
  • 9.14 containers — sacks and bags dominate (22.7 % each); scroll cases and throwing quivers rarest (4.5 %)
  • 9.15 missile_weapons — arrows and bolts dominate (34.0 % each); rare bow variants (hunter's, long, composite) at 1.0 % each
  • 9.16 throw_weapons — spears lead (31.8 %), daggers close behind (27.3 %)
  • 9.17 melee_weapons — largest list (43 entries, total weight 209); 39 weapons share 2.4 % each; magnifier and rare_weapons at 0.5 %
  • 9.18 rare_weaponsbrdaxe1 leads (27.8 %); dhaxe2 requires magic ≥ 6, the highest weapon gate in the game
  • 9.19 uncommon_weapons — cultural weapons; scythe and sickle rarer (4.8 %) than the rest (11.9 %)
  • 9.20 uncommon_artifacts — 18 entries at 5.1 %, 3 dragon mails at 3.0 %; amulet entry forces the lifesaving artifact via keyword
  • 9.21 random_magicalrestoration_potions leads (24.5 %); scroll_new (×9) second (21.0 %); ring_spell nearly impossible (0.7 %)
  • 9.22 rare_artifactslist NONE holds 20 % of the weight; each of the 16 actual artifacts is exactly 5.0 %
  • 9.23 random_scroll — five scroll_new entries with inverse nrof/weight relationship; 11 improvement scrolls each at 0.5 %
  • 9.24 random_wands — wand dominates (72.0 %); rod_heavy and ring_spell each under 1 %
  • 9.25 random_books — cleric books most common (23.5 %); four arcane schools equal at 17.6 % each
  • 9.26 random_read — clamped books and scrolls share the lead (28.3 % each)
  • 9.27 random_stone — field stone most common (31.3 %); gold nuggets rarest (6.3 %)
  • 9.28 random_inorganic — top-level category picker; stones lead (38.8 %), ore very rare (2.9 %)
  • 9.29 random_minerals — salt most abundant (21.4 %); gold nuggets rarest (2.9 %)
  • 9.30 random_spells — four entries; scroll_new (×3) nearly half the weight (42.9 %)
  • 9.31 random_talisman — rings dominate (50.0 %), amulets second (37.5 %)
  • 9.32 random_artifact — two entries; uncommon twice as likely as rare (66.7 % vs 33.3 %)
  • 9.33 random_ore — rubble most common (24.8 %); platinum ore rarest live item (0.5 %)
  • 9.34 uncommon_itemslist NONE holds 37.1 %, intentionally suppressing drop frequency; ring_spell rarest live outcome (1.6 %)
  • 9.35 restoration_potions — minor potions most common (42.9 %); major and full share the lowest weight (14.3 % each)

dev/arch_handbook_overview.txt · Last modified: by leaf

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki