Jump to content
Game-Labs Forum

"Naval Arms Race" mod overhaul. BETA v11.4 - for UAD v1.5.1.6


o Barão

Recommended Posts

I'm a bit confused why cruisers and sufficiently large destroyers can't lay offensive minefields, but submarines - which carried far fewer mines and had far shorter rangers - can. 

 

Agree that WW1 ASW, such as it was, is very hard to model, unless you also account for submarines making their attacks against merchantmen on the surface, and being too slow to catch warships. The sinking of Aboukir, Hogue and Cressy was situational, as was the success of Austrian submarines in the Med. That was night and day, compared to, say, a Japanese submarine trying to engage a German cruiser in the open waters of the Pacific. 

 

Link to comment
Share on other sites

Ok, I rewrote GetSharedDesign. The existing code did the following:

  • Find all designs of the given ship type and nation
  • Restrict to designs where yearCreated - 3 is less than or equal to desired year, and desired year - 3 is less than or equal to yearCreated
  • Shuffle them into a random order
  • For each ship, if not isEarlySavedShip, make sure the player can build it: It's within tech limits for tonnage, within shipyard tonnage limit, the hull is unlocked and not obsolete, and if a battle it's within shiptype counts.
  • if checkTech, make sure the techs match perfectly.
  • If all that's true, return the design.

 

I rewrote it here: https://github.com/NathanKell/UADRealism/blob/main/TweaksAndFixes/Modified/CampaignControllerM.cs

  • I only discard ships that are more than 10 years in the future. If ships are in the past, if within 5 years they go in the high priority bucket, otherwise the low priority bucket.
  • If there are older ships that are within a few years of the oldest "new" ship, add them to the high priority bucket
  • For each ship, do the same "can build" verification as stock. But for tech, make a smarter assessment.
    • Sort techs into whether they are irrelevant, required, or improvements.
    • Required techs on the ship that the player lacks means the ship is invalid.
    • Improvement techs the player has that the ship doesn't decrease the tech value of the ship.
    • Irrelevant techs are things like unlocking other hulls, or unlocking gun calibers that aren't used on the ship, or unlocking parts not used on the ship. If the ship doesn't have torpedoes, then tube count and torpedo mark upgrades are irrelevant.
    • The final tech store is (required techs / (required techs + improvement techs)
  • Make a bucket of all ships whose tech values are > 0.9. If there's one or more, return a random one. If not, make a bucket of all ships whose tech value is 0.75 or more, and return a random one. EDIT: Based on some quick tests, this is now three buckets, 0.9, 0.75, and 0.5.

Note that the tech value system could lead to a suboptimal design being picked (consider a ship that uses mk2 8 inch guns, when mk4 7in guns are used on a different design), but it should be way the heck better than stock, and let shared designs be used much of the time assuming folks are willing to make a reasonable spread of them for each nation.

An obvious next step would be, when the tech ratio is below a certain value, to attempt a simple refit of the ship to make it better, i.e. use the shared design as a template. Even if all the refit does is apply the latest tech, add radar if available, upgrade the guns and armor and engine, that's pretty simple (although balancing weight will be a pain)--but that would need to be written by hand since the AI designer's refit logic is questionable.

 

Feel free to test. It's build against 1.5.1.6 and should work with any mod (or none), and needs the latest MelonLoader ( https://github.com/LavaGang/MelonLoader ). Once that's installed, stick this dll in (your UAD folder)\Mods: https://github.com/NathanKell/UADRealism/raw/main/TweaksAndFixes/bin/Release/net6.0/TweaksAndFixes.dll 
I left debug spew on, so if you watch the console you'll see what it's doing (the relevance of each tech, the value of each ship, total ships found, etc.)

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

4 minutes ago, o Barão said:

@NathanKell

"Restrict to designs where yearCreated - 3 is less than or equal to desired year, and desired year - 3 is less than or equal to yearCreated"

 

So in theory I can create a design for 1914 and the AI will use it in 1917? Did I understand correctly?

Yes, that's how it always worked. For me, inclusively. Surprised more people haven't noticed this algorythm in shared designs.

Link to comment
Share on other sites

3 hours ago, NathanKell said:

@o Barão given that only took me a few hours to write and it seems to work, any other major pain points you want dealt with? Either on the "change/enhance functionality" side (I plan to tackle per-shiptype component weights next), or on the bug side. I recall you posting at Nick about a recoil issue, I think?

If you can somehow manage to limit how many ships (per nation) can be damaged by mines each turn, that would solve the major issue I have with that mechanic in game. Let's say 2 or 3 ships max.

Sorry if I can't give any feedback atm. I am still abroad, and I will only return around August.

 

Link to comment
Share on other sites

3 minutes ago, o Barão said:

If you can somehow manage to limit how many ships (per nation) can be damaged by mines each turn, that would solve the major issue I have with that mechanic in game. Let's say 2 or 3 ships max.

Sorry if I can't give any feedback atm. I am still abroad, and I will only return around August.

 

No worries!
And sure, I'll look at that this evening. My hunch is it'll be very easy to do.

  • Thanks 1
Link to comment
Share on other sites

On 6/22/2024 at 11:37 AM, LongJohnSilver said:

I don't know why, but for the exact same kind of modification (Ex : scale modification, model change, ...) it will work on some lines, and won't on some others... I tried to find a logical reason to that, but can't find any!

This sometimes happens when editing the "partsmodel" (only happens with this file).

 

When an issue occurs in this file and you can't find why, replace the line you edit with the previous line or the vanilla line, save and start the game. If working properly, then you can edit again and see if it works now.

 

Don't know why, but only happens when editing lines in that file.

  • Thanks 1
Link to comment
Share on other sites

On 6/22/2024 at 8:32 PM, DougToss said:

AI ships are hilariously overgunned. They're building DDs with 3 5 inch guns in 1903

Is there a way to nudge the AI towards realistic and era appropriate designs while still allowing a dedicated player to dedicate resources to researching ahead - with the penalties to research in general that accompany it - and freedom for players to see why 5 inch guns before quick firing would be a terrible armament on the open deck of a 500 tonne destroyer?

You can in theory design all the ships for the AI using the shared design function. If you have the patience.

Link to comment
Share on other sites

On 6/27/2024 at 12:37 AM, DougToss said:

I'm a bit confused why cruisers and sufficiently large destroyers can't lay offensive minefields

It is not a weapon that you want to carry aboard important ships. I could add them to cruisers, but then the AI would most likely use them in all designs. Unrealistic and would hamper even further their design capability and make their ships weaker in battle.

Link to comment
Share on other sites

12 hours ago, XerMGGW-2 said:

Yes, that's how it always worked. For me, inclusively. Surprised more people haven't noticed this algorythm in shared designs.

Well for me is the opposite. That is why the only way for the AI to use the player shared designs in 1890 was to copy and paste them for the years 1897, 1898, 1899.

Link to comment
Share on other sites

5 hours ago, o Barão said:

If you can somehow manage to limit how many ships (per nation) can be damaged by mines each turn, that would solve the major issue I have with that mechanic in game. Let's say 2 or 3 ships max.

Sorry if I can't give any feedback atm. I am still abroad, and I will only return around August.

 

This is not quite as simple as I'd hoped, because the game is actually doing the right thing: it's testing task force position vs mine field radius for positioned task forces, and checking minefields along task forces' paths for moving ones. But it always checks fields in the same order, so if I do the thing you suggest in a hacky way (i.e. just stop after 3 ships damaged) then it will always be the same minefields doing damage. So I probably have to rewrite mine handling. But on the plus side, that does give complete control over how mines behave!

Meanwhile, here's how damage works.

sweeping = (average TF minesweeping value x mine_sweep_prevention) + 1
detectValue = average TF detection value x sweeping
using minefield_fleet_factor from params:
if isWar:
    fleetDetectFactor = minefield_fleet_factor x detectValue x -2
    taskForceTonnageScaled = task force tonnage x 5
otherwise
    fleetDetectFactor = minefield_fleet_factor x detectValue x -2800
    taskForceTonnageScaled = task force tonnage x 0.04

minefieldStrength = Random between fleetDetectFactor and taskForceTonnageScaled x minefieldRadiusKm / detectValue

using minefield_chance_factor from params:
if minefield_chance_factor >= minefieldStrength:
    no damage

otherwise
    shipsDamaged = Reamp minefieldStrength from 0->300000 to 0->10

 

Hopefully this will explain better how to tune things.

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

1 hour ago, DougToss said:

I suppose it would be nice if the devs created a ship class for auxiliaries, like minelayers and sweepers, auxiliary cruisers etc. , freeing up space (and ensuring reasonable designs) for the fleet combatants. 

They...don't have to? Modders can. There's no hardcoding for ship classes like that.

Link to comment
Share on other sites

Really? I had no idea, I assumed the ship classes were hard coded. 

To pivot for a second, what determines the appearances (and appearance dates) of the various guns? I'm playing through France right now, and in 1914 3 and 4 inch guns are using turreted mounts, which I think A) is premature, and B ) given the French hulls, hurts DD, TB, CL armaments because they seem designed to use shielded guns, like their historical counterparts, and aren't designed for turrets.  3 inch guns are mark 4, 4 inch guns are mark 3, I didn't manually prioritize research. 

I admire the research you did into the performance of the guns, sincerely, and I'm not asking for the marks to change in terms of historical performance matching up, I'm just wondering aesthetically, might a review be in order so that guns progress in design "on schedule". 

 

Related to the above, should we be on mark 4 guns by 1910? I thought perhaps the evolution of naval guns was a bit slower, but as you did the research I'm wondering how the game assigns marks, and how you split them up over the dates. 

Loving the latest update, thanks again. 

Edited by DougToss
Link to comment
Share on other sites

17 hours ago, DougToss said:

I suppose it would be nice if the devs created a ship class for auxiliaries...    ...auxiliary cruisers

Already in the game files, but never implemented. I tried to enable them in the past but, it would make the game crash. Never found why.

KbdZ9F4.jpeg

 

  • Thanks 1
Link to comment
Share on other sites

On 6/28/2024 at 6:52 AM, NathanKell said:

....because the game is actually doing the right thing

In theory can be, but in reality what we get is sometimes 30 or even 40 ships from the same nation damaged by mines in a single turn.

Thank you for explaining in details how it works. I will look at the values using and see if I can find a way to work better.

Link to comment
Share on other sites

@NathanKell I remember something very important.

Subs range, the way it works is different from ships. This is not really an issue in vanilla game due to the high unrealistic values being used, however in NAR is a BIG problem.

The issue is the map border. Place any sub in a port in Japan, as an example, and you will see that it is impossible to cross the Pacific Ocean to the other side.

 

If you could find the solution for this issue, it would be amazing.

Link to comment
Share on other sites

9 hours ago, o Barão said:

In theory can be, but in reality what we get is sometimes 30 or even 40 ships from the same nation damaged by mines in a single turn.

Thank you for explaining in details how it works. I will look at the values using and see if I can find a way to work better.

Yeah that's pretty crazy. To be clear I still plan to rewrite the mine stuff for you, I just did that for now to give you something to tide you over until then. :)

 

8 hours ago, o Barão said:

@NathanKell I remember something very important.

Subs range, the way it works is different from ships. This is not really an issue in vanilla game due to the high unrealistic values being used, however in NAR is a BIG problem.

The issue is the map border. Place any sub in a port in Japan, as an example, and you will see that it is impossible to cross the Pacific Ocean to the other side.

 

If you could find the solution for this issue, it would be amazing.

Yeah, just checked the code and it's an obvious bug, it's using the regular Vector3.Distance instead of CampaignMap.Distance. Easy fix.

  • Like 1
  • Thanks 1
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...