Jump to content
Game-Labs Forum

[1.6.0.5] [Code] Tweaks and Fixes v3.8.2: bugfixes, new features for players, support for modders (including new nations and better AI ship generation!)


Recommended Posts

As a break from my larger efforts to rewrite significant chunks of the game around ship design, I decided to make some small tweaks and fixes to deal with some major pain points from players and modders alike. The mod has grown from its beginnings just improving shared design support to now allowing map editing, keeping old-mark guns and torpedo tubes during refits, and adding mark 6+ guns. See the Readme for details on all features.

Installation:

  1. Download MelonLoader and install it, either manually or via its installer. 
  2. Download the TweaksAndFixes.dll and place it in (your UAD directory)\Mods. Create that folder if it doesn't already exist.
  3. Run the game. Note the first launch will take a little while to read the game's assemblies, but subsequent launches will be very fast.

Readme / Docs

Source on GitHub

 

Changelog

  • 3.8.2 - Rewrote per-shiptype component weights for speed. Added support for ai_beamdraughtlimits. See readme for details.
  • 3.8.1 - Fixed some cases where serializing numbers to disk would not serialize in InvariantCulture
  • 3.8.0 - Allow overriding of localization tokens in lng files by placing lng files in the Mods folder. See readme for details.
  • 3.7.3 - [Modder Support] New Feature: read the "surv_min" param in shipTypes. It works like range_min. Rework caliber-limiting feature so it now applies per battery like caliber count limits. Params have changed, see the readme. Recompile for 1.6.0.5 (though that doesn't seem to have been necessary).
  • 3.7.2 - [Modder Support] New Feature: allow replacing the version text in the lower right corner of the screen.
  • 3.7.1 - Allow ai_max_caliber(X) in hull params.
  • 3.7.0 - [Modder Support] New Feature: allow limiting the count of distinct calibers (per battery, i.e. main/secondary/tertiary) the autodesigner will use. Turning this feature on will slow down ship generation slightly. See readme for details.
  • 3.6.0 - Implemented score-based scrapping per suggestion from @XerMGGW-2 where age of ship is weighed against its build time to determine its scrapping score. See updated scrapping section of readme for details.
  • 3.5.4 - Fixed an exception generating armor. No longer allow DD/TB bulkheads to go below the second-highest value when ship generation tweaks are enabled. Fix an issue with Custom Battle flag selection where years were being compared incorrectly (and log error messages when the list of goverments-by-year is formatted incorrectly).  Describe per-shiptype speed params in the readme. Recompile for 1.6.0.4 (no changes seem needed).
  • 3.5.3 - [Modder Support] New Feature: control min and max multipliers (to speedLimiter) for speed for ship types and for hulls. Fixed a bug where secondary turret armor could fail to be clamped to main gun values.
  • 3.5.2 - Fixed an issue with turret armor generation when using the armor generation feature.
  • 3.5.1 - Use invariant culture when parsing numbers. This means . is used for decimals and , as a thousands separator regardless of the user's country. This means that mod files will be loaded consistently.
  • 3.5.0 - Rewrote asset replacing/overriding/extending and fixed some issues parsing double-quotes in CSV files. The feature is now simpler to use as well as much safer and cleaner code.
  • 3.4.9 - [Modder Support] Support overriding as well as replacing the game's TextAssets, i.e. support parts_override.csv as well as parts.csv. See Readme for details.
  • 3.4.8 - Fix some issues with ship generation (including zero turret armor) due to wrong stop conditions when varying speed and armor.
  • 3.4.7 - Fix for 1.6.0.3R
  • 3.4.6 - Rewrote barbette patch, should allow rotation and highlight properly now.
  • 3.4.5 - Fixed a bug in task force mine damaging where it could break on subsequent runs when vessels sunk.
  • 3.4.4 - Reworked barbette patch and fixed crash. Now no part changes are needed; barbettes behave exactly as they used to in terms of hull requirements and what is needed in their mountPoints and params, but they can be placed freely on the deck. The crash with funnels is also fixed. If it's desired to restrict barbettes to the centerline (like the old behavior), put `center` in the barbette's param column.
  • 3.4.3 - [Modder Support] New Feature: when a barbette has `free` in its mountPoints (e.g. "free, si_barbette") then it can mount freely like a gun. Note that it will need excluding from old hulls via adding need/exclude tags to its params.
  • 3.4.2 - Fixed a typo in AdjustHullStats leading to weird initial speeds when manually choosing a hull.
  • 3.4.1 - New Feature: minor tweaks to ship autodesign, including making speed selection saner.
  • 3.4.0 - [Modder Support] New Feature: allow changing the ship armor generation behavior (see readme).
  • 3.3.0 - New Feature: Reimplement some ship autodesign methods, fixing some bugs
  • 3.2.0 - Update to UAD 1.6.0.2
  • 3.1.4 - Performance increase via changing how GameData is patched in the allow-override-csv-files patch
  • 3.1.3 - Fixed highlight color not being assigned for new major nations.
  • 3.1.2 - Typo fix. The ports/province overriding was loading portsDump and provincesDump and writing to ports and provinces. Oops. Fixed the reversal.
  • 3.1.1 - Fixed a bug with config loading
  • 3.1.0 - [Modder Support] New AI fleet scrapping behavior (disabled by default). Also fixed a bug with flags not showing in battle results and fixed a bug override-loading the relations matrix 
  • 3.0.1 - Better fix for the bug where length/diameter and armor settings would be lost from guns when upgrading their mark on refit.
  • 3.0.0 - [Modder Support] New Features: Support Mark 6+ guns, and support loading from csv files in Mods rather than requiring distribution of an entire resource.assets file. See Source link for readme details on these features.
  • 2.5.0 - Fixed a bug where length/diameter and armor settings would be lost from guns when upgrading their mark on refit. Changed serialization behavior to fix some serializer bugs.
  • 2.4.1 - Fixed an issue with map overriding on campaign start. Allow outputting map data (set taf_override_map to 2).
  • 2.4.0 - [Modder Support] when taf_override_map is added to params and set to 1, the ports and provinces TextAssets will be used by the game. This allows for map modding.
  • 2.3.0 - [Modder Support] New Feature: Overriding flags. Just edit a text file and add images and you're good. See here for docs.
  • 2.2.0 - [Modder Support] New Feature: Allow tuning of mine behavior by means of adding params to the params file
  • 2.1.1,2.1.2 - Keep torpedo marks as well, and fix an issue where the AI would keep old marks on refit.
  • 2.1.0 - New feature: Keep gun marks as they are when refitting ships until the player chooses to upgrade them.
  • 2.0.5 (and previous) - improvements to serializer. Supports loading BaseData (i.e. the game's own csv-format serialized data) and supports leaving default values in place if no value specified (managed serializer)
  • 2.0.0 - [Modder Support] New feature: Add a CSV serializer/deserializer which works with managed (rather than Il2Cpp) classes. Code is from my KSP work.
  • 1.3.2 - Enforce setting a part's CaliberInch during game load. Otherwise there's a chance that the first time it's run, it will set the wrong value (based on rounding rather than flooring the caliber), leading to, say, a 5.7in gun being treated as a 6in instead of 5in for stats/grade (mark) purposes.
  • 1.3.1 - Fix typos in RandPart listings. Stock has a few of these, but the fix here will also fix most mods' typos if there are typos there too.
  • 1.3.0 - When 1890 is selected in the Shared Designs constructor, only 'start' techs will be available, not techs that, while dated 1890, must be unlocked in campaign. This makes it so that the player can create shared designs the AI will use when starting an 1890 campaign.
  • 1.2.2 - Fixed a bug with shared designs where ships would not be properly erased during selection
  • 1.2.1 - Make shared design selection outside of campaign depend only on year, since tech matching is less reliable here (the game doesn't do it at all, for example).
  • 1.2.0 - [Modder Support] New Feature: Added tunable conquest (with bugfix)
  • 1.1.0 - New Feature: Added submarine movement range fix
  • 1.0.0 - Initial release. Better shared design handling, per-shiptype component weights
Edited by NathanKell
  • Like 8
Link to comment
Share on other sites

This has made 1890 champion go from not using shared design to now using them. Just does load some that it can't build. Is that to use them when it gets the techs? Thanks for your work.

Link to comment
Share on other sites

  • NathanKell changed the title to [1.5.1.6] [Code] Tweaks and Fixes v1.1.0: Better Shared Design handling, fixed sub range checks, per-shiptype component weights, tunable conquest, more to come.

Hi can you check if something is wrong with AI? I noticed since 1.5.1.5 that some ships are totally braindead.

For example if you have DD as non flagship divisions they will sail straight forward past the enemy and wont ever do anything. This happens for Player AI and Enemy divisions when set to Battle Line/Sail mode.

Workaround is ofc to use Screen/Scout but once the flagship division is gone you get the same problem.

Link to comment
Share on other sites

  • NathanKell changed the title to [1.5.1.6] [Code] Tweaks and Fixes v1.2.1: Better Shared Design handling, fixed sub range checks, per-shiptype component weights, tunable conquest, more to come.

Not letting me upload. Just design some shared designs and start a campaign using shared designs always and auto-build fleet. Note what ship count each country has including player fleet. Quit game and reload campaign. Happens every time no matter what country

Link to comment
Share on other sites

Looks like ships in fleet tab gets moved to design tab and creates a design for each one. Can't upload screenshots as hit upload limit.

 

 

Edited by huntsc
Link to comment
Share on other sites

2 hours ago, huntsc said:

Looks like ships in fleet tab gets moved to design tab and creates a design for each one. Can't upload screenshots as hit upload limit.

 

 

Found and fixed an issue that I assume is related, and can't repro what you're describing, so I think it's sorted now.

Link to comment
Share on other sites

10 hours ago, Astor said:

Hi can you check if something is wrong with AI? I noticed since 1.5.1.5 that some ships are totally braindead.

For example if you have DD as non flagship divisions they will sail straight forward past the enemy and wont ever do anything. This happens for Player AI and Enemy divisions when set to Battle Line/Sail mode.

Workaround is ofc to use Screen/Scout but once the flagship division is gone you get the same problem.

At some point I can look into the AI but that's going to be an awful lot of work.

Link to comment
Share on other sites

On 6/29/2024 at 8:11 AM, huntsc said:

This has made 1890 champion go from not using shared design to now using them. Just does load some that it can't build. Is that to use them when it gets the techs? Thanks for your work.

I believe this is a symptom of the other issue you described, since I have not been able to repro this either now.

Link to comment
Share on other sites

  • NathanKell changed the title to [1.5.1.6] [Code] Tweaks and Fixes v1.3.0: Better Shared Design handling, fixed sub range checks, per-shiptype component weights, tunable conquest, more to come.
On 6/28/2024 at 2:44 AM, NathanKell said:

[Modder feature] Per-shiptype component weights. In the params column of the component data, you can add weight_per(bb;5;ca;10;dd;0...). Components with weight 0 or less won't be available at all for that ship type. Any shiptypes not covered by that param will use the component's normal weight. Note that the syntax is important, it's a series of pairs of <shiptype>;<weight>. Also, note that the availability affects the player as well as the AI, so you can for example add a special early turbine that is only available to TB and DD (to represent how they were used on light craft much earlier than on larger ships). Indeed you can have completely disjoint sets of components for each ship type if you really want to put in the work. Example: main_engine_4_early,,engine,$component_name_short_main_engine_4,1,$technology_name_engine_engine_5,$technology_desc_engine_engine_5,weight_per(tb;24;dd;24;bb;0;bc;0;ca;0;cl;0;ic;0;tr;0;amc;0;xx;0),

Is this weight as in selection weighing or the actual physical weight of the component once mounted?

Link to comment
Share on other sites

4 hours ago, SpardaSon21 said:

Is this weight as in selection weighing or the actual physical weight of the component once mounted?

Selection weighting, the weight column in components TextAsset. Components don't have discrete weights, they have stats (like +x% hull weight).

Link to comment
Share on other sites

  • NathanKell changed the title to [1.5.1.6] [Code] Tweaks and Fixes v2.0.0: Better Shared Design handling, fixed sub range checks, per-shiptype component weights, tunable conquest, more to come.
  • NathanKell changed the title to [1.5.1.6] [Code] Tweaks and Fixes v2.1.0: Keep old-Mark guns on Refit, Better Shared Design handling, fixed sub range checks, and more

Added a feature where the gun mark for a particular caliber of gun is saved with the ship, so when the player refits that ship they get to choose whether to upgrade the gun to the current mark or not.

 

Example from when I was testing in Shared Designer:

image.png?ex=66a7b67c&is=66a664fc&hm=355367d967723af421cf533ec58f372286430a25d4b02bc7cf34ad84406fec31&=

Link to comment
Share on other sites

  • NathanKell changed the title to [1.5.1.6] [Code] Tweaks and Fixes v2.1.0: Keep old-Mark guns/torps on Refit, Better Shared Design handling, fixed sub range checks, and more
  • NathanKell changed the title to [1.5.1.6] [Code] Tweaks and Fixes v2.1.2: Keep old-Mark guns/torps on Refit, Better Shared Design handling, fixed sub range checks, and more
  • NathanKell changed the title to [1.5.1.6] [Code] Tweaks and Fixes v2.2.0: Keep old-Mark guns/torps on Refit, Better Shared Design handling, fixed sub range checks, and more
Posted (edited)

image.png.2ecb5809703abcc811cb6750e1d5e951.png

Oh hey look it's custom flags!

 

Docs: Create a folder in Mods called Flags, and put your flags there. Then create a file called flags.csv in Mods. Here's an example one:

#player name,default civil flag filename,default naval jack filename, per-government flags for civil,for naval
# the government types used by the game are: Monarchy, Democracy, Communists, Fascists
# so for example:
#   britain,britain.png,britain.png,"Communists(britainCommunist.png), Democracy(britainRepublic.png)",
# note that flags can be either PNG (no alpha channel) or JPG, and must be 256x128 pixels
@name,civilFlag,navalFlag,civilGovFlags,navalGovFlags
britain,britain.png,britain.png,,

Assuming you put a 256x128 png called `britain.png` in the Flags folder under Mods, then Britain's flag will be replaced in all instances by that new png. If you followed the commented example instead, then Britain's flag would be replaced by brtain.png except for its civil flag when government is communist (which would be britainCommunist.png) and when a democracy (which would be britainRepublic.png).

 

Note that you can do this for any player, not just majors, although only majors have government-specific flags.

Edited by NathanKell
  • Like 2
Link to comment
Share on other sites

  • NathanKell changed the title to [1.5.1.6] [Code] Tweaks and Fixes v2.3.0: Keep old-Mark guns/torps on Refit, Better Shared Design handling, Custom Flags, fixed sub range checks, and more

Just gonna add quick. I am using your TaF on 1.6upd5 and as far as I can tell all works fine.

Love the per ship weights and conquest and mines you've added for us to mod. I also played around with flags and all good

Link to comment
Share on other sites

  • NathanKell changed the title to [1.5.1.6] [Code] Tweaks and Fixes v2.4.0: Keep old-Mark guns/torps on Refit, Map modding, Better Shared Design handling, Custom Flags, fixed sub range checks, and more
Posted (edited)

Ok, map modding is in. Set `taf_override_map` to 1 in params and TAF will apply the contents of the ports and provinces TextAssets to the map.

Note that there is no guarantee that what is in those files in the stock game is actually what's in the map in the stock game, so it's up to modders to make sure the values are as desired. If you start a 1890 save with TAF not running and save, you should get default values for the ports and provinces in your save file.

Edited by NathanKell
  • Like 1
Link to comment
Share on other sites

1 hour ago, NathanKell said:

Ok, map modding is in. Set `taf_override_map` to 1 in params and TAF will apply the contents of the ports and provinces TextAssets to the map.

Note that there is no guarantee that what is in those files in the stock game is actually what's in the map in the stock game, so it's up to modders to make sure the values are as desired. If you start a 1890 save with TAF not running and save, you should get default values for the ports and provinces in your save file.

Ok. So i added this to "params" like any of the other parameters
taf_override_map,1,,,,,,,,
and my personal "new nation" resources file, including flags, and norwegian provinces set to "1, Home"
when creating a new game I immidiately get the message
"[13:24:55.332] [UnityExplorer] [Unity] KeyNotFoundException: The given key was not present in the dictionary."

However, if I create a new game with taf_override_map,,,,,,,,, (without the 1) it creates a new game fine;
[13:26:49.163] [UnityExplorer] [Unity] missing param 'taf_override_map' (using default '0')

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...