.QSC in IGI 2 -- Script Source & DefineMagicObj

1. Architectural Role & Engine Purpose

The QSC ("Q Script Code") format is the reconstructed high-level programming language in I.G.I. 2: Covert Strike. In the sequel, scripts evolved from simple procedural state loops into structured object-oriented behavioral schemas utilizing DefineMagicObj object prototypes.

Naming — read this carefully. QSC stands for "Q Script Code": the Q is the bare C-style letter used throughout the Innerloop C++ codebase (cf. QSC, QVM, .qsc). It is not "Quake Script" and not "Quest Script" — neither name appears in any engine string, header, or tool in the retail files. The Innerloop QVM bytecode VM was derived from / inspired by the Quake virtual machine, but the two are not directly related: QVM has its own LOOP container, its own 49-opcode instruction set, and its own registrar-based native bridging.

Using project-igi-converter, compiled VM v8.5 bytecode (the same LOOP container used by IGI 1; IGI 2 ships a much richer script catalog) is decompiled into readable QSC source code, revealing guard patrol trees, sound perception thresholds, alarm triggers, and multi-stage mission objectives.

2. Script Compilation & Object Schema AST Diagram

The IGI 2 script architecture connects compiled classes to native engine entity instances:

IGI 2 QSC SCRIPT SOURCE — OBJECT SCHEMA AST LAYOUT IGI 2 QSC SCRIPT SOURCE — OBJECT-ORIENTED SCHEMAS OBJECT SCHEMA Structured object-oriented behavioral schemas utilizing DefineMagicObj declarations DefineMagicObj("model_id", "model_id", TASKTYPE_XXX, ...); CLASS HIERARCHY & INHERITANCE CLASSES Behavior registry: one entry per interactive sub-model TASKTYPE_CARDOOR, TASKTYPE_HELIDOOR, TASKTYPE_AISTATIONARYGUN... SQUAD COOPERATION TASKS SQUAD AI Tactical tasks with radio communication calls AI_RadioBroadcastAlert(); AI_SeekNearestCoverNode(); SENSORY EVENT LISTENERS LISTENERS Interrupt callbacks triggered by sensory stimuli Nested calls evaluated recursively as arguments NATIVE C++ ENTITY BINDINGS C++ BINDING Bound directly to CGuardEntity in IGI2.EXE Synchronized weapon dispersion and thermal visibility PROJECT-IGI-CONVERTER RECONSTRUCTION AST RECOVERY Decompiles magicobj.qvm back into readable structured object schemas qvm decompile magicobj.qvm → Reconstructed function-call syntax

3. Tactical AI Event Handling Pipeline Diagram

When sensory triggers occur in the world, the engine raises asynchronous events directly into the QSC event handler:

IGI 2 QSC SCRIPT — SENSORY EVENT & SQUAD TACTICS PIPELINE 1. COMPILATION (QSC compiler) • Parse DefineMagicObj • Build symbol tables • Emit VM v8.5 Bytecode 2. RETAIL BINARY (QVM) • Compiled magicobj.qvm • Packed Magic "LOOP" • Symbol Pool & Offsets 3. SENSORY RAYCAST • Audio Propagation Grid • Guard Hearing Threshold • Doorway Sound Atten 4. SCRIPT EVENT • Post AIEVENT Hook • Execute QSC Handler • Radio Nearby Squad

4. IGI 2 MagicObject Examples (Function-Call Syntax)

In IGI 2, magicobj.qvm (compiled from magicobj.qsc) registers interactive mesh sub-parts with DefineMagicObj calls. The engine checks every ATTA sub-model name against this registry at spawn time:

DefineMagicObj("model_id", "model_id", TASKTYPE_XXX);
// Some task types have extra parameters:
DefineMagicObj("614_02_1", "614_02_1", TASKTYPE_AISTATIONARYGUN, "614_03_1", 361, 15, -4, 10000, 15, 15, "tank_turret", 0, 6);
DefineMagicObj("610_02_1", "610_02_1", TASKTYPE_CARDOOR, 0, 30, -118);
DefineMagicObj("700_05_1", "700_05_1", TASKTYPE_HELIDOOR, 1, 0.6, 2.65);

Parent vehicle models (614_01_1, 622_01_1, 700_01_1) are not listed in magicobj — they are plain parent meshes. Only their ATTA sub-models (turrets, wheels, rotors, doors) are registered as MagicObjects. editormagicobj.qvm is a parallel file used by the level editor only — it shipped empty in the retail game.