Homeworld 2 Mod Companion(HW2MC) is a set of tools intended to enhance a mod project for Homeworld 2. It has various ambitions beyond the present, but it's current developed capability is reading a mod's data files and generating a HTML reference document from them.

The program was originally designed with the Homeworld:@ mod in mind. As such parts of the system are built around some of that mod's peculiarities, and some of that mod's data is still hard-coded. Making the program more general without breaking any functionality is an ongoing effort.

HW2MC requires Ruby with the sqlite3 and Nokogiri gems installed. It also requires lua4.0. Newer versions of lua have not been tested but probably won't work. Ruby 1.9.x is recommended, later versions have compatability issues.

Code style is regrettably inconsistent. Variable names are being converted to snake_case. Function names will remain CamelCase. The database column names are generally based on HW2 engine value names, which are wildly inconsistent in style.

This project uses the MIT license. See for details.


This tool works more cleanly if you have a tidy naming structure for all your ships, following the convention of [faction abreviation][shipname]. If you use the single-race method, the expected format is [prefix][faction abreviation]_[shipname].


Slave weapons

Due to how HW2 handles weapons with mutliple linked barrels, it is impossible to calcualte the exact total of a ship's firepower without reading the .hod file it uses, which is outside the scope of this code. A mod can be adapted to work better with the companion by putting a table of slave-weapon names in the ship files, one weapon entry for each slaved barrel. This data will be ignored by the game and not impede mod playability

  • NewShipType.slaves={"unh_ftigun"}