-
Notifications
You must be signed in to change notification settings - Fork 0
IGameDataService API Reference
Core game data access for the Radoub toolset. Provides cached access to 2DA tables, TLK strings, game resources, soundsets, and palettes.
- Overview
- Resource Resolution Chain
- 2DA Access
- TLK String Resolution
- Resource Access
- Soundset Access
- Palette Access
- Configuration
- Supporting Types
IGameDataService is defined in Radoub.Formats.Services and implemented by GameDataService. It wraps GameResourceResolver with caching and convenience methods.
Package: Radoub.Formats
Lifetime: Singleton per tool. Implements IDisposable - dispose when done.
Construction:
// Auto-configured from RadoubSettings
using var service = new GameDataService();
// Explicit configuration
var config = new GameResourceConfig { GameDataPath = @"C:\Games\NWN\data" };
using var service = new GameDataService(config);All resource lookups follow NWN's standard priority:
1. Override folder (loose files) ← Highest priority
2. HAK files (in configured order)
3. Module resources
4. Base game BIF files (via KEY) ← Lowest priority
flowchart TB
Request[Find Resource] --> Override
Override{Override Folder} -->|Found| Return[Return Data]
Override -->|Not Found| HAK
HAK{HAK Files} -->|Found| Return
HAK -->|Not Found| Module
Module{Module Resources} -->|Found| Return
Module -->|Not Found| BIF
BIF{BIF via KEY} -->|Found| Return
BIF -->|Not Found| Null[Return null]
2DA files are cached on first load (including negative cache for missing files).
TwoDAFile? Get2DA(string name)Get a 2DA file by name (without extension). Returns cached instance on subsequent calls.
TwoDAFile? baseItems = service.Get2DA("baseitems");
TwoDAFile? races = service.Get2DA("racialtypes");string? Get2DAValue(string twoDAName, int rowIndex, string columnName)Convenience method to get a single cell value. Combines Get2DA() + row/column lookup.
string? raceName = service.Get2DAValue("racialtypes", 0, "Label"); // "Human"
string? baseAC = service.Get2DAValue("baseitems", 12, "BaseAC");bool Has2DA(string name)Check if a 2DA file exists in the resolution chain.
void ClearCache()Clear all cached 2DA files. Call after resource paths change (e.g., module switch).
string? GetString(uint strRef)Resolve a TLK string reference to text. Automatically routes to custom TLK for StrRef >= 16777216 (0x01000000).
string? text = service.GetString(12345); // Base TLK
string? custom = service.GetString(16777300); // Custom TLK (offset applied)string? GetString(string? strRefStr)Resolve from a string value. Handles "****" and invalid values gracefully (returns null).
string? text = service.GetString("12345"); // Resolves
string? none = service.GetString("****"); // Returns null
string? bad = service.GetString("abc"); // Returns nullbool HasCustomTlk { get; }Whether a custom TLK is currently loaded.
void SetCustomTlk(string? path)Set the custom TLK file path for module-specific strings. Pass null to clear.
service.SetCustomTlk(@"C:\NWN\modules\mymod\customtlk.tlk");byte[]? FindResource(string resRef, ushort resourceType)Find a resource by ResRef and type ID. Returns raw bytes or null.
byte[]? dlgData = service.FindResource("conv001", ResourceTypes.Dlg);
byte[]? utcData = service.FindResource("goblin01", ResourceTypes.Utc);IEnumerable<GameResourceInfo> ListResources(ushort resourceType)List all resources of a specific type across all sources.
var allDialogs = service.ListResources(ResourceTypes.Dlg);
foreach (var info in allDialogs)
Console.WriteLine($"{info.ResRef} from {info.Source}");SsfFile? GetSoundset(int soundsetId)Get a soundset by its row index in soundset.2da. Returns parsed SSF file.
SsfFile? GetSoundsetByResRef(string resRef)Get a soundset directly by its ResRef (without .ssf extension).
string? GetSoundsetResRef(int soundsetId)Get the ResRef string for a soundset from soundset.2da.
string? resRef = service.GetSoundsetResRef(42); // e.g., "vs_fhuman_1"
SsfFile? ssf = service.GetSoundsetByResRef(resRef!);IEnumerable<PaletteCategory> GetPaletteCategories(ushort resourceType)Get palette categories from skeleton ITP files (e.g., creaturepal.itp for UTC type 2027).
var categories = service.GetPaletteCategories(2027); // UTC palette
foreach (var cat in categories)
Console.WriteLine($"[{cat.Id}] {cat.FullPath}");string? GetPaletteCategoryName(ushort resourceType, byte categoryId)Get a category name by its ID (matches PaletteID field in blueprints).
string? name = service.GetPaletteCategoryName(2027, 5); // e.g., "Animals"bool IsConfigured { get; }Whether the service has valid game paths configured. Check before making calls.
void ReloadConfiguration()Reload configuration from RadoubSettings. Call after the user changes game paths in settings. Clears all caches.
public class GameResourceInfo
{
public required string ResRef { get; init; }
public required ushort ResourceType { get; init; }
public required GameResourceSource Source { get; init; }
public string? SourcePath { get; init; }
}public enum GameResourceSource
{
Override, // Override folder (highest priority)
Hak, // HAK file
Module, // Module resource
Bif // Base game BIF file (lowest priority)
}public class PaletteCategory
{
public byte Id { get; init; }
public required string Name { get; init; }
public string? ParentPath { get; init; }
public string FullPath => string.IsNullOrEmpty(ParentPath)
? Name : $"{ParentPath}/{Name}";
}- Radoub-Formats - Format library overview
- Game-Data-Integration-Guide - Bootstrap and integration patterns
- Radoub-UI-Developer - Shared UI components using IGameDataService
Page freshness: 2026-02-13
Getting Started
User Guide
Features
Help
- Manifest - Journal Editor
- Quartermaster - Creature/Inventory Editor
- Relique - Item Editor
- Reliquary - Placeable Editor (Alpha)
- Fence - Merchant/Store Editor
- Trebuchet - Radoub Launcher
- Marlinspike - Search and Replace
- Spell Check - Dictionary-based spell checking
- Token System - Dialog tokens and custom colors
Parley Internals
Manifest Internals
Quartermaster Internals
Relique Internals
Reliquary Internals
Fence Internals
Marlinspike (Search Engine)
Trebuchet Internals
Radoub.UI
Library
Low-Level Formats
High-Level Parsers
- JRL Format (.jrl)
- UTI Format (.uti) - Item blueprints
- UTC Format (.utc) - Creature blueprints
- UTM Format (.utm) - Store blueprints
- UTP Format (.utp) - Placeable blueprints
- UTD Format (.utd) - Door blueprints
- ARE Format (.are) - Area properties
- BIC Format (.bic) - Player characters
Original BioWare Aurora Engine file format specifications.
Core Formats
- GFF Format - Generic File Format
- KEY/BIF Format - Resource archives
- ERF Format - Encapsulated resources
- TLK Format - Talk tables
- 2DA Format - Data tables
- Localized Strings
- Common GFF Structs
Object Blueprints
- Creature Format (.utc)
- Item Format (.uti)
- Store Format (.utm)
- Door/Placeable (.utd/.utp)
- Encounter Format (.ute)
- Sound Object (.uts)
- Trigger Format (.utt)
- Waypoint Format (.utw)
Module/Area Files
- Conversation Format (.dlg)
- Journal Format (.jrl)
- Area File Format (.are/.git/.gic)
- Module Info (.ifo)
- Faction Format (.fac)
- Palette/ITP Format (.itp)
- SSF Format - Sound sets
Reference
Page freshness: 2026-05-24