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

so to summarize, for clarity

started a new game with flags and all my edits to a new nation, and taf_override_map,0
as expected no home population, no crew, no army. Flags work
quit the game, added taf_override_map,1 and rebooted the game and save
I now have a home population and army consistent of the percentage of the home population. Crew is still -2billions BUT increasing Crew training and crew goes in to +xxx
quit to main menu, opened save file, set crew to 5000 and reloaded the save
win

  • Like 1
Link to comment
Share on other sites

6 hours ago, MDHansen said:

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')

so regards to this. Doing it this way messes up the ports. Once I redo the taf_override_map to 1 and load the savegame, all ports are showing 0/0t and wont increase. Unsure if its just a visual bug, since an invasion was still taking 6 turns for a large port invasion. Though putting a single DD in my port would show them being over dock limit.

So back to the KeyNotFoundExcept, is it a typo in your coding? it creates a new game if I have taf_override_map,0 or taf_override_map, , but once I replace it with the 1, it fails

This is way out of my league for now, so hopefull you have an swer to this :)

  • Like 1
Link to comment
Share on other sites

30 minutes ago, MDHansen said:

so regards to this. Doing it this way messes up the ports. Once I redo the taf_override_map to 1 and load the savegame, all ports are showing 0/0t and wont increase. Unsure if its just a visual bug, since an invasion was still taking 6 turns for a large port invasion. Though putting a single DD in my port would show them being over dock limit.

So back to the KeyNotFoundExcept, is it a typo in your coding? it creates a new game if I have taf_override_map,0 or taf_override_map, , but once I replace it with the 1, it fails

This is way out of my league for now, so hopefull you have an swer to this :)

I'll take a look this evening. I didn't get to do anything more than smoke testing last night. My guess is there's something different in the load order when starting a new game. If I instrument enough stock methods I'm sure I'll figure it out.

  • Like 1
Link to comment
Share on other sites

👍

A little addon, curious thing. All minor ports increase tonnage per turn, some majors doesn't (Britain, France, Germany, Spain and Russia), and my own (Norway) increases per turn. I also can't set my new nations overlay colour. The nation colour (<nation> in events and such) is fine. As you say, there is probably more pies to hook up :)

Thanks for all your efforts in this

  • Like 1
Link to comment
Share on other sites

why cant I edit my own post... goddammit.

Anyhoo, I had a look at the savefile. All the ports belonging to nations where the port doesn't increase tonnage has a negative IncomeGrowth and PopulationGrowth per turn. Opposite, ports where tonnage does increase, has an increase per turn on both.

  • Like 1
Link to comment
Share on other sites

not sure if this helps you in any way, but this is the message I get when I start a new game with "taf_override_map,1"

KeyNotFoundException: The given key was not present in the dictionary.
  at System.Collections.Generic.Dictionary`2[TKey,TValue].get_Item (TKey key) [0x00000] in <00000000000000000000000000000000>:0 
  at CampaignController.PrepareProvinces (System.Int32 year) [0x00000] in <00000000000000000000000000000000>:0 
  at CampaignController+<>c__DisplayClass196_0.<Init>b__0 () [0x00000] in <00000000000000000000000000000000>:0 
  at UnityEngine.Font+FontTextureRebuildCallback.Invoke () [0x00000] in <00000000000000000000000000000000>:0 
  at GameManager+<UpdateLoadingWorld>d__109.MoveNext () [0x00000] in <00000000000000000000000000000000>:0 
  at UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) [0x00000] in <00000000000000000000000000000000>:0 

  • Like 1
Link to comment
Share on other sites

1 hour ago, MDHansen said:

not sure if this helps you in any way, but this is the message I get when I start a new game with "taf_override_map,1"

KeyNotFoundException: The given key was not present in the dictionary.
  at System.Collections.Generic.Dictionary`2[TKey,TValue].get_Item (TKey key) [0x00000] in <00000000000000000000000000000000>:0 
  at CampaignController.PrepareProvinces (System.Int32 year) [0x00000] in <00000000000000000000000000000000>:0 
  at CampaignController+<>c__DisplayClass196_0.<Init>b__0 () [0x00000] in <00000000000000000000000000000000>:0 
  at UnityEngine.Font+FontTextureRebuildCallback.Invoke () [0x00000] in <00000000000000000000000000000000>:0 
  at GameManager+<UpdateLoadingWorld>d__109.MoveNext () [0x00000] in <00000000000000000000000000000000>:0 
  at UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) [0x00000] in <00000000000000000000000000000000>:0 

It does indeed, thanks!

  • Like 1
Link to comment
Share on other sites

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

why cant I edit my own post... goddammit.

Anyhoo, I had a look at the savefile. All the ports belonging to nations where the port doesn't increase tonnage has a negative IncomeGrowth and PopulationGrowth per turn. Opposite, ports where tonnage does increase, has an increase per turn on both.

I've pushed a new version. Give that a try please!

Ran out of time to debug further. But I think part of the problem may be divergence between the TextAsset and what's in the prefab ingame, so I dumped the live data. You should base the TextAsset off that. (set taf_override_map to 2 to have it dump to the Mods folder before overriding).

  • Like 1
Link to comment
Share on other sites

 

set taf_override_map to 2, got the new port and province files, did a switcharoo with the originals. Now, there is a comma error in the top line in the ports file from the newly dumped file.
@name,nameUi,province,portCapacity,seaControlDistanceMultiplier,inBeingDistanceMultiplier, <--- remove it, 
set taf_override_map to 2, and b00m! epic win

The above works when starting a new game. However, there are no tooltips with info (ports, sea/land region), and hitting next turn gives an endless load and MelonLoader says [Unity] NullReferenceException: Object reference not set to an instance of an object.

 

im on the run here, so not excluding an error on my behalf when setting this up. I'll do a control later today

Link to comment
Share on other sites

I see. The dumped files don't have positions on ports and provinces (long/lat). and I cant simply copy that in, since ports/provinces are not placed the same way in the dump vs TextAssets

Link to comment
Share on other sites

looks like I did mess up. I fixed the extra comma in the Ports file, but didn't check the Provinces file :D I was now able to start a new game with taf_override_map,1,,,,,,,,

So, bottom line. Ran the game with taf_override_map,2,,,,,,,, created a new game to pull the ports and provinces files
quit game, did the switcharoo with said files and remove 1 comma in the top line of each file and saved the resources fil
started the game and created a new save with taf_override_map,1,,,,,,,, 
initially if something was wrong, it would start with an endless loading game, and wouldnt continue to simulate the pregame (eg. 1887-1890)

 

Link to comment
Share on other sites

but as I suspected, we need the coordinates for ports and provinces wich the dumps doesn't have. ill try and fill them with such from the textassets. set the row to alphabetic in both should to the trick

Link to comment
Share on other sites

Apologize for cluttering up the thread :D but now, sir, I've done it

Ran the game with taf_override_map,2,,,,,,,, created a new game to pull the ports and provinces files
quit game, did the switcharoo with said files and remove 1 comma in the top line of each file and saved the resources fil
started the game and created a new save with taf_override_map,1,,,,,,,, 

initially if something was wrong, it would start with an endless loading game, and wouldnt continue to simulate the pregame (eg. 1887-1890)
This is the correct way as it is per now. But something to add to that

I used (as you explained initially) the ports and provinces files from the dump, then added the lat and long columns from the TextAssets to both files
Then; open both files as csv in your fav editor and at the end of the top line add #insertsomethinghere, like this;
@name,nameUi,province,latitude,longitude,portCapacity,seaControlDistanceMultiplier,inBeingDistanceMultiplier,#end
and
@name,ameUi,area,controller,controller_1890,controller_1900,controller_1910,controller_1920,controller_1930,controller_1940,claim,isHome,type,latitude,longitude,development,port,population,oilDiscoveryYear,oilDiscoveryBaseChance,oilCapacity,oilReservesInTurns,revoltChance,provinceArmyPercentage,ProvinceDefenderBonus,neighbour_provinces,#end
This will add a comma at the end of all rows in both files

I created a new game with taf_override_map,1 and it worked. As I entered the map in the new game all position (lat/long) datas was working and UE didnt throw exceptions each time I hovered over a port/province.

WIN

  • Like 1
Link to comment
Share on other sites

8 hours ago, MDHansen said:

Apologize for cluttering up the thread :D but now, sir, I've done it

Ran the game with taf_override_map,2,,,,,,,, created a new game to pull the ports and provinces files
quit game, did the switcharoo with said files and remove 1 comma in the top line of each file and saved the resources fil
started the game and created a new save with taf_override_map,1,,,,,,,, 

initially if something was wrong, it would start with an endless loading game, and wouldnt continue to simulate the pregame (eg. 1887-1890)
This is the correct way as it is per now. But something to add to that

I used (as you explained initially) the ports and provinces files from the dump, then added the lat and long columns from the TextAssets to both files
Then; open both files as csv in your fav editor and at the end of the top line add #insertsomethinghere, like this;
@name,nameUi,province,latitude,longitude,portCapacity,seaControlDistanceMultiplier,inBeingDistanceMultiplier,#end
and
@name,ameUi,area,controller,controller_1890,controller_1900,controller_1910,controller_1920,controller_1930,controller_1940,claim,isHome,type,latitude,longitude,development,port,population,oilDiscoveryYear,oilDiscoveryBaseChance,oilCapacity,oilReservesInTurns,revoltChance,provinceArmyPercentage,ProvinceDefenderBonus,neighbour_provinces,#end
This will add a comma at the end of all rows in both files

I created a new game with taf_override_map,1 and it worked. As I entered the map in the new game all position (lat/long) datas was working and UE didnt throw exceptions each time I hovered over a port/province.

WIN

The lack of latitutde/longitude was a red herring, since my code only loads the values that you see in the dumps. Adding more columns won't result in any changes.

I did have a bug where the header row had an extra comma in it, which is now fixed. When you added the extra #somevaluehere that meant the header row no longer had an empty field (which had been created by the extra comma), and thus the loader worked.

Just to emphasize: the _only_ things my code loads are the columns that the dump creates*. All other variables are left at their stock values. So the stock lat/lon are preserved for all ports and provinces. That it was not working before was because the wrong data was getting read into things, because the header got messed up.

 

Note that the ports and provinces TextAssets are _only_ read by my code (the stock game does not use them), so the workflow for editing is:

  1. If you don't already have valid dumps of ports and provinces, run with 2 so they get dumped.
  2. Save backups of those dumps
  3. Edit them as desired
  4. Paste the entirety of the ports file (including the header) into the ports TextAsset
  5. Do the same for provinces
  6. Put those TextAssets into the resource.assets file
  7. Run the game.

Your edits should then be applied correctly.

 

*the dumps are basically "run the patcher in reverse". It's completely symmetric. The patcher works by reading the assets into data transfer objects and then applying the data in those objects into the game's ports and provinces databases before the game 'compiles' them on starting or loading a campaign. So in dump mode, my code first fills the DTOs with the game's data, and then writes the DTOs to disk.

  • Like 1
Link to comment
Share on other sites

Hey, since you've already got at least some loose files loaded, any chance of you extending that deeper?  There's a mod for UA: AoS that extracted equipment stats into .txt files, which would then be remotely loaded by the game, and any changes to the stats in the .txt file would override the game's stock value.  Idea would be that instead of modders needing to replace the entire resources file their mod could instead be distributed in loose file format, preserving the original game files.

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

It works. Would've worked earlier if I hadn't forgot to fill in the RelationMatrix (regards to my new nations) :D
got a few familiar errors in the UE logs but could not figure out what it was. It worked fine if I only used Params, Ports and Provinces. So, added files one by one until the error came. Well, I added players-resources, and got the error, but since this adds the nations (if new are added) I knew this would throw an error without the other new nation related files. So added relationmatrix and yeh, there was the error. Opened it and I saw it right away. I'd added the nations, but not the relation numbers lol

Anyhooooo. This works

Thanks

  • Like 1
Link to comment
Share on other sites

3 hours ago, SpardaSon21 said:

Hey, since you've already got at least some loose files loaded, any chance of you extending that deeper?  There's a mod for UA: AoS that extracted equipment stats into .txt files, which would then be remotely loaded by the game, and any changes to the stats in the .txt file would override the game's stock value.  Idea would be that instead of modders needing to replace the entire resources file their mod could instead be distributed in loose file format, preserving the original game files.

Oh sure yeah that's trivial, since I already was using basically that to override some NAR stuff myself. I can hook that up.

  • Like 1
Link to comment
Share on other sites

9 hours ago, NathanKell said:

Oh sure yeah that's trivial, since I already was using basically that to override some NAR stuff myself. I can hook that up.

Done. Also added support for >5 marks of gun.

image.png?ex=66b1b502&is=66b06382&hm=c5f

  • Like 1
Link to comment
Share on other sites

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

Would you mind checking something, if you are able without too much trouble. 

in the afterbattle report, my new nations flag is missing, and is using the ungov flags with a ? in it. Same flag that was used before you fixed them for us. I guess that situation uses another type of flag? or it needs to be connected to the rest in your code somehow?
I'll post a screenshot in a few

Edited by MDHansen
Link to comment
Share on other sites

4 hours ago, MDHansen said:

Would you mind checking something, if you are able without too much trouble. 

in the afterbattle report, my new nations flag is missing, and is using the ungov flags with a ? in it. Same flag that was used before you fixed them for us. I guess that situation uses another type of flag? or it needs to be connected to the rest in your code somehow?
I'll post a screenshot in a few

Sure, can you give me an NAR save from before (or during) a battle?

And also your flags.csv and the contents of your Flags folder, and the console log from melonloader around the time the popup shows (where you should see some spew about overriding flags)

Link to comment
Share on other sites

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

Sure, can you give me an NAR save from before (or during) a battle?

And also your flags.csv and the contents of your Flags folder, and the console log from melonloader around the time the popup shows (where you should see some spew about overriding flags)

There is the afterbattle report. I don't use NAR. I have my own personal recipy :)

TUjmjJA.png

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