• New Horizons on Maelstrom
    Maelstrom New Horizons


    Visit our website www.piratehorizons.com to quickly find download links for the newest versions of our New Horizons mods Beyond New Horizons and Maelstrom New Horizons!

Included in Build Ship Encounter Chances Correction

In wip 18 Johann Elting 1665 I get between 3-4 Spanish Heavy War Galleons vs 4-10 all Brandenburg frigates of Holland in an encounter. I board one ship after winning on first deck I don't find a button to continue. Neither space nor enter nor Q does something.
 
In wip 18 Johann Elting 1665 I get between 3-4 Spanish Heavy War Galleons vs 4-10 all Brandenburg frigates of Holland in an encounter.
Do you have a compile.log from that encounter? That seems a bit not-so-varied. :facepalm
 
Yup, that's it! Let's see then....
Code:
Fantom_GenerateEncounter: type = Fleet: warships, # Mer = 0, Mer MAX = 0, Mer MIN = 0, # War = 3, War MAX = 2, War MIN = 4
Force_GetShipType: Maxclass = 2, Minclass = 4, Per = The Spanish Main, Nat = Spain, Type = War, Loop = 0, Ship ID = SP_BattleGalleon
Force_GetShipType: Maxclass = 2, Minclass = 4, Per = The Spanish Main, Nat = Spain, Type = War, Loop = 0, Ship ID = SP_BattleGalleon
Force_GetShipType: Maxclass = 2, Minclass = 4, Per = The Spanish Main, Nat = Spain, Type = War, Loop = 0, Ship ID = SP_BattleGalleon
This one appears to be pure, unfortunate coincidence. In The Spanish Main, these are the number of warships Spain has available:
Tier 4: 3 ships
Tier 3: 3 ships
Tier 2: 2 ships
Tier 1: 1 ship
So between tiers 2 and 4, there was a choice of 8 ships in total. Should be enough choice.
For some reason, the random ship selection selected the SP_BattleGalleon on first try, despite it's only 20% chance value.

Code:
Fantom_GenerateEncounter: type = L - Fleet: Regional Patrol, a small fleet, # Mer = 0, Mer MAX = 0, Mer MIN = 0, # War = 7, War MAX = 1, War MIN = 3
Force_GetShipType: Maxclass = 1, Minclass = 3, Per = The Spanish Main, Nat = Holland, Type = War, Loop = 15, Ship ID = NL_FWzP
Force_GetShipType: Maxclass = 1, Minclass = 3, Per = The Spanish Main, Nat = Holland, Type = War, Loop = 4, Ship ID = NL_FWzP
Force_GetShipType: Maxclass = 1, Minclass = 3, Per = The Spanish Main, Nat = Holland, Type = War, Loop = 13, Ship ID = NL_FWzP
Force_GetShipType: Maxclass = 1, Minclass = 3, Per = The Spanish Main, Nat = Holland, Type = War, Loop = 2, Ship ID = NL_FWzP
Force_GetShipType: Maxclass = 1, Minclass = 3, Per = The Spanish Main, Nat = Holland, Type = War, Loop = 19, Ship ID = NL_FWzP
Force_GetShipType: Maxclass = 1, Minclass = 3, Per = The Spanish Main, Nat = Holland, Type = War, Loop = 11, Ship ID = NL_FWzP
Force_GetShipType: Maxclass = 1, Minclass = 3, Per = The Spanish Main, Nat = Holland, Type = War, Loop = 12, Ship ID = NL_FWzP
This one also seems largely coincidental. In The Spanish Main, these are the number of warships Holland has available:
Tier 4: 1 ship
Tier 3: 3 ships
Tier 2: 4 ships
Tier 1: none
So between tiers 1 and 3, there was a choice of 7 ships in total. Again, should be plenty to allow for some variety in the encounter.
In this case, the game was unable to find a ship on first try, but eventually settled on the NL_FWzP every single time. That one has a 30% chance value.

Stupid game. I wonder if it might help if all chance values in each search category would be increased.
Especially since the check can fail on nation AND period chance value. And most values are far below 50%, so will fail more often than not.
So as I understand it, the ships with higher values do get an exponentially higher chance of showing up.

Perhaps, as a test, we should set the values to either 1.0 or 0.0 and see if that improves the variety.
Then if certain ships do show up too much, we can reduce their values again. But only IF there is enough choice in the category we're working from.
Otherwise there'd be no point anyway.
 
Mate, I've been testing from 2.1 through 2.3, 2.5 to wip 18 encounters today in the 1660s and yesterday in the 1550s. Seems almost without difference. I might suggest it chooses the first by alphabetical order ship in the resource/models/ships directory and does always that...
Anyway since I got an eye on the encounters, if you change something, I am ready to test it, became already not that difficult.

I think also it mistakes which ships are which, or does not differentiate them. Because if it announces in the message /1550s/ a merchant with a convoy, you get a carrack and caravels. But you get a few carracks and caravels under "convoy" message, and same as "warships"...


Btw from 18 skies in the weather folder it keeps loading 2 for day and 1 for night...Will have to sort this out myself. :doff
 
Last edited:
See attached file with ALL chance values larger than 0.0 changed to 1.0 .
This is to simplify analysing the way this system works by removing two reasons why a ship might NOT be chosen, even if it IS available to that period and nation.
Later if there are still encounters with not enough variety, we can change those values again. For now, we can see what happens like this.

Mate, I've been testing from 2.1 through 2.3, 2.5 to wip 18 encounters today in the 1660s and yesterday in the 1550s. Seems almost without difference. I might suggest it chooses the first by alphabetical order ship in the resource/models/ships directory and does always that...
Anyway since I got an eye on the encounters, if you change something, I am ready to test it, became already not that difficult.
I've been looking at the relevant code quite a bit and I can assure the choice is NOT alphabetical.

Btw from 18 skies in the weather folder it keeps loading 2 for day and 1 for night...Will have to sort this out myself. :doff
Not sure what you mean there. Pretty sure the sky code wasn't touched any time recently.
 

Attachments

  • period_encounters2.zip
    62.5 KB · Views: 112
Downloading period 2. But if aship is listed as both merchant and war, or has diff cannons or something it may be chosen as diff ship and compose a fleet of outer-looking the same ships. You sure this also doesn't mess with the choice ?
 
I should also have mentioned: You can load your savegame and press F11 for the changes to take effect.

None of the ship selection code looks at the number of cannons, so that is not a problem.
If a ship has refShip.Type.Trade = true; then it is enabled for merchant encounters and if it has refShip.Type.War = true; it is available for war encounters.
If a ship has both set to true, then it has a double chance of showing up, either as a merchant or a navy ship.

Theoretically, you could indeed have a merchant NL_PinnaceofWar47 escorted by a navy NL_PinnaceofWar47.
But if that turns out to be a problem, we can always set them to one option only or decrease their chance values.
We'll see how this behaves. :shrug

This doesn't influence the new Select Storyline filters, because that filtered based on a "greater than 0" check anyway.
The only different is that the values are now MUCH greater than 0, but that doesn't make any difference.

Anyway, if you run into any encounters you're not happy with, please post your compile.log again along with a note on what is wrong.
It'll be great to finally put this issue to rest. :woot
 
There is improvement. 1 more ship added to the pool 1665. But I feel it could be more. For ex. at the moment the ships that can be seen are fast galleon, english galleon, heavy spanish war one, the brandenburg frigate, caravel. There are like 6-7 barques only, at least one to get in, no luggers, no schooners nothing else, not to mention the special ships. I would advice you to max them all out and see what happens.
 
special ships? Do you mean the Black Pearl or the Dutchman? You can't encounter them. And you don't want to :D
 
I think I found where the problem lies. In 2.3 it was more normal. I look at the compile.log and there is no errors. In 2.5 however before any wips, there is this compile log, which is almost the same in beta 3 wip 18. Says "CAN'T FIND SHIP...REPLACING IT WITH DEFAULT SHIP INSTEAD". It means that whatever variety is set, the intended ships are being substituted with default ones. That is why nothing helps, they are all substituted.


special ships? Do you mean the Black Pearl or the Dutchman? You can't encounter them. And you don't want to :D

I mean like Hoy, la Couronne and San Felipe.
 

Attachments

  • compile.log
    75.1 KB · Views: 106
There is improvement. 1 more ship added to the pool 1665. But I feel it could be more. For ex. at the moment the ships that can be seen are fast galleon, english galleon, heavy spanish war one, the brandenburg frigate, caravel. There are like 6-7 barques only, at least one to get in, no luggers, no schooners nothing else, not to mention the special ships. I would advice you to max them all out and see what happens.
If you want, I'll try to explain how the code works. Then you can see if the encounters make sense and also, hopefully, what needs changing.
The Select Storyline interface with Cheatmode on is quite useful for seeing what ships you SHOULD be seeing.

I think I found where the problem lies. In 2.3 it was more normal. I look at the compile.log and there is no errors. In 2.5 however before any wips, there is this compile log, which is almost the same in beta 3 wip 18. Says "CAN'T FIND SHIP...REPLACING IT WITH DEFAULT SHIP INSTEAD". It means that whatever variety is set, the intended ships are being substituted with default ones. That is why nothing helps, they are all substituted.
Beta 2.5 would not have shown that log message, because the log message wasn't coded in. It was still happening though.
That's why I added that message: so that we'll KNOW when it happens. And if it DOES happen, compile.log will now tell us in what encounter type it happened,
which allows us to change the relevant code so that it won't happen again.

Long story short:
1. Worldmap and DirectSail encounters have their minclass, maxclass, number of ships and trade/war based on PROGRAM\Encounters\Encounters_init.c
2. Other encounters, such as Coast Raiders around islands, have those values fixed
3. Whenever the game searches for a ship, it first establishes a list of all valid ships based on class, trade/war (NOT nation and period yet)
4. The game then randomly selects a ship from that list and checks that against the nation and period chance values
5. If this check FAILS, it'll try again. Up to a maximum of 100 tries per ship. If it does NOT fail, that ship is selected

How to read your compile.log file:
Code:
Fantom_GenerateEncounter: type = L - Fleet: Regional Patrol, a small fleet, # Mer = 0, Mer MAX = 0, Mer MIN = 0, # War = 7, War MAX = 1, War MIN = 3
Force_GetShipType: Maxclass = 1, Minclass = 3, Per = The Spanish Main, Nat = Holland, Type = War, Loop = 15, Ship ID = NL_FWzP
Force_GetShipType: Maxclass = 1, Minclass = 3, Per = The Spanish Main, Nat = Holland, Type = War, Loop = 4, Ship ID = NL_FWzP
Force_GetShipType: Maxclass = 1, Minclass = 3, Per = The Spanish Main, Nat = Holland, Type = War, Loop = 13, Ship ID = NL_FWzP
Force_GetShipType: Maxclass = 1, Minclass = 3, Per = The Spanish Main, Nat = Holland, Type = War, Loop = 2, Ship ID = NL_FWzP
Force_GetShipType: Maxclass = 1, Minclass = 3, Per = The Spanish Main, Nat = Holland, Type = War, Loop = 19, Ship ID = NL_FWzP
Force_GetShipType: Maxclass = 1, Minclass = 3, Per = The Spanish Main, Nat = Holland, Type = War, Loop = 11, Ship ID = NL_FWzP
Force_GetShipType: Maxclass = 1, Minclass = 3, Per = The Spanish Main, Nat = Holland, Type = War, Loop = 12, Ship ID = NL_FWzP
Fantom_GenerateEncounter refers to Encounters_init and tells you the type of encounter that is being requested.
The # values are the number of ships and the MAX/MIN values are the limits on the ship classes.

Force_GetShipType is the function that selects the actual ship, showing again the class limits, time period, nation and ship type (war/trade).
The "loop" values indicates the number of tries before the game found a ship. Ship ID is what the game eventually generates.

If "loop" reaches 100, the game writes an error message to compile.log and chooses between two period-appropriate generic ships.
Ideally, we do not want this to EVER happen, because it bypasses all other code that is there to make the encounters appropriate.
 
I did not install Directsail. Had it once but the map was inaccurate. pressed from sea in Havana you arrived on the map at Curacao for ex. So that game I erased. In all current ones this feature is not installed. So in my case, the errors are from .. ?! 2.3 without Directsail still generates comparatively varied encounters without errors. I should guess the ships are not properly listed whereever that maybe, to skip 100 ships ...or more likely the determination of the ship classes is too narrow and does not include many ships...
 
DirectSail is ALWAYS included in the Build Mod. And why shouldn't it be? It works fine. :shrug

Anyway, for all those questions you have, the compile.log entries provide the answers. We just have to get some results and analyse them to figure out what is going on.
 
Btw the 2.3 loaded the Hoy + a modified frigate; in another encounter the HMS_Favourite , something unachievable 2.5 and post:

ENGINE 2013-08-31 00-47-13-16.jpg ENGINE 2013-08-31 00-50-47-61.jpg
 
The Assassin storyline is set in The Spanish Main, so if those ships were showing up, that would be a bug.
The HMS_Unicorn is available only in Colonial Powers and Revolutions.
The Hoy is available only in Golden Age of Piracy, Colonial Powers and Revolutions.
You never have all ships available at the same time, because real life never had all those ships at the same time.
 
I got them as Johan Elting 1666 in 2.3. I tried today a pure Beta 1 game. Perfect all kinds of encounters. Point is, above 2.3 all encounters are bugged.
 
Back
Top