Skip to main content

Script Structure Overview

Gothic scripts are divided into two main directories: Content (game content) and System (engine systems). Each has its own set of .src files — special compilation files that define the loading order of scripts.

.src Files — Compilation

.src files are lists of .d (Daedalus) files in the order they should be compiled. The Gothic engine reads them from top to bottom:

FileDirectoryDescription
Gothic.srcContent/Main game content compilation (NPCs, items, dialogs, quests)
Fight.srcContent/Fight tactics (FAI) compilation
Camera.srcSystem/Camera settings
Menu.srcSystem/Game menu definitions
Music.srcSystem/Music instances
ParticleFX.srcSystem/Particle effects
SFX.srcSystem/Sound effects
VisualFX.srcSystem/Visual effects (spells, auras)
danger

The order of entries in Gothic.src is critical! If you reference an instance (e.g., an item in an NPC), it must be defined earlier in the .src file.


Content — Game Content

The Content/ directory contains everything that defines the game world: characters, items, dialogs, AI, magic, and quests. It is compiled by Gothic.src and Fight.src.

Content/
├── Gothic.src ← main compilation file
├── Fight.src ← fight tactics compilation

├── _intern/ ← engine classes and constants
├── AI/ ← artificial intelligence
├── Items/ ← items
├── FAI/ ← fight tactics
├── Story/ ← story, NPCs, dialogs
├── Cutscene/ ← cutscenes
└── Spine/ ← Spine platform integration

_intern/ — Engine Classes and Constants

Contains engine class declarations and global constants. This is the foundation upon which all other scripts are built.

FileDescription
Classes.dEngine classes: C_NPC, C_Item, C_INFO, C_Mission and others
Constants.dGlobal constants, mission state variables, story variables
Fight.dCombat system constants
info

Files in _intern/ are always at the beginning of Gothic.src — they define the data types used by the rest of the scripts.

AI/ — Artificial Intelligence

Controls the behavior of characters and monsters. Divided into separate subsystems:

AI/
├── AI_Intern/ ← AI core
│ ├── AI_Constants.d ← AI constants (distances, priorities)
│ ├── Externals.d ← engine function declarations
│ ├── Perception.d ← reactions to surroundings
│ ├── Focus.d ← focus settings (what NPCs pay attention to)
│ ├── Species.d ← species definitions
│ └── BodyStates.d ← body states (sitting, lying, fighting)

├── Human/ ← human behavior
│ ├── B_Human/ ← behavior functions (B_ = Behavior)
│ ├── C_Human/ ← condition functions (C_ = Condition)
│ ├── TA_Human/ ← daily routines (TA = Tagesablauf)
│ └── ZS_Human/ ← state machines (ZS = Zustandsautomat)

├── Monster/ ← monster behavior
│ ├── B_Monster/ ← monster behaviors
│ ├── C_Monster/ ← monster conditions
│ ├── RTN_Monster/ ← monster daily routines
│ └── ZS_Monster/ ← monster state machines

├── Magic/ ← magic system
│ ├── Spells/ ← spell definitions
│ └── ZS_Magic/ ← spellcasting states

└── Test_Skripts/ ← test/debug scripts

Naming conventions in AI:

  • B_ (Behavior) — functions that perform actions, e.g., B_Attack, B_Flee
  • C_ (Condition) — functions that check conditions, e.g., C_CanSeeNpc
  • TA_ (Tagesablauf) — NPC daily routines
  • ZS_ (Zustandsautomat) — AI state machines (idle, combat, flee states, etc.)

Items/ — Items

All item definitions in the game. Files grouped by type:

FileDescription
IT_Melee_Weapons.dMelee weapons (swords, axes)
IT_Ranged_Weapons.dRanged weapons (bows, crossbows)
IT_Armor.dArmor
IT_Food.dFood
IT_Potions.dPotions
IT_Plants.dPlants (alchemical ingredients)
IT_Runen.dMagic runes
IT_Scrolls.dSpell scrolls
IT_Ringe.dRings
IT_Amulette.dAmulets
IT_Keys.dKeys
IT_Misc.dMiscellaneous items (gold, torches)
IT_Written.dDocuments, letters, books
MissionItems_*.dMission items (per chapter)

FAI/ — Fight Tactics

Fight AI definitions for different enemy types:

FileDescription
FAI_Human_Normal.dStandard human tactic
FAI_Human_Strong.dStrong opponent
FAI_Human_Master.dCombat master
FAI_Human_Coward.dCoward (flees at low HP)
FAI_Wolf.dWolf
FAI_Orc.dOrc
FAI_Dragon.dDragon
FAI_Troll.dTroll
FAI_Demon.dDemon
tip

Fight tactics are assigned to NPCs through the fight_tactic field in the C_NPC instance.

Story/ — Story

The largest and most important directory. Contains NPCs, dialogs, quests, events, and all story-related scripts:

Story/
├── Startup.d ← World startup functions (NPC spawning)
├── Story_Globals.d ← Global story variables
├── NPC_Globals.d ← Global NPC variables
├── SVM.d ← Standard Voice Messages (NPC shouts)
├── Text.d ← Text constants
├── XP_Constants.d ← Experience constants

├── NPC/ ← NPC definitions (C_NPC instances)
│ ├── PC_Hero.d ← Player character
│ ├── VLK_*.d ← Citizens
│ ├── MIL_*.d ← Militia
│ ├── PAL_*.d ← Paladins
│ ├── SLD_*.d ← Mercenaries
│ ├── BAU_*.d ← Farmers
│ ├── BDT_*.d ← Bandits
│ ├── KDF_*.d ← Fire mages
│ ├── KDW_*.d ← Water mages
│ ├── PIR_*.d ← Pirates
│ ├── NOV_*.d ← Novices
│ ├── DJG_*.d ← Dragon hunters
│ └── Monster/ ← Monster definitions

├── NPC_Scripts/ ← NPC helper functions
│ ├── NPC_Default.d ← Npc_Default prototype
│ ├── B_SetNpcVisual.d ← Setting appearance
│ ├── B_GiveNpcTalents.d ← Assigning talents
│ └── B_SetFightSkills.d ← Setting fight skills

├── Dialoge/ ← Dialogs (~1200+ files)
│ ├── DIA_VLK_*.d ← Citizen dialogs
│ ├── DIA_MIL_*.d ← Militia dialogs
│ ├── DIA_BAU_*.d ← Farmer dialogs
│ └── ... ← (one file per NPC)

├── B_Story/ ← Story functions
│ ├── B_GivePlayerXP.d ← Giving experience
│ ├── B_LogEntry.d ← Quest log entry
│ ├── B_Enter_NewWorld.d ← Entering new world
│ └── B_Kapitelwechsel.d ← Chapter change

├── B_GiveTradeInv/ ← Merchant inventories
│ ├── B_GiveTradeInv.d ← Main function
│ └── B_GiveTradeInv_*.d ← Per merchant

├── B_Content/ ← Content helper functions
├── B_AssignAmbientInfos/ ← Ambient dialogs

├── Dialog_Mobsis/ ← Interactive object dialogs
│ ├── SmithWeapon.d ← Smithing
│ ├── Potion_Alchemy.d ← Alchemy
│ ├── cook_s1.d ← Cooking
│ └── SleepABit.d ← Sleeping in a bed

├── Events/ ← Story events
│ └── EVT_*.d ← Event scripts (battles, cutscenes)

├── G_Functions/ ← Global game functions
│ ├── G_PickLock.d ← Lock picking
│ └── G_CanSteal.d ← Stealing

└── Log_Entries/ ← Quest log
└── LOG_Constants_*.d ← Quest log topic constants

NPC naming conventions (prefixes):

PrefixGuild
PC_Player Character
VLK_Citizen (Volk)
MIL_Militia (Miliz)
PAL_Paladin
SLD_Mercenary (Söldner)
BAU_Farmer (Bauer)
BDT_Bandit
KDF_Fire Mage (Kreisfeuer)
KDW_Water Mage (Kreiswasser)
PIR_Pirate
NOV_Novice (Novize)
DJG_Dragon Hunter (Drachenjäger)

System — Engine Systems

The System/ directory contains engine system definitions: menus, camera, music, sound effects, and visual effects. Each subsystem has its own .src file.

System/
├── Camera.src ← camera compilation
├── Menu.src ← menu compilation
├── Music.src ← music compilation
├── ParticleFX.src ← particle effects compilation
├── SFX.src ← sound effects compilation
├── VisualFX.src ← visual effects compilation

├── _intern/ ← system class declarations
├── Camera/ ← camera settings
├── Menu/ ← menu definitions
├── Music/ ← music instances
├── PFX/ ← particle effects
├── SFX/ ← sound effects
└── VisualFX/ ← visual effects

_intern/ — System Classes

Engine class declarations for individual systems. Analogous to Content/_intern/, but for subsystems:

FileDescription
Camera.dC_CamSys class — camera parameters
Menu.dC_Menu, C_MenuItem classes — menu definitions
Music.dC_MusicTheme class — music themes
ParticleFX.dC_ParticleFX class — particle effects
SFX.dC_SFX class — sound effects
VisualFX.dC_VisualFX class — visual effects

Camera/ — Camera

Camera instances used in the game:

FileDescription
CamInst.dCamera definitions: standard, dialog, combat, cutscene

Definitions for all menu screens:

FileDescription
Menu_Main.dMain menu
Menu_Status.dCharacter screen (stats, equipment)
Menu_Log.dQuest log
Menu_Opt.dGame options
Menu_Opt_Graphics.dGraphics options
Menu_Opt_Audio.dAudio options
Menu_Opt_Controls.dControl options
Menu_Savegame.dSave/load game
Menu_Defines.dShared constants and definitions

Music/ — Music

FileDescription
MusicInst.dMusic theme instances (exploration, combat, threat per location)

PFX/ — Particle Effects

FileDescription
PfxInst.dGeneral effects (fire, smoke, sparks)
PfxInstEngine.dEngine effects
PfxInstMagic.dMagic effects (spells, runes)

SFX/ — Sound Effects

FileDescription
SfxInst.dAmbient, interface, and object sounds
SfxInstSpeech.dSpeech sounds (dialog system configuration)

VisualFX/ — Visual Effects

FileDescription
VisualFxInst.dSpell visual effects, auras, buffs

Summary

AreaDirectoryCompilationDescription
Engine classesContent/_intern/Gothic.srcFoundations — C_NPC, C_Item, C_INFO classes...
AIContent/AI/Gothic.srcBehaviors, perception, AI states
ItemsContent/Items/Gothic.srcWeapons, armor, potions, food
Fight tacticsContent/FAI/Fight.srcFight tactics per enemy type
StoryContent/Story/Gothic.srcNPCs, dialogs, quests, events
CameraSystem/Camera/Camera.srcCamera modes
MenusSystem/Menu/Menu.srcGame menu screens
MusicSystem/Music/Music.srcMusic themes
ParticlesSystem/PFX/ParticleFX.srcParticle effects
SoundSystem/SFX/SFX.srcSound effects
Visual FXSystem/VisualFX/VisualFX.srcSpell and aura effects