Jump to content
Game-Labs Forum

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


Recommended Posts

Posted (edited)

I just reimplemented AdjustHullStats, GenerateArmor, AddedAdditionalTonnageUsage, and ReduceWeightByReducingCharacteristics. That means (cc @o Barão ) that we can have the ship generator do whatever we like with armor or speed (or how much tonnage is allocated to one vs the other).

Suggestions on how you'd like to control this? What sort of instructions would you like to give? Per-shiptype prioritization of armor vs speed? Relative armor prirorites? (My model of how to do armor is essentially to determine a balance between belt and deck based on year, and then make fore/aft a fixed percentage of main for belt and deck, and maximize citadel if available. Probably want to add some randomness however?)

 

In other news, I benchmarked starting a new campaign (which is to say, an awful lot of ship generation) and it took about the same amount of time as without the mod. So I think the slowdown was mostly from logging too much.

 

Oh yeah, and while I was reimplementing that code, I fixed a handful of random bugs in it. There were quite a few.

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

4 hours ago, NathanKell said:

Suggestions on how you'd like to control this?

o7!! Great additions!!

The most important thing would be the armor values per each ship class/per decade/ ship section, with a minimum and maximum value (destroyer and torpedo boat don't need these modifiers)

So as an example, only for BBs between 1890-1900

  • Belt armor, minimum, maximum
  • extended belt armor, minimum, maximum
  • Deck armor, minimum, maximum
  • Deck armor extended, minimum, maximum

With this being the set, what the AI does with the remaining hull tonnage is not an issue anymore. Can use to have more speed or more guns. A little freedom is not bad (I already set the minimum guns value per each hull anyway). Only the armor values is important.

 

But I would need these modifiers per each decade, and for each ship (BB, BC, CA, CL), a long list and crazy to implement I guess.

 

4 hours ago, NathanKell said:

In other news, I benchmarked starting a new campaign (which is to say, an awful lot of ship generation) and it took about the same amount of time as without the mod. So I think the slowdown was mostly from logging too much.

I tested a few custom battles and was much better now 😁. I didn't try to start a new campaign yet. I want to speak about that with you later, but tomorrow I am going to return to Europe and I will have a busy week. I started to working to add a minor nation, but I face a few issues. There are also a few new modifiers options you added to the "params" file that I will need a little help about how they can be implemented.

 

Great work you are doing, again many thanks. :)

 

  • Like 2
Link to comment
Share on other sites

Q: Are you able to write something to reduce the amount of "flaws"? sometimes a ship can have 2 dozens of flaws, where over half is in the area of 0-0.5% (yes, zero, probably cause of only showing one decimal, while we know the files often have 4-5 decimals).

Maybe something to have a max amount of ship/tech flaws, tops 5 of each? so 10 total, and perhaps round numbers/no decimals. The tooltip is an utter mess sometimes.

Edit: Hm, I see there is a "hide" param in the stats-resources.assets. Irreleveant to my request/question, it was more an observation.

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

Posted (edited)
17 hours ago, o Barão said:

o7!! Great additions!!

The most important thing would be the armor values per each ship class/per decade/ ship section, with a minimum and maximum value (destroyer and torpedo boat don't need these modifiers)

So as an example, only for BBs between 1890-1900

  • Belt armor, minimum, maximum
  • extended belt armor, minimum, maximum
  • Deck armor, minimum, maximum
  • Deck armor extended, minimum, maximum

With this being the set, what the AI does with the remaining hull tonnage is not an issue anymore. Can use to have more speed or more guns. A little freedom is not bad (I already set the minimum guns value per each hull anyway). Only the armor values is important.

 

But I would need these modifiers per each decade, and for each ship (BB, BC, CA, CL), a long list and crazy to implement I guess.

 

I tested a few custom battles and was much better now 😁. I didn't try to start a new campaign yet. I want to speak about that with you later, but tomorrow I am going to return to Europe and I will have a busy week. I started to working to add a minor nation, but I face a few issues. There are also a few new modifiers options you added to the "params" file that I will need a little help about how they can be implemented.

 

Great work you are doing, again many thanks. :)

 

Thanks!
And as to the armor stuff--this is done now in 3.4. You can add a file named genarmordata.csv to Mods. The format is (note all thicknesses are inches):

shipType,year,beltMin,beltMax,beltExtendedMult,turretSideMult,barbetteMult,deckMin,deckMax,deckExtendedMult,turretTopMult,ctMin,ctMax,superMin,superMax,foreAftVariation,citadelMult
bb,1890,9,14,0.5,1.1,1,2,2.5,0.5,1.2,10,15,2,4,0.1,1
bb,1940,10,15,0.5,1.2,1,5,8,0.5,1.2,10,15,2,4,0,1

Docs: TAF supports replacing the game's existing armor generating, both the defaults when switching to a new hull and the armor the auto designer creates for ships. It works by constraining armor based on a set of rules which are per-shiptype and vary by year. If the design year is between two rules, the values are interpolated between the rules that exist. If the year lies outside the rules, the nearest rule is used. For example, consider a ruleset with a battleship rule for year 1900 and a battleship rule for 1920. Any battleship designed before 1900 would use the 1900 rule, any battleship designed after 1920 would use the 1920 rule, and a battleship designed in 1915 would use numbers 3/4 of the way from the 1900 rule to the 1920 rule. In the above example (the 1890 and 1940 bb rules), a battleship designed in 1905 would have a minimum deck thickness of 2.9 inches (30% of the way from 2 inches to 5 inches). Its fore and aft decks would have default minimum thicknesses of 1.5 inches.

turretSideMult is the multiplier to belt armor used as the default for turrets. barbetteMult also uses belt as its base value, but turretTopMult uses deck. The belt/deckExtendedMult values are multipliers to belt and deck used by fore/aft belt and deck areas respectively. citadelMult is the portion of maximum possible citadel armor used. foreAftVariation is the maximum multiplier to fore/aft armor by which that armor can vary, so a value of 0.02 means the fore armor can be up to +/-2% as thick as default, and aft armor can be up to -/+2% as thick as default.

If no rules are specified for a shiptype, the game's original behavior (well, with my bugfixes) will be used. But if at least one rule for that shiptype is specified, it will be used, so if you only specify an 1890 rule, it'll be used even in 1940. So I suggest at the minimum specifying an 1890 and 1940 rule, so TAF can interpolate between them.

ct is conning tower and super is superstructure, in case that wasn't clear.

 

If you really want to be able to specify this in shipTypes's params, I can do that, but it will be extremely messy and I highly recommend using this format. Because I'd have to cram all that data in there so it would look something like, for a bb's params in the example above:

armordata_1890(9;14;0.5;1.1;1;2;2.5;0.5;1.2;10;15;2;4;0.1;1), armordata_1940(...)

and the parsing would be extremely fragile and susceptible to errors.

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

14 hours ago, MDHansen said:

Q: Are you able to write something to reduce the amount of "flaws"? sometimes a ship can have 2 dozens of flaws, where over half is in the area of 0-0.5% (yes, zero, probably cause of only showing one decimal, while we know the files often have 4-5 decimals).

Maybe something to have a max amount of ship/tech flaws, tops 5 of each? so 10 total, and perhaps round numbers/no decimals. The tooltip is an utter mess sometimes.

Edit: Hm, I see there is a "hide" param in the stats-resources.assets. Irreleveant to my request/question, it was more an observation.

Fun fact: as far as I can tell, base_flaws_chance has no effect on flaws--it's divided out in the flaw chance math every single time it's used (the math is, chance = random(0.5 to 1.0) times base chance times flaws tech reduction divided by base chance). So basically there's no actual way to control the prevalence of flaws other than by using a non-0 `flaws` value in even the starting tech, and you're also guaranteed to have between 50% and 100% of that chance, every time.

  • Like 1
Link to comment
Share on other sites

  • NathanKell changed the title to [1.6] [Code] Tweaks and Fixes v3.4.0: Mark 6+ guns, Keep old-Mark guns/torps on Refit, Map modding, Better Shared Design handling, Custom Flags, redone scrapping behavior, fixed sub range checks, and more

Right. Thanks for the feedback. For the base_flaw_chance I gathered it worked that way. Might just tweak the "stats" file and reduce the general flaws chance in params. Should clean it up a little

Link to comment
Share on other sites

41 minutes ago, MDHansen said:

Right. Thanks for the feedback. For the base_flaw_chance I gathered it worked that way. Might just tweak the "stats" file and reduce the general flaws chance in params. Should clean it up a little

But that's exactly what I said wouldn't work. `base_flaws_chance` _is_ the thing in params, and it does absolutely nothing.

Link to comment
Share on other sites

  • NathanKell changed the title to [1.6] [Code] Tweaks and Fixes v3.4.1: Mark 6+ guns, Keep old-Mark guns/torps on Refit, Map modding, Better Shared Design handling, Custom Flags, redone scrapping behavior, fixed sub range checks, and more
5 hours ago, NathanKell said:

Thanks!
And as to the armor stuff--this is done now in 3.4. You can add a file named genarmordata.csv to Mods. The format is (note all thicknesses are inches):

shipType,year,beltMin,beltMax,beltExtendedMult,turretSideMult,barbetteMult,deckMin,deckMax,deckExtendedMult,turretTopMult,ctMin,ctMax,superMin,superMax,foreAftVariation,citadelMult
bb,1890,9,14,0.5,1.1,1,2,2.5,0.5,1.2,10,15,2,4,0.1,1
bb,1940,10,15,0.5,1.2,1,5,8,0.5,1.2,10,15,2,4,0,1

Docs: TAF supports replacing the game's existing armor generating, both the defaults when switching to a new hull and the armor the auto designer creates for ships. It works by constraining armor based on a set of rules which are per-shiptype and vary by year. If the design year is between two rules, the values are interpolated between the rules that exist. If the year lies outside the rules, the nearest rule is used. For example, consider a ruleset with a battleship rule for year 1900 and a battleship rule for 1920. Any battleship designed before 1900 would use the 1900 rule, any battleship designed after 1920 would use the 1920 rule, and a battleship designed in 1915 would use numbers 3/4 of the way from the 1900 rule to the 1920 rule. In the above example (the 1890 and 1940 bb rules), a battleship designed in 1905 would have a minimum deck thickness of 2.9 inches (30% of the way from 2 inches to 5 inches). Its fore and aft decks would have default minimum thicknesses of 1.5 inches.

turretSideMult is the multiplier to belt armor used as the default for turrets. barbetteMult also uses belt as its base value, but turretTopMult uses deck. The belt/deckExtendedMult values are multipliers to belt and deck used by fore/aft belt and deck areas respectively. citadelMult is the portion of maximum possible citadel armor used. foreAftVariation is the maximum multiplier to fore/aft armor by which that armor can vary, so a value of 0.02 means the fore armor can be up to +/-2% as thick as default, and aft armor can be up to -/+2% as thick as default.

If no rules are specified for a shiptype, the game's original behavior (well, with my bugfixes) will be used. But if at least one rule for that shiptype is specified, it will be used, so if you only specify an 1890 rule, it'll be used even in 1940. So I suggest at the minimum specifying an 1890 and 1940 rule, so TAF can interpolate between them.

ct is conning tower and super is superstructure, in case that wasn't clear.

 

If you really want to be able to specify this in shipTypes's params, I can do that, but it will be extremely messy and I highly recommend using this format. Because I'd have to cram all that data in there so it would look something like, for a bb's params in the example above:

armordata_1890(9;14;0.5;1.1;1;2;2.5;0.5;1.2;10;15;2;4;0.1;1), armordata_1940(...)

and the parsing would be extremely fragile and susceptible to errors.

Great stuff! Thanks😊 👍

  • Like 1
Link to comment
Share on other sites

3 hours ago, NathanKell said:

But that's exactly what I said wouldn't work. `base_flaws_chance` _is_ the thing in params, and it does absolutely nothing.

I'll put that on reading this inbetween stuff at work lol right. I get it :D

  • Like 1
Link to comment
Share on other sites

  • NathanKell changed the title to [1.6] [Code] Tweaks and Fixes v3.4.3: Mark 6+ guns, Keep old-Mark guns/torps on Refit, Map modding, Better Shared Design handling, Custom Flags, redone scrapping behavior, fixed sub range checks, and more

I just got this message (ML logs) after a crash during a turn.

System.NullReferenceException: Object reference not set to an instance of an object.
   at TweaksAndFixes.MinesFieldManagerM.DamageTaskForce(MinesFieldManager _this, TaskForce taskForce, Player mineFieldOwner, Single minefieldRadiusKm, Single damageMultiplier)
   at DMD<Il2Cpp.MinesFieldManager::DamageTaskForce>(MinesFieldManager this, TaskForce taskForce, Player mineFieldOwner, Single minefieldRadiusKm, Single damageMultiplier)
   at (il2cpp -> managed) DamageTaskForce(IntPtr , IntPtr , IntPtr , Single , Single , Il2CppMethodInfo* )

  • Like 1
Link to comment
Share on other sites

18 minutes ago, MDHansen said:

I just got this message (ML logs) after a crash during a turn.

System.NullReferenceException: Object reference not set to an instance of an object.
   at TweaksAndFixes.MinesFieldManagerM.DamageTaskForce(MinesFieldManager _this, TaskForce taskForce, Player mineFieldOwner, Single minefieldRadiusKm, Single damageMultiplier)
   at DMD<Il2Cpp.MinesFieldManager::DamageTaskForce>(MinesFieldManager this, TaskForce taskForce, Player mineFieldOwner, Single minefieldRadiusKm, Single damageMultiplier)
   at (il2cpp -> managed) DamageTaskForce(IntPtr , IntPtr , IntPtr , Single , Single , Il2CppMethodInfo* )

Thanks I'll look this evening to see what it might be.

  • Like 1
Link to comment
Share on other sites

weird things. after I got that message, I can't reload the savegame nor create a new game. it crashes as soon as it starts on "january <year>". nothing in the logs. Once I remove the TaF3.4.3.dll or replace it with the former version it works fine.

I've triple checked my latest edited files, but can't see anything wrong either

Edit: actually, something is happening, related or not. It creates 1 or 2 ships before it crashes that are seriously out of bounds. One was 638t of 17500/20500, and others where a few thousand out of bounds aswell.
Edit2: I continued a save upgrading from 3.4.1. to 3.4.3., so might be a reason it didnt immidiately crash before after a few turns when I got the mine related crash. And after that I couldn't load the savegame or create a new.
Edit3: lol, well running it with 3.4.1. isn't better, bounds wise;
[19:24:20.676] [UnityExplorer] [Unity] for ship 'KR-1' tonnage 9.84967 is out of bounds 700/1100, clamped. Just a curiosity more than anything else :D

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

33 minutes ago, MDHansen said:

weird things. after I got that message, I can't reload the savegame nor create a new game. it crashes as soon as it starts on "january <year>". nothing in the logs. Once I remove the TaF3.4.3.dll or replace it with the former version it works fine.

I've triple checked my latest edited files, but can't see anything wrong either

Edit: actually, something is happening, related or not. It creates 1 or 2 ships before it crashes that are seriously out of bounds. One was 638t of 17500/20500, and others where a few thousand out of bounds aswell.
Edit2: I continued a save upgrading from 3.4.1. to 3.4.3., so might be a reason it didnt immidiately crash before after a few turns when I got the mine related crash. And after that I couldn't load the savegame or create a new

Is this true even if you don't change barbettes in your parts asset? Because changing them in the parts file so they can be placed freely without restricting them to hulls will result in the AI placing them on all hulls.

 

19 minutes ago, MDHansen said:

on a different topic. is it possible to dl earlier versions of the TaF? I am not so familiar with github

Go here: https://github.com/NathanKell/UADRealism/commits/main/TweaksAndFixes/bin/Release/net6.0/TweaksAndFixes.dll
Find the version you want. Click the middle button ("view code at this point") on the right for that version. Then click Raw to download the dll as raw binary.

  • Like 1
Link to comment
Share on other sites

8 minutes ago, NathanKell said:

Is this true even if you don't change barbettes in your parts asset? Because changing them in the parts file so they can be placed freely without restricting them to hulls will result in the AI placing them on all hulls.

I changed a few select barbettes with need(allowfreebarbettes) and added freebarbettes to all but the oldest battleships.
Also tried without changing barbettes. still crashes

Link to comment
Share on other sites

Having an issue on 1.6.0.3 Live R with a Crash to Desktop upon attempting to create a new campaign.  I am very confident that I followed the install instructions correctly as I see Melon Loader's CMD and splash screen upon the game start.


Settings used to  replicate:

United States
Starting Year: 1890
Difficulty: Normal
AI Opponent: Historical
Fleet: Create Own
AI Shared Designs: Selective/Off

At this point, upon clicking Start Campaign, after a couple of seconds where the screen shows January 1885... music stops and the game crashes.

Please note that this happens both with vanilla and with the Dreadnought Improvement Project mod installed so I know it is not a mod conflict.

Is there anything else I need to check or configure?


EDIT:  Looks like the flag file is for custom flags and is optional so I doubt it is the source of my issues.

The only thing that catches my attention is during initial load of the game, the Melon Loader CMD states the following:
[TweaksAndFixes] Failed to find Flags file <censored path>/Mods/flags.csv

Is there a file that I am missing?


 

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

5 hours ago, Suribachi said:

Having an issue on 1.6.0.3 Live R with a Crash to Desktop upon attempting to create a new campaign.

Is there anything else I need to check or configure?

 

Nathan is on it. Go back to the former TaF version, works fine.

Go here: https://github.com/NathanKell/UADRealism/commits/main/TweaksAndFixes/bin/Release/net6.0/TweaksAndFixes.dll

Find the version you want. Click the middle button ("view code at this point") on the right for that version. Then click Raw to download the dll as raw binary.

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

  • NathanKell changed the title to [1.6] [Code] Tweaks and Fixes v3.4.4: Mark 6+ guns, Keep old-Mark guns/torps on Refit, Map modding, Better Shared Design handling, Custom Flags, redone scrapping behavior, fixed sub range checks, and more

Released a fix (and some improvements) to the barbette patch. Turns out for some reason the game really does crash if a certain method (that determines that barbettes/funnels/towers get forced to the centerline) gets patched...but only for funnels, not for barbettes and towers. I figured out a different workaround and that let me (a) fix the crash, and (b) changing the part file is no longer needed for the barbette change.

  • Like 1
Link to comment
Share on other sites

16 hours ago, MDHansen said:

I just got this message (ML logs) after a crash during a turn.

System.NullReferenceException: Object reference not set to an instance of an object.
   at TweaksAndFixes.MinesFieldManagerM.DamageTaskForce(MinesFieldManager _this, TaskForce taskForce, Player mineFieldOwner, Single minefieldRadiusKm, Single damageMultiplier)
   at DMD<Il2Cpp.MinesFieldManager::DamageTaskForce>(MinesFieldManager this, TaskForce taskForce, Player mineFieldOwner, Single minefieldRadiusKm, Single damageMultiplier)
   at (il2cpp -> managed) DamageTaskForce(IntPtr , IntPtr , IntPtr , Single , Single , Il2CppMethodInfo* )

Fixed in 3.4.5. Thanks!

  • Like 1
Link to comment
Share on other sites

  • NathanKell changed the title to [1.6] [Code] Tweaks and Fixes v3.4.5: Mark 6+ guns, Keep old-Mark guns/torps on Refit, Map modding, Better Shared Design handling, Custom Flags, redone scrapping behavior, fixed sub range checks, and more
14 hours ago, MDHansen said:

weird things. after I got that message, I can't reload the savegame nor create a new game. it crashes as soon as it starts on "january <year>". nothing in the logs. Once I remove the TaF3.4.3.dll or replace it with the former version it works fine.

I've triple checked my latest edited files, but can't see anything wrong either

Edit: actually, something is happening, related or not. It creates 1 or 2 ships before it crashes that are seriously out of bounds. One was 638t of 17500/20500, and others where a few thousand out of bounds aswell.
Edit2: I continued a save upgrading from 3.4.1. to 3.4.3., so might be a reason it didnt immidiately crash before after a few turns when I got the mine related crash. And after that I couldn't load the savegame or create a new.
Edit3: lol, well running it with 3.4.1. isn't better, bounds wise;
[19:24:20.676] [UnityExplorer] [Unity] for ship 'KR-1' tonnage 9.84967 is out of bounds 700/1100, clamped. Just a curiosity more than anything else :D

I tried generating some AI designs and it worked (on 3.4.5). Please let me know if you encounter any more busted designs.

  • Like 1
Link to comment
Share on other sites

Looks good so far. made a new game, played about 50 turns. Also made a "genarmordata" with 6 variations (3 bb & 3 bc). made a lot of ships. AI is making a lot of ships. TF's being hit by mines here and there, no crashes.

There is the way out of bounds ships being made though. This might be a vanilla issue ofcourse. CL/CA being several thousand tonnes out of bounds (under minimum tonnage for design), some bb/bc aswell, but not as much.

Edited by MDHansen
Link to comment
Share on other sites

15 minutes ago, XerMGGW-2 said:

Speaking about barbettes yet again, many people would probably yearn for ability to be able to rotate them using R and T, which the tweaks take away. Do you assume you can return it pretty please?

The current version shouldn't be taking that away? I changed the way I handle things to try to avoid that. If it's not reliable I'll try to fix this evening.

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...