Skip to content
Benjamin Auquite edited this page Dec 26, 2025 · 38 revisions

KotOR 2DA file format Documentation

This document provides a detailed description of the 2DA (Two-Dimensional array) file format used in Knights of the Old Republic (KotOR) and Knights of the Old Republic II: The Sith Lords (KotOR 2). 2DA files store tabular game data in a spreadsheet-like format, containing configuration data for nearly all game systems: items, Force powers, creatures, skills, feats, and many other game mechanics.

Official Bioware Documentation: For the authoritative Bioware Aurora Engine 2DA format specification, see Bioware Aurora 2DA Format.

For mod developers: To modify 2DA files in your mods, see the TSLPatcher 2DAList Syntax Guide. For general modding information, see HoloPatcher README for Mod Developers.

Related formats: 2DA files ARE often referenced by GFF files (such as UTC (Creature), UTI (Item), UTP (Placeable) templates) and may contain references to TLK files for text strings.

Important: While the 2DA file format structure is shared across BioWare's Aurora engine games (including Neverwinter Nights, Dragon Age, and Jade Empire), this documentation focuses exclusively on KotOR and KotOR 2. All 2DA file examples, column structures, and engine usage descriptions ARE specific to these games. References to vendor implementations ARE marked as either KotOR-specific or generic Aurora engine code (shared format).

Table of Contents


file structure Overview

2DA files store tabular game data in a compact format used by the KotOR game engine. files use version "V2.b" and have the .2da extension.

Implementation: Libraries/PyKotor/src/pykotor/resource/formats/twoda/

Vendor References:

See Also:


format

The 2DA file format (version "V2.b") is the representation used by the game engine.

File header

The file header is 9 bytes in size:

Name type offset size Description
file type char 0 (0x00) 4 Always "2DA " (space-padded) or "2DA\t" (tab-padded)
file Version char 4 (0x04) 4 Always "V2.b"
Line Break uint8 8 (0x08) 1 Newline character (\n, value 0x0A)

The file type can be either "2DA " (space-padded) or "2DA\t" (tab-padded). Both ARE valid and accepted by the game engine.

References:

Column headers

Column headers immediately follow the header, terminated by a null byte:

Name type Description
Column headers char[] Tab-separated column names (e.g., "label\tname\tdescription")
null terminator uint8 Single null byte (\0) marking end of headers

Each column name is terminated by a tab character (0x09). The entire header list is terminated by a null byte (0x00). Column names ARE case-sensitive and typically lowercase in KotOR files.

References:

Row count

Name type offset size Description
Row count uint32 varies 4 Number of data rows in the file (little-endian)

The row count is stored as a 32-bit unsigned integer in little-endian byte order. This value determines how many row labels and data rows follow.

References:

Row Labels

Row labels immediately follow the row count:

Name type Description
Row Labels char[] Tab-separated row labels (one per row, typically numeric)

Each row label is read as a tab-terminated string (tab character 0x09). Row labels ARE usually numeric ("0", "1", "2"...) but can be arbitrary strings.

Important: The row label list is not terminated by a null byte (0x00). The reader must consume exactly row_count labels based on the count field. This differs from the column headers which do have a null terminator. The row labels ARE primarily for human readability and editing tools - the actual row indexing in the game engine is based on position, not label value.

References:

Cell data offsets

After row labels, cell data offsets ARE stored:

Name type size Description
Cell offsets uint16[] 2×N Array of offsets into cell data string table (N = row_count × column_count, little-endian)
Cell data size uint16 2 Total size of cell data string table in bytes (little-endian)

Each cell has a 16-bit unsigned integer offset (little-endian) pointing to its string value in the cell data string table. Offsets ARE stored in row-major order (all cells of row 0, then all cells of row 1, etc.). The cell data size field immediately follows the offset array and precedes the actual cell data.

Important: The offsets ARE relative to the start of the cell data string table (which begins immediately after the cell_data_size field). Multiple cells can share the same offset value if they contain identical strings, enabling data deduplication.

References:

Cell data string Table

The cell data string table contains all cell values as null-terminated strings:

Name type Description
Cell strings char[] Null-terminated strings, deduplicated (same value shares offset)

The cell data string table begins immediately after the cell_data_size field. Each string is null-terminated (0x00). Blank or empty cells ARE typically stored as empty strings (immediately null-terminated) or the string "****". The string table is deduplicated - multiple cells with the same value share the same offset, reducing file size.

Reading Process: For each cell, the reader:

  1. Retrieves the 16-bit offset from the offset array (indexed by row_index × column_count + column_index)
  2. Seeks to cell_data_start_position + offset
  3. Reads a null-terminated string from that position

References:


data structure

TwoDA Class

The TwoDA class represents a complete 2DA file in memory:

Reference: Libraries/PyKotor/src/pykotor/resource/formats/twoda/twoda_data.py:77-119

Attributes:

  • _rows: List of dictionaries, each mapping column headers to cell values
  • _headers: List of column header names (case-sensitive, typically lowercase)
  • _labels: List of row labels (usually numeric strings like "0", "1", "2"...)

Methods:

  • get_cell(row_index, column_header): Get cell value by row index and column header
  • set_cell(row_index, column_header, value): Set cell value
  • get_column(header): Get all values for a column
  • add_row(label): Add a new row
  • add_column(header): Add a new column

TwoDARow Class

The TwoDARow class provides a convenient interface for accessing row data:

Reference: Libraries/PyKotor/src/pykotor/resource/formats/twoda/twoda_data.py:850-950

Attributes:

  • label: Row label string
  • cells: Dictionary mapping column headers to cell values

Cell value types

All cell values ARE stored as strings in the 2DA file, but ARE interpreted as different types by the game engine:

  • Integers: Numeric strings parsed as int32 - used for numeric identifiers, counts, and enumerated values
  • Floats: Decimal strings parsed as float - used for calculations like damage multipliers, timers, and percentages
  • ResRefs: Resource references (max 16 characters, no extension) - point to other game resources like models, textures, or scripts
  • StrRefs: String references into dialog.tlk (typically negative values like -1 indicate no reference) - used for localized text display
  • Boolean: "0" or "1" (sometimes "TRUE"/"FALSE") - control feature flags and settings
  • Empty Cells: Represented as "****" - treated as null/undefined by the engine

The game engine parses cell values based on context and expected data type for each column. For example, the appearance.2da file uses integers for model indices, ResRefs for texture names, and StrRefs for race names.


Confirmed Engine Usage

The following 2DA files have been confirmed to be actively loaded and used by the KotOR game engine through reverse engineering analysis of the game binaries and engine reimplementations (reone, xoreos):

Core Game Systems:

  • classes.2da - Class definitions and progression
  • [feat.2da](2DA-feat) - Feat definitions
  • featgain.2da - Feat gain tables (referenced in engine error messages)
  • skills.2da - Skill definitions
  • spells.2da - Force power/spell definitions

Character & Appearance:

  • appearance.2da - Creature appearance definitions
  • [racialtypes.2da](2DA-racialtypes) - Race definitions
  • subrace.2da - Subrace definitions
  • gender.2da - Gender definitions
  • portraits.2da - Portrait definitions
  • heads.2da - Head appearance definitions
  • creaturespeed.2da - Creature movement speed definitions

Items & Equipment:

  • baseitems.2da - Base item type definitions

Objects & Areas:

  • placeables.2da - Placeable object definitions
  • [genericdoors.2da](2DA-genericdoors) / doortypes.2da - Door type definitions
  • [traps.2da](2DA-traps) - Trap definitions
  • encdifficulty.2da - Encounter difficulty definitions

Audio & Visual:

  • guisounds.2da - GUI sound definitions
  • footstepsounds.2da - Footstep sound definitions
  • camerastyle.2da - Camera style definitions
  • surfacemat.2da - Surface material definitions

Factions & Reputation:

  • repute.2da - Faction/reputation definitions

Note: Many other 2DA files documented below may be remnants from Neverwinter Nights (NWN) or may be used in ways not yet identified through reverse engineering. The files listed above ARE confirmed to be actively loaded and referenced by the game engine during normal gameplay.

Known 2DA files

This section documents all known 2DA files used in KotOR and KotOR 2, organized by category. Each entry includes engine usage, column definitions, and data structure details.


Character & Combat 2DA files

See appearance.2da for detailed documentation.

See baseitems.2da for detailed documentation.

See classes.2da for detailed documentation.

See feat.2da for detailed documentation.

See skills.2da for detailed documentation.

See spells.2da for detailed documentation.

Items & Properties 2DA files

itemprops.2da

See itemprops.2da for detailed documentation.

iprp_feats.2da

See iprp_feats.2da for detailed documentation.

iprp_spells.2da

See iprp_spells.2da for detailed documentation.

iprp_ammocost.2da

See iprp_ammocost.2da for detailed documentation.

iprp_damagecost.2da

See iprp_damagecost.2da for detailed documentation.

Objects & Area 2DA files

See placeables.2da for detailed documentation.

See genericdoors.2da for detailed documentation.

See doortypes.2da for detailed documentation.

See soundset.2da for detailed documentation.

Visual Effects & animations 2DA files

See visualeffects.2da for detailed documentation.

See portraits.2da for detailed documentation.

heads.2da

See heads.2da for detailed documentation.

Progression Tables 2DA files

classpowergain.2da

See classpowergain.2da for detailed documentation.

cls_atk_*.2da

See cls_atk_*.2da for detailed documentation.

cls_savthr_*.2da

See cls_savthr_*.2da for detailed documentation.

Name Generation 2DA files

humanfirst.2da

See humanfirst.2da for detailed documentation.

humanlast.2da

See humanlast.2da for detailed documentation.

Other Name Generation files

Similar name generation files exist for other species:

  • twilekfirst.2da / twileklast.2da: Twi'lek names
  • zabrakfirst.2da / zabraklast.2da: Zabrak names
  • wookieefirst.2da / wookieelast.2da: Wookiee names
  • rodianfirst.2da / rodianlast.2da: Rodian names
  • droidfirst.2da / droidlast.2da: Droid names
  • catharfirst.2da / catharlast.2da: Cathar names (KotOR 2)
  • miralukafirst.2da / miralukalast.2da: Miraluka names (KotOR 2)
  • miracianfirst.2da / miracianlast.2da: Miraluka names (KotOR 2, alternate spelling)

Additional 2DA files

ambientmusic.2da

See ambientmusic.2da for detailed documentation.

ambientsound.2da

See ambientsound.2da for detailed documentation.

ammunitiontypes.2da

See ammunitiontypes.2da for detailed documentation.

camerastyle.2da

See camerastyle.2da for detailed documentation.

footstepsounds.2da

See footstepsounds.2da for detailed documentation.

prioritygroups.2da

See prioritygroups.2da for detailed documentation.

repute.2da

See repute.2da for detailed documentation.

surfacemat.2da

See surfacemat.2da for detailed documentation.

loadscreenhints.2da

See loadscreenhints.2da for detailed documentation.

bodybag.2da

See bodybag.2da for detailed documentation.

ranges.2da

See ranges.2da for detailed documentation.

regeneration.2da

See regeneration.2da for detailed documentation.

See animations.2da for detailed documentation.

combatanimations.2da

See combatanimations.2da for detailed documentation.

weaponsounds.2da

See weaponsounds.2da for detailed documentation.

placeableobjsnds.2da

See placeableobjsnds.2da for detailed documentation.

creaturespeed.2da

See creaturespeed.2da for detailed documentation.

exptable.2da

See exptable.2da for detailed documentation.

guisounds.2da

See guisounds.2da for detailed documentation.

dialoganimations.2da

See dialoganimations.2da for detailed documentation.

tilecolor.2da

See tilecolor.2da for detailed documentation.

forceshields.2da

See forceshields.2da for detailed documentation.

plot.2da

See plot.2da for detailed documentation.

See traps.2da for detailed documentation.

modulesave.2da

See modulesave.2da for detailed documentation.

tutorial.2da

See tutorial.2da for detailed documentation.

globalcat.2da

See globalcat.2da for detailed documentation.

subrace.2da

See subrace.2da for detailed documentation.

gender.2da

See gender.2da for detailed documentation.

See racialtypes.2da for detailed documentation.

upgrade.2da

See upgrade.2da for detailed documentation.

encdifficulty.2da

See encdifficulty.2da for detailed documentation.

See itempropdef.2da for detailed documentation.

emotion.2da

See emotion.2da for detailed documentation.

facialanim.2da

See facialanim.2da for detailed documentation.

videoeffects.2da

See videoeffects.2da for detailed documentation.

planetary.2da

See planetary.2da for detailed documentation.

cursors.2da

See cursors.2da for detailed documentation.

Item Property Parameter & Cost Tables 2DA files

The following 2DA files ARE used for item property parameter and cost calculations:

iprp_paramtable.2da

See iprp_paramtable.2da for detailed documentation.

iprp_costtable.2da

See iprp_costtable.2da for detailed documentation.

iprp_abilities.2da

See iprp_abilities.2da for detailed documentation.

iprp_aligngrp.2da

See iprp_aligngrp.2da for detailed documentation.

iprp_combatdam.2da

See iprp_combatdam.2da for detailed documentation.

iprp_damagetype.2da

See iprp_damagetype.2da for detailed documentation.

iprp_protection.2da

See iprp_protection.2da for detailed documentation.

iprp_acmodtype.2da

See iprp_acmodtype.2da for detailed documentation.

iprp_immunity.2da

See iprp_immunity.2da for detailed documentation.

iprp_saveelement.2da

See iprp_saveelement.2da for detailed documentation.

iprp_savingthrow.2da

See iprp_savingthrow.2da for detailed documentation.

iprp_onhit.2da

See iprp_onhit.2da for detailed documentation.

iprp_ammotype.2da

See iprp_ammotype.2da for detailed documentation.

iprp_mosterhit.2da

See iprp_mosterhit.2da for detailed documentation.

iprp_walk.2da

See iprp_walk.2da for detailed documentation.

ai_styles.2da

See ai_styles.2da for detailed documentation.

iprp_damagevs.2da

See iprp_damagevs.2da for detailed documentation.

iprp_attackmod.2da

See iprp_attackmod.2da for detailed documentation.

iprp_bonusfeat.2da

See iprp_bonusfeat.2da for detailed documentation.

iprp_lightcol.2da

See iprp_lightcol.2da for detailed documentation.

iprp_monstdam.2da

See iprp_monstdam.2da for detailed documentation.

iprp_skillcost.2da

See iprp_skillcost.2da for detailed documentation.

iprp_weightinc.2da

See iprp_weightinc.2da for detailed documentation.

iprp_traptype.2da

See iprp_traptype.2da for detailed documentation.

iprp_damagered.2da

See iprp_damagered.2da for detailed documentation.

iprp_spellres.2da

See iprp_spellres.2da for detailed documentation.

rumble.2da

See rumble.2da for detailed documentation.

musictable.2da

See musictable.2da for detailed documentation.

difficultyopt.2da

See difficultyopt.2da for detailed documentation.

xptable.2da

See xptable.2da for detailed documentation.

featgain.2da

See featgain.2da for detailed documentation.

effecticon.2da

See effecticon.2da for detailed documentation.

itempropsdef.2da

See itempropsdef.2da for detailed documentation.

pazaakdecks.2da

See pazaakdecks.2da for detailed documentation.

acbonus.2da

See acbonus.2da for detailed documentation.

keymap.2da

See keymap.2da for detailed documentation.

soundeax.2da

See soundeax.2da for detailed documentation.

poison.2da

See poison.2da for detailed documentation.

feedbacktext.2da

See feedbacktext.2da for detailed documentation.

creaturesize.2da

See creaturesize.2da for detailed documentation.

appearancesndset.2da

See appearancesndset.2da for detailed documentation.

texpacks.2da

See texpacks.2da for detailed documentation.

videoquality.2da

See videoquality.2da for detailed documentation.

loadscreens.2da

See loadscreens.2da for detailed documentation.

phenotype.2da

See phenotype.2da for detailed documentation.

palette.2da

See palette.2da for detailed documentation.

bodyvariation.2da

See bodyvariation.2da for detailed documentation.

See textures.2da for detailed documentation.

merchants.2da

See merchants.2da for detailed documentation.

actions.2da

See actions.2da for detailed documentation.

aiscripts.2da

See aiscripts.2da for detailed documentation.

bindablekeys.2da

See bindablekeys.2da for detailed documentation.

crtemplates.2da

See crtemplates.2da for detailed documentation.

environment.2da

See environment.2da for detailed documentation.

fractionalcr.2da

See fractionalcr.2da for detailed documentation.

gamespyrooms.2da

See gamespyrooms.2da for detailed documentation.

hen_companion.2da

See hen_companion.2da for detailed documentation.

hen_familiar.2da

See hen_familiar.2da for detailed documentation.

masterfeats.2da

See masterfeats.2da for detailed documentation.

movies.2da

See movies.2da for detailed documentation.

stringtokens.2da

See stringtokens.2da for detailed documentation.

tutorial_old.2da

See tutorial_old.2da for detailed documentation.

credits.2da

See credits.2da for detailed documentation.

disease.2da

See disease.2da for detailed documentation.

droiddischarge.2da

See droiddischarge.2da for detailed documentation.

minglobalrim.2da

See minglobalrim.2da for detailed documentation.

upcrystals.2da

See upcrystals.2da for detailed documentation.

chargenclothes.2da

See chargenclothes.2da for detailed documentation.

aliensound.2da

See aliensound.2da for detailed documentation.

alienvo.2da

See alienvo.2da for detailed documentation.

grenadesnd.2da

See grenadesnd.2da for detailed documentation.

inventorysnds.2da

See inventorysnds.2da for detailed documentation.

areaeffects.2da

See areaeffects.2da for detailed documentation.

Implementation Details

PyKotor Implementation

Reading: Libraries/PyKotor/src/pykotor/resource/formats/twoda/io_twoda.py:12-106

Writing: Libraries/PyKotor/src/pykotor/resource/formats/twoda/io_twoda.py:109-174

Vendor Implementations

reone (C++):

xoreos (C++):

  • Reading: vendor/xoreos/src/aurora/2dafile.cpp - Generic Aurora engine 2DA format parser (shared across KotOR, Neverwinter Nights, and other Aurora engine games). The format structure is the same, but specific 2DA files and their columns ARE KotOR-specific.

KotOR-Unity (C#):

TSLPatcher (Perl):

KotOR.js (TypeScript):

Kotor.NET (C#):


This documentation aims to provide a comprehensive overview of the KotOR 2DA file format, focusing on the detailed file structure and data formats used within the games.

Clone this wiki locally