Title: Play Balancing Mod for HWRM Version: 2.0.0 Author: Mikali Created: 2005/02/25 Updated: 2016/08/02 Homepage: http://isometricland.net/homeworld/homeworld.php Discussion: https://forums.gearboxsoftware.com/t/play-balancing-mod-for-hwrm/1542877 (new) http://forums.relicnews.com/showthread.php?t=57399 (old) ModDB: http://www.moddb.com/mods/play-balancing-mod-for-hwrm ================================================================================ DESCRIPTION This gamerule iterates through a list of ships, comparing the performance of one ship versus the performance of another. Using this method, one can gauge to some degree of accuracy the relative combat strength of each ship versus the others. INSTALLATION Extract the ZIP archive and copy the "DataPlayBalancingHWRM" folder to your "Homeworld Remastered" directory. You will also need to edit your command line in order to get the mod to work properly. This is described in a later section. INSTRUCTIONS This mod is a singleplayer campaign made up of only one level. The game starts with one aggressive CPU player attacking a completely passive CPU opponent. You then iterate through all of Player 2's ships until they all have been defeated. Next, you iterate to Player 1's next ship and reset Player 2 to his first ship, repeating the cycle. When all of Player 1's ship have defeated all of Player 2's ships, the game ends and the results are printed to the log, or to another file on the disk. The goal is to compare the time it takes for Player 1's ship to defeat Player 2's ship with the time it took for Player 2's ship to defeat Player 1's ship. The less time it takes, the more powerful the ship. Some ships don't have any weapons at all and are skipped. A value of "NoAttack" means that one or both ships have no offensive weapon and therefore cannot attack. A value of "TimedOut" means that one or both ships ran out of time before killing all of the opponent's ships. Currently the timeout value is 1 hour. A value of "SameShip" means that the Left and Top Ships are identical, and therefore equal in strength. A value of "Failed" means the calculation has gone wrong somewhere and needs to be fixed. You're going to have to modify your command-line in order to get the mod to run. See the section, below, for an example command-line. Note, that Players 1 and 2 will be doing the actual fighting. You (Player 0) will merely be playing the part of observer. Simply let the game run until it is finished, and it will exit by itself. If you run out of memory first, or if the game should stall for some other reason, just quit the game and modify the configuration settings in "PlayBalancing_Config.lua" so that you can start right where you left off. Make sure to check "HwRM.log" for the results of the previous tests so that you can copy them to somewhere safe. Otherwise, they will be overriden and you will have to start over from scratch. The script outputs the results of each mini-battle to a new line in "HwRM.log". At the end of the game, it also outputs all the cumulative stats to a file called "PBAL_Results.txt" in your player profile directory. If you exit the game early, or if the game crashes, this output file will not be written and you will need to piece together what happened by examining the individual lines in "HwRM.log". If you only run the game in small batches instead of with all of the ships battling all the other ships, you decrease the likelyhood of the game crashing due to lack of memory. On my computer, the game crashes after about 200 mini-battles. But consider that a Vaygr vs Hiigaran and Hiigaran vs Vaygr campaign consists of over 3000 mini-battles. Here are what the individual fields in the generated output mean: • P1_ShipNumber: The index number of player 1's ship in ShipList. • P1_ShipsLeft: The number of player 1's ships left over at the end of the battle. • P1_AvgHealth: The average health of player 1's ships at the end of the battle. • P1_ShipType: The type of player 1's ship. • P1_ResearchList: Any research items applied to player 1's ship. • P2_ShipNumber: The index number of player 2's ship in ShipList. • P2_ShipsLeft: The number of player 2's ships left over at the end of the battle. • P2_AvgHealth: The average health of player 2's ships at the end of the battle. • P2_ShipType: The type of player 2's ship. • P2_ResearchList: Any research items applied to player 2's ship. • RoundTime: The duration of the battle between player 1 and player 2's ships. Or a flag indicating why the duration of the battle was not recorded. You will need to edit your command line settings in order to run this mod. This mod is a singleplayer mod, not multiplayer, so you will need to set the correct campaign and starting level in the command line. At the very least, you should add these flags: "%HWRM%\Bin\Release\Homeworld2.exe" -moddatapath DataPlayBalancingHWRM -campaign PlayBalancing -startingLevel testlevel -overrideBigFile -luaTrace I also recommend that you run the game using the following settings. This is in order to speed things up, as it can take a very long time (an understatement!) to proceed through the whole list of ships. "%HWRM%\Bin\Release\Homeworld2.exe" -moddatapath DataPlayBalancingHWRM -campaign PlayBalancing -startingLevel testlevel -overrideBigFile -luaTrace -superTurbo -windowed -freeMouse -hardwareCursor -quickLoad -noSound -noMovies The -superTurbo switch is probably the most important of these, as it allows you to speed up the game by a factor of about 50. Without it, this sort of testing would require unbearably long periods of time. It is also handy to run teh game in a window using the -windowed switch to make the ALT+TAB between windows easier. Remember that research is cumulative. This means that once it's been granted, it will remain in effect until the game ends. To compensate for this you can test ships in blocks by modifying the starting and ending points for each player. The ship list, as well as other modifiable values, is stored in "PlayBalancing_Config.lua" in your "DataPlayBalancingHWRM" directory. Note that there may be a delay of a few seconds between some rounds, as non-combat- capable ships are skipped when pitted against other non-combat-capable ships. Battles will also time-out after 1 hours (game-time). While running the game you will see some text on the screen: • Index: the place in the global ShipList table that each ship occupies. • Count: the place in the current processing queue that each ship occupies. • Alive: the number of alive ships belonging to Player 1 and Player 2. • Ships: Player 1 and Player 2's ship types. • Research1: Player 1's researches. • Research2: Player 2's researches. • Round Time: the elapsed time in the current mini-battle. • Game Time: the elapsed time since the start of game according to the game. • World Time: the elapsed time since the start of game in real time. Game Time and World Time will be different from each other if you start the game with the -superTurbo command line switch enabled. Otherwise, they will be identical. If you're modifying this mod for your own purposes, remember to remove any spawned salvage from within the .ship files. Search each .ship file for commands that start with "SpawnSalvageOnDeath" and delete those lines. This is necessary in order to keep the game from slowing to a crawl, and hunks of salvage from getting in the way of weapons fire. ================================================================================ ISSUES • Some units will not pursue a target while attacking, or will run away when their health falls too low. These should not be tested against each other. In "PlayBalancing_Config.lua", you should give these ships a "CanAttack" value of zero. • Maybe I should allow "AB_UseSpecialWeaponsInNormalAttack". I'm not really sure, though, what this does, exactly. • I must find a more convenient way of making research non-cumulative (e.g. turning researches on/off via scripting). • If both players have the same ship and that ship has the Capture Abilty, then a player may end up with more ships than he/she started out with. • It used to be that if the game were running for a long enough time, it would start to run out of memory to to the number of ships and salvage. That's why it was so important to delete "SpawnSalvageOnDeath" commands from all the .ship files! I don't know if this is still an issue on modern systems. ================================================================================ CHANGE LOG 2.0.0 --- 2016/08/02 • Updated the mod to work with Homeworld Remastered. This includes the game rule, as well as the ShipList table in "PlayBalancing_Config.lua". • The entries for each race in the "ShipList" table now have text identifiers instead of nnumerical identifiers. • Lots of tweaks to ATI display output. • Lowered TimeOutValue to 1 hours. If it takes longer than this for ships to kill each other, then they're not worth tracking. • The mod now also writes cumulative results to a text file in the player profile directory. This only happens if the game doesn't crash before finishing its task. • Renamed the .level file and mission from "Mission_01" to "testlevel". • The script now skips battles if *either* player's ship does not have an offensive capability, not just the Player 1's ship. • Removed the "SkipDuplicates" parameter. The game now automatically skips battles where both players' ships are identical. • Fixed a bug where Players 1 and 2 were being assigned the wrong races in the level file due to the "player" table being idexed improperly. • Player 2's move ability is now deactivated when Player 1 is set to being invulnerable. • Other tweaks. 1.2.0 • Fixed an error in "PlayBalancing_Config.lua". • The ShipList table in "PlayBalancing_Config.lua" has been collapsed, reordered and extended. • You can now specify a list of research items to be granted, instead of just a single item. • The mod now works properly if the "MakeInvulnerable" parameter is set to 1 (it was broken). • Changed the rule names. • Gun, ion and missile platforms now have their "CanAttack" setting set to 1. • All platforms are now set as deployed. • The number of ships that may be spawned can now be specified individually for each type of ship. • Added the "EnableSpecialAbility" parameter to "PlayBalancing_Config.lua". • Added the "NumberOfPoints" parameter to "PlayBalancing_Config.lua". • Renamed the "DistanceBtwUnits" parameter to "DistanceBtwPoints". • The map now generates positions for each ship in the form of a cube instead of a sphere. 1.1.0 • Fixed an error in "PlayBalancing_Config.lua". • All platforms now have their "CanAttack" setting set to zero. • Changed several parameters in "PlayBalancing_Config.lua". • Added the "MakeInvulnerable" parameter to "PlayBalancing_Config.lua". • Added the "TimeOutValue" parameter to "PlayBalancing_Config.lua". • Removed the background image and music from the map to speed things up a bit and cut down on memory usage. • Increased the delay between rounds to 5 seconds to allow time for errant missiles to fade away. • Now checks whether any ships have been captured, and then destroys those ships. • Now reports the total health percentage of the remaining ships. • Changed the mod to a singleplayer campaign instead of a multiplayer gametype. • Removed spawned salvage from the .ship files. This is necessary in order to keep memory usage down to a minimum. • Added an ATI display showing the current round, the remaining ships and a timer for the current round (in seconds). • Ships are now destroyed at the end of each round instead of despawned (uses less memory). • Set the AI difficulty to level 1 instead of the default level 0. • Other fixes. 1.0.0 --- 2005/02/25 • Initial release.