Near Infinity - An Infinity Engine Browser & Editor
Home About Download Using NI Menu options File types Links
This page is somewhat outdated.
Note: This page assumes that Near Infinity is used with Baldur's Gate 2.
Last updated: May 13, 2003 13:00
Launching Near Infinity

If you haven't put NearInfinity.jar in the directory where Baldur's Gate 2 is installed, you will be greeted with the following dialog:

This prompts you to locate chitin.key. This file is essentially a directory of the different files used in Baldur's Gate 2. After you have located the file, select it and press 'Open'. (Near Infinity will now remember this directory and will not ask you to locate chitin.key next time you start.)

Main window

After a brief moment, the main window of Near Infinity appears.

This window consists of four parts:

  • A menu bar
  • A tree showing the different resources in Baldur's Gate 2
  • The main content area
  • A status bar. This bar will always show the last file accessed by Near Infinity.
The resource tree
In the tree the different resources (files) in Baldur's Gate 2 are shown grouped by type. In addition to files indexed in chitin.key, Near Infinity shows files located in the following directories: Override, Mpsave, Music, Characters, Scripts, Sounds, Save and Temp.

If you right-click an entry in the resource tree, you can choose between 'Open', 'Open in new window', 'Export' and 'Add copy of'. 'Add copy of' prompts you for a filename and saves a copy of the selected resource in the override-folder using the entered name. If you select a file not located in a BIFF archive, you will also be able to select 'Rename' and 'Delete'.

The tree also supports quick navigation (similar to Windows Explorer). Simply type the first letters of the file you're interested in while the tree is active. Note that only opened branches in the tree are searched.

For a detailed explanation of the different types, check out The Infinity Engine File Format Hacking Project or the Infinity Engine Structures Description Project.

When you select a specific resource, details about it are shown in the main content area.
Details of how the different types are displayed, are available on the file types page.

The '<'- and '->'-buttons are used to navigate between visited resources similar to the Back and Forward buttons in web-browsers.

The override-folder
Resources (files) in Baldur's Gate are stored in large archives called BIF-files. These archives are often compressed and offers a space-efficient way of storing large number of files. The different resources in the BIF-files are indexed by a file named chitin.key.

However, it also makes it difficult to replace a single file. This problem is solved by the Override-folder. This folder is present in the main directory of Baldur's Gate 2 and contains replacement versions of files located in archives (as well as files not indexed by chitin.key)

When the Infinity Engine (and Near Infinity) wants to get a specific file, it examines the override-folder before it goes to the archives. This is of great importance to editing. When you for instance have made an updated version of The Carsomyr +5 (SW2H10.ITM), you only have to place the new version in the override-folder to get Baldur's Gate 2 to recognize your work.

Tutorial: Correct the bug regarding Carsomyr's damage
According to the description of Carsomyr, it should do 1d12+5 damage. However, a bug in the item's definition, makes it 1d10+5 instead. The Paladins must be furious! (This bug is by the way fixed in Kevin Dorner's excellent Fix pack.)

This tutorial shows you how to correct this bug.

  • Find Carsomyr
    Start Near Infinity and select 'Find...' from the Tools-menu. Select 'Items' and enter 'Carsomyr' (without the quotes) in the 'With name' field and press 'Search'. After a few moments the result is shown with two hits. Select 'SW2H10.ITM - carsomyr +5' and press 'Open'. (The other sword is not the one we are after).
  • Locate entry for melee damage
    Scroll to the bottom of the table containing the attributes of Carsomyr. There you can find an 'Item ability' with the value 'Type: Melee,...'. Select this line and press the 'View/Edit' button below. This button lights up when entries for nested structures are selected and allows you to examine and edit these structures. A new window ('Item ability') should now open up. The attribute we are interested in is called 'Dicesize'. This attribute should have a value of 10. (If it already is 12, you probably have installed a bug fix already).
  • Edit entry
    To correct the bug, double-click '10' and enter '12' (without quotes) and press return. The value in the attribute table should now be updated. Close the 'Ability'-window (Hint: The escape-key is a useful shortcut).
  • Save updated Carsomyr
    To conclude this tutorial, press 'Save'. You will be informed that the item is saved to 'override/sw2h10.itm'.
How to edit different attributes
In the above tutorial, we edited a number-attribute. However, several different types of attributes are present.
  • Numbers & Strings
    Number (decimal or hexadecimal) and strings are entered directly into the attribute table. If you try to input invalid values (too long strings, letters where numbers are expected, etc.), Near Infinity will respond with 'Error updating value'.
  • StringRefs
    These attributes are simply numeric indexes into dialog.tlk. Enter required index in the text field and press enter to view the corresponding text entry. If the entry has an associated sound clip, the button marked 'Associated sound' will light up.
  • Flags
    A flag is an attribute which might have several different values simultaneously. (For example: 'Unusable by' in item). Clicking on an entry in the presented list, will toggle its status. Press 'Update value' when done.
  • Lists
    Lists uses an interface similar to flags, but here only one entry may be selected at any one time. All lists are sorted alphabetically.
  • ResourceRefs
    This is a special type of list in that it contains all the different resources of a given type. An example is 'Small portrait' in the CRE-structure (creatures) where you can select one of the available BMP-files. To view the resource currently selected in the list, press 'View/Edit'. The text field above the the list is used for quick navigation. Simply enter the first letters of the filename you're interested in.
  • Colors
    This type of attribute is used to select color ranges for skin colors, hair colors etc. The interface is similar to number-editing, with the exception of two extra + and - buttons as well as the display of the selected color range. If the selected color range cannot be found, ?s will be shown instead.
  • Type of effects
    The attribute 'Type' in effect-structures is somewhat special. The attribute itself is a simple list, but editing of this attribute has extra consequences. This is due to that the value of this attribute determines how the following attributes in the effect-structure should be interpreted. Therefore a change to this attribute probably will change the name and value of several others.
  • Unknown
    Attributes which meaning is unknown are editable as hex. Any other attribute can be coverted to this attribute by right-clicking and selecting 'Edit as hex'.
Advanced editing
Overview of the more advanced features:
  • Use Strings > Edit strings to correct or expand the existing string table (dialog.tlk)
  • Right-clicking in the editing window gives you access to cut, copy and paste operations.
  • The Remove-button is used to remove structures contained in other structures. For example: You might delete an 'Item for sale' from a store, or you might remove an Item from a creature. The attributes that contain the offsets and number of these contained structures are automatically updated.
  • The Add...-button allows you to do the inverse: Add 'Item for sale' to a store or items to a creature. Offsets to and count of is automatically updated. Be aware that new structures added in this way will have all its entries set = 0. This means that editing is necessary.