Home > Tutorials > 2DA or not 2DA – Overriding 2DA files

2DA or not 2DA – Overriding 2DA files

The subject of 2DA files has come up a lot recently.  What are they? How do you change them? How do you compile them?  In this tutorial we’ll take a look at how to work with 2DA files, and how to override them in a proper manner to introduce custom items and behavior to Dragon Age.

What is a 2DA File?

At its core, a 2da file is nothing more than a spreadhseet.  In fact 2DA stands for “2 dimensional array”.  A simple sheet of rows and columns.  Looking at an even more basic level, a 2DA is nothing more than a way to format data in the game.  A list of items for example and all thier related stats, works perfectly as a spreadsheet.

2DA files are used to define most, if not all, of the hard data in the game.  And as a bonus to modders, you have the ability to access and modify these 2DA files.

In its raw, uncompiled form, a 2DA is stored as a simple .xls file.  An Excel spreadsheet.  You can open them up and edit them in Microsoft Excel, OpenOfiice, or any other spreadsheet program that supports Microsoft Excel files.  In order for those spreadsheets to be used by the game, they are the compiled into a binary file with the extension .GDA

Overriding a 2DA File

So what if you want to create new data that is stored in these files, or you want to change existing data?  You could, in theory, simply modify the appropriate .xls file with the new data, then compile it, but this is actually the wrong way to go about it.  See, if you do this, then the game is patchedin the future with a new version of that file, your mod will possibly break, or you could cause problems with the game’s patching, or any one of many other issues.  This is something to keep in mind.  Changing base game files is usually a bad thing.  Avoid it whenever you can.

In this case, Bioware has given us a way of overriding these files without replacing the actual game files.  They call it M2DA’s, or Mutliple two dimensional arrays.  A really fancy way of saying, they can be used to extend or override base files.  Let’s take a look at how this works.

First, just to help illustrate, we’re going to work with a made up example.  This isn’t a valid 2da file, as its paired down for simplicity.

Let’s say the game has an .xls spreadsheet with items in it.  It might look something like this:
4aead60ee7b4444b452a3bb8b0ecc7b8
Here we can see a few items defined, and thier stats.  Let’s say this file is “items.xls”.  Now what we want to do is add a new item to the game.  We want to add a Longbow.  Now we could open up this file, items.xls, and add a new row for the longbow, with an ID of 5, but that would be the wrong way to do it.  Instead we’ll create a NEW file, let’s call it “items_bows.xls”.  And in here we will define our bow, but we’ll make sure to use an ID of 5, so it doesn’t interfere with the ones listed in the base file.
b84d9b91b6fae9ef696ac7dc1bfc3093

Now we have created a new file, with our new item.  We have, in essence, created an M2DA file.  But how does our data now get combined with the game’s data?  Its all in the file name.  Remember how the game’s file was called “items.xls” and we called ours “items_bows.xls”?  Notice that they both start with the same filename “items”.  This is the key.  When the game loads in the items, it will load in every 2da that starts with “items”, which means it will read it its own base file, and see definitions for 3 items, ID numbers 2,3, and 4, and then it will read in our file items_bows, and see another definition for an item with an ID of 5.  It will then combine both into a final table for the game’s use.

The two key points to making this work is the filename and the ID.  The proper filenames allow the game to merge the tables, and the proper IDs allow us to add new items, or if we used an existing ID we can replace or override the base data.  For example we could make a file “items_new_swords.xls”
216b6b4141af4b50109a169dbf546302

This file, when combined with our previous two, would create yet another new item, a shortsword, ID 6, but it would also override the base longsword with new data, since it re-uses the same ID of 2.  Now let’s start looking at a real world example, with proper 2DA formatting.

A real 2DA is slightly more complicated, but not by much.  Let’s take a look at an actual 2DA.  This is from 2DA_base.xls
240056f8754e8f0e3e702ad3e02a1c75

 As you can see, it isn’t much different.  First off, ignore the colors and formatting.  Bioware has done this in a lot of files, but it is only cosmetic and doesn’t affect the 2DA.  Let’s dissect this.

The first two rows in a 2da are always the same.  Row 1 contains the column names, with ID always being the first.  The rest will depend on the data in the 2DA.  Row 2 indicates the “datatype” of each column.  In the example above, row 2 tells us that ID is an integer, Label is a string, etc.

The actual data starts on row 3.  Each row must has a unique ID, and the IDs must be in sequential order, though you can skip IDs.

Earlier we said that the game knows which 2DA files to combine based on the file name, but how do you know what filenames to use?  This file that we’re looking at, 2DA_base.xls has the answer.  Column C in this worksheet gives us this information.  For example, lets look at Items.  We can see here that the file that defines items will start with “BITM_”.  Any M2DA’s you make to override items would need to have that same prefix.

Compiling 2DA Files

Now that we know how to use 2DA files, and create our own, we need to know how to compile those .xls files into the game’s .gda format.  This is very easy.  In order to compile these files we need to use a simple commandline utility that comes with the toolset, called ExcelProcessor.exe which you can find in:

Dragon Age\tools\ResourceBuild\Processors

Now there are a few different ways to use this tool, but for right now i’m going to just cover the simplest.  What you want to do is decide on some directory that you are going to use for saving your .xls files.  It doesn’t matter where that is, so its up to you.  Copy the ExcelProcessor.exe file to that location.  Then whenever you want to compile an .xls file, all you have to do is open the directory in Windows Explorer, then drag and drop the .xls file onto ExcelProcessor.exe and the program will take your .xls and compile it, placingthe compiled.gda into that same directory.

Where to Put the Compiled 2DA Files

Once you have your compiled files, you need to place them in the proper location for the game to use them.  This is an area that is still a bit grey, so I want to say right away that my information may be wrong or incomplete.  I’ll update this once we’ve all narrowed it down a bit more.  Righ tnow i’ve just been copying them into pretty much every override directory until it works 🙂

Advertisements
Categories: Tutorials
  1. Dan
    November 11, 2009 at 9:42 pm

    You can put the gda files in \Dragon Age\packages\core\override

    File structure counts, so if you modify any rules you will need to make a rules folder in override and dump them in there. Then the game/toolset can parse them appropriately

  2. RabbitFly
    November 13, 2009 at 7:36 pm

    Great review helped me a lot, but that way of using the excelprocessor is not working for me. Maybe you could elaborate on the other ways to use it?

    • John Vanderbeck
      November 13, 2009 at 7:37 pm

      What happens when you try to use it?

  3. EVEpwnsYOURface
    November 14, 2009 at 11:55 pm

    I have the problem on Windows 7 that I can’t seem to “explore” the ExcelProcessor.exe, i only have the option to “open” it. I recently migrated from XP and am saddened to see I cannot find this option. Maybe that is what RabbitFly meant? Maybe you can help?

    • John Vanderbeck
      November 15, 2009 at 9:28 am

      What do you mean “explore”. Just drag and drop the xls file over the exe file.

  4. EVEpwnsYOURface
    November 15, 2009 at 10:42 am

    “Then whenever you want to compile an .xls file, all you have to do is open the directory in Windows Explorer, then drag and drop the .xls file onto ExcelProcessor.exe and the program will take your .xls and compile it, placingthe compiled.gda into that same directory.”

    Ahh! I am sorry when I read this it made it seem like I had to open the ExcelProcessor.exe file. Thank you for the tutorials! I will attempt modding now.

  5. Jean
    November 15, 2009 at 10:53 am

    John,

    What if I want to edit two tabs in the ABI_base.xls file. I need to make changes to the ABI_Base tab and the ability_data tab. The 2DA_Base states that Abilities should have a prefix of ABI_ but both tabs in the ABI_base xls have different headers.

    Does that mean I have to make two xls files name ABI_change1 ABI_change2 and add the headers/changes of the ABI_Base tab to ABI_change1 and the headers/changes of the ability_data tab to ABI_change2?

    Or could I just create one ABI_mynamehere file and create two tabs, one names ABI_Base and one names ability_data?

    I am a bit confused about this multiple tabs per xls file thing 🙂

    • John Vanderbeck
      November 15, 2009 at 11:36 am

      I am a bit confused about this multiple tabs per xls file thing

      You aren’t the only one 🙂 The resulting GDA files get named based on the TABS (or worksheets is the proper term), not the name of the xls file. This however seems to oppose the naming scheme set up by 2da_base as you pointed out. What i’ve been doing is in every case, just keep the original name of the tab and add a suffix to the end of it. So far this has always worked for me.

  6. Jean
    November 15, 2009 at 12:17 pm

    What i’ve been doing is in every case, just keep the original name of the tab and add a suffix to the end of it. So far this has always worked for me.

    Thanks that worked like a charm. Here is a recap of my steps for those who are still struggling:

    1) Made a copy of ABI_Base.xml
    2) Removed every non-relevant line and kept the lines that I actually altered
    3) Used ExcelProcessor to convert the worksheets to GDA files
    4) Removed all but the two altered GDA files ABI_Base and ability_data
    5) Renamed them to ABI_Base_NightmarePlus and ability_data_NightmarePlus
    6) Copied files to packages/core/override/zNightmarePlus subdirectory
    7) Game works flawlessly and modifications work alongside other ABI_Base mods

  7. Griff
    November 16, 2009 at 11:45 pm

    I’m having some trouble opening the _base.xls files.

    For example the 2DA_base.xls is all blank to me..is it my Excel? Something wrong with the files?

    Need help 😦

  8. Anoff
    November 17, 2009 at 12:13 am

    A very nice and succinct explanation, but I am having trouble with the ExcelProcessor. I believe I am using it correctly (created a folder, placed processor / edited-2DA in the folder, dragged 2DA onto the processor .exe). The processor then opens, shows a few lines of text, and closes in less than a second. There is no .gda file.

    • John Vanderbeck
      November 17, 2009 at 9:27 am

      Are you creating the XLS file with Excel or OpenOffice? I found out just recently that OpenOffice creates some bad files, and had that happen to me. The processor would run and say it was done, but i’d get no file. Went and redid the file in Excel and it processed perfectly.

      • Caladon
        November 17, 2009 at 12:08 pm

        I had the same problem with Excel 2007 so I just opened a commmand prompt at the folder where my .xls and the ExcelProcessor.exe was and typed “excelprocessor myfilename.xls” no quotes and hit enter and that worked

      • Anoff
        November 17, 2009 at 1:19 pm

        I was using Excel, yes. However, when working my way to a potential solution, I found something new which (partially) resolved my issue and may be the answer for those using OpenOffice. I found that the GDAs were being exported not to the directory of the .exe/.xls, but my “C:\Documents and Settings\Me” folder.

        The compilation of my test modification was there and seemed to work in game. OpenOffice users may find the files in a similar location?

        Either way, although the files do export and work, the export location is somewhat inconvenient. Any thoughts on why the excelprocessor might have this abnormality?

      • John Vanderbeck
        November 17, 2009 at 1:20 pm

        Extremely odd. By default the processor is supposed to export to the current directory. Maybe something about the file, or filename was messing it up.

      • Anoff
        November 17, 2009 at 2:53 pm

        Indeed. I have no idea why it exports there, nor does there seem to be any documentation justifying the path. No matter, I suppose. Regardless, I appreciate the help, and excellent guide. At last I can make a few spell/ability tweaks!

  9. Caladon
    November 17, 2009 at 12:05 pm

    Here is an easier way to make GDA’s from scratch

    1. Create new workbook in Excel
    2. Delete sheet2 and sheet3 annd rename sheet1 to PRCSCR_Whateveruwant ( beginning part dependant on what you are making i.e. BTIM_ / PRCSCR_ ect.)
    3. Save file as.. and if using Excel 2007 change file type from .xlsx to Whateveruwant.xls
    4. add your info as noted in the tutorial
    5. Save file
    6. Compile GDA
    7. Copy GDA to Dragon Age/Addins/YourModName/core/override

    You are done!

  10. Caladon
    November 17, 2009 at 2:26 pm

    Or possibly Excel\OpenOffice defines a default save location and the processor is using that when you drop the file on it

  11. mackeyz
    November 22, 2009 at 5:48 am

    i have drag and drop my .xls file into excellpro.exe but nothing happen. there is no .GDA file, why???

    • John Vanderbeck
      November 22, 2009 at 10:38 am

      Are you using Excel or OpenOffice? I had this problem once with OpenOffice. The processor would run, give no errors, but the file never got created. When I remade the xls file in Excel it worked.

  12. Sven Boogie
    November 22, 2009 at 10:56 pm

    Dragging my PRCSCR_ excel file onto the processor gives me an error in the command line tool:

    ERROR: Worksheet Sheet2 has zero columns or rows
    Press any key to terminate…

    • John Vanderbeck
      November 23, 2009 at 11:31 am

      @Sven Boogie
      Just go into your XLS file and delete the blank worksheets. The processor tries to run those as well and since they are blank, it errors out.

  13. Magissia
    December 1, 2009 at 10:48 am

    Can’t we directly make this file in the toolset somewhere ?

  14. John Vanderbeck
    December 1, 2009 at 10:50 am

    Magissia :

    Can’t we directly make this file in the toolset somewhere ?

    Technically yes, but its about 4 billion times more work as you would have to create it at essentially a binary level.

    Someone did however make a program called GDApp that lets you create them directly. Not sure of the link though.

  15. Magissia
    December 1, 2009 at 1:46 pm

    files made with microsoft excel 2010 don’t work

  16. Magissia
    December 1, 2009 at 1:54 pm

    John Vanderbeck :

    Magissia :
    Can’t we directly make this file in the toolset somewhere ?

    Technically yes, but its about 4 billion times more work as you would have to create it at essentially a binary level.
    Someone did however make a program called GDApp that lets you create them directly. Not sure of the link though.

    I would like to know how to make it from the toolset, it will takes 4 billion less time of work for me since the thing suposed to convert don’t convert anything

  17. John Vanderbeck
    December 1, 2009 at 2:07 pm

    Magissia :

    files made with microsoft excel 2010 don’t work

    You need to SAVE AS and choose the Excel 97 Workbook option. I forget the exact name, its something like “Excel 97-2003 Workbook”.

  18. Magissia
    December 1, 2009 at 3:06 pm

    John Vanderbeck :

    Magissia :
    files made with microsoft excel 2010 don’t work

    You need to SAVE AS and choose the Excel 97 Workbook option. I forget the exact name, its something like “Excel 97-2003 Workbook”.

    Done

    Don’t work

  19. _Mike
    January 19, 2010 at 8:07 pm

    How to get the exporter to export directly to a directory of your choice:

    1) Create a shortcut to ExcelProcessor.exe. You can place it on your desktop or where ever you like.. I have mine in the same directory as my .xls files for easy access.
    2) Right-click the shortcut and select properties.
    3) In the “start in” field (I’m not sure if it’s called that in the English version of windows. But it’s the second textbox from the top) type in where you want your files exported.
    4) When you want to export your excel files drag and drop them on to this shortcut and not the original ExcelProcessor.exe and assuming it completes without any parsing errors you should find your new .gda in that directory.

  20. cant say
    June 24, 2010 at 4:43 pm

    i dont get how to get the 2da flie from the game

  1. November 15, 2009 at 12:30 pm
  2. November 16, 2009 at 10:21 pm

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: