Back to the video games page

Battalion Wars Modding

UPDATE: since there's already a WIKI for the Subreddit that contains lot of useful info, I'll just keep a "journal" of what I do that works and doesn't work.
This can be accessed HERE

Contents:

  1. General information
  2. Needed sofwares
  3. How to mod/what to actually modify
  4. Process
  5. The content of the Iso

General informations

If ever you were interested in modding Battalion Wars, start with the Battalion Wars Mod subreddit. Some useful gamefiles can also be downloaded there so you don't need to extract them in the first place.
Battalion Wars (BW) and Battalion Wars 2 (Bwii) are two console games, released for the Gamecube and the Wii.
Currently, modding Battalion Wars is primarily done through the modifying of the gamefiles that can be found in the Iso of the game. The content of the Iso will be talked about in further details below. After having been modified, the Iso can be played on the Dolphin emulator. It is also possible to play on a patched/homebrewed Wii console.

Needed softwares

Currently the needed softwares to comfortably mod the games are:

To go further, you'll also need some stuff to be able to use the various tools Leverno/DebugYoshi programmed for us. Check THIS (his Github page) for a more comprehensive list of what you'll need.
After you've downloaded all that, you'll be able to use the following tools:

How to mod/what to actually modify

What is modified are the files that made up the content of the Iso. The Iso is made of files that can sometimes be modified more or less easily.

Process

The main process is that you extract/export files from the Iso of the game; then you modify them; then you re-import the changed files in the Iso. Then, you play the game in Dolphin and see if it works.

The content of the Iso

If you browse the Iso using one of the afore-mentionned softwares (gcr_v1.0), you'll notice it is made up of three main folders: &&systemdata, Data and MemCard. There are some cool stuff in the Start.dol in &&systemdata, but most files are in Data.
In data everything is pretty much self-explainatory. The files we mod the most are found in CompoundFiles.
For Each levels of the game (including bonus missions), you have 6 files (of which three are .xml files):

Needless to say, the xml files can be easily accessed and modified, all is needed is a text editor (even notepad can do it, but notepad++ is recommanded). The .res file can be browsed through using a hex editor.

2020-05-27: The LUA scripts

Set up

The LUA scripts are the scripts used by the game to run the missions.
The scripts can be modified using a suite of 3 pythons scripts written by Leverno/DebugYoshi. These scripts can be found here. You can use them if you have Python 3.5.4 installed on your computer. Earlier versions of Python (2.x) should work too. Download the .zip file and extract it in a folder somewhere.
In that folder, you'll have 4 things:


If not done already, you can dump all the lua scripts from the original res files using dump_res_scripts.py. You'll have to change a few access path in the script itself, and to have the res files in the same folder.
To actually modify the LUA scripts, you'll need a lua compiler, specifically the version 5.0.2. It's an exe named "luac5.0.2.exe", it should possible to find on the internet.
Once you have the lua compiler, place it in the folder with the other files.
You'll also need to create a folder, which will contain the lua script files you will actually be modifying. Name it lua_files or something.
After that, you'll need to modify Leverno's Python script itself. Open "rebuild_res_scripts.py". Observe the screenshot below. (The code, as usual, is from Leverno/DebugYoshi.)


The stuff you need to change is underlined in RED and numbered 1, 2 and 3 in the screenshot.
1 is the folder you created earlier. 2 is the .res file the modified lua scripts will be sent into. 3 is the name of the new res file which will contain the modified lua scripts.
Place the original (decompiled) lua scripts in the folder you created earlier.
Then... modify the scripts :)
Once done, use rebuild_res_scripts.py to rebuild the res file.
After that, use GameCubeRebuilder to reimport the res files into the game, where the original res files where initially, replacing them. If the re-importing doesn't work, it may be because the res file is heavier than the original (it causes errors due to how the gamecube ISOs work). You can just rebuild the entire ISO image from the ground up and it will work. It takes a bit more time though (a few seconds or minutes IIRC).
The last step is to check is to play the ISO in Dolphin and see if it works.

Things to know about the lua files

For each level there are several lua files. The most important ones are usually EntityInitialise.lua, and Gameflow.lua (when present).
If making a new mission from scratch, it's a good idea to delete every unit on the map (using Leveno's Level Editor) except for one of each type, and then to empty all lua scripts. The content of EntityInitialise.lua should match the ID of the .xml files. Emptying the map and the lua file (to have a clean base) is a necessary but sometimes tedious process that can lead to error. Please be patient.