• 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!

Need Help More direct-sail encounters

Yes - see the report on post #56. Sometimes the game does not crash and the game works; and sometimes it does crash.

I tried again, with the line in "sea.c" which allows the possibility of a third fleet commented out; the hope was that, since the game certainly supports a double encounter from worldmap, it might support a double encounter during direct sail as well, and perhaps only triple encounters were causing crashes. No such luck; it still sometimes crashed immediately after "Sail Ho" when triple encounters were impossible.
 
Did this actually make its way into the main mod, but disabled with a 'bottom of globals.c toggle' that defaults to OFF?
I've done that before with functionality that is technically pretty cool; just not quite perfect enough for regular play...
 
Yes - see the report on post #56. Sometimes the game does not crash and the game works; and sometimes it does crash.

I tried again, with the line in "sea.c" which allows the possibility of a third fleet commented out; the hope was that, since the game certainly supports a double encounter from worldmap, it might support a double encounter during direct sail as well, and perhaps only triple encounters were causing crashes. No such luck; it still sometimes crashed immediately after "Sail Ho" when triple encounters were impossible.

So I decided to help determine the problem and there are two things. If you review your Windows Event Viewer for the crashes, I bet that either Sea_AI.dll or Peoples_on_ship.dll are involved in the crash.

For the Sea_ai crash in the older Storms, the Maelstrom now avoids the crash problem for the situation presented during the test of these multiple encounters, but when it circumvents that particular error there will be no AI for the ships in question; a "controller" object gets corrupted. I have not spent much time further investigating this, as it's a moot point in the later versions of the scripts, but I suspect that is due to the fact that both POTC and NH can send the same reference, for two different "create" objects in the following message:

SendMessage(&AISea, "liaa", AI_MESSAGE_ADD_SHIP, rCharacter, rCharacter, &ShipsTypes[iShipType]);

That ShipsTypes array is the "base" ship array, and if two or more characters submit the same iShipType, then the references in the engine will reassign to a different character, but since the previous character's AI ship was created, with that other ship reference, the engine can no longer reference it, and during the loop of ship ai objects during the "execute" loop, it will crash. This problem is less frequent and the later versions of the game avoid this problem because they introduced a separate array for RealShips to keep these references distinct.

The more prevalent problem is the peoples_on_ship crash...which did crash Maelstrom and Storm because Peoples_on_ship contains a static array hardcoded to a max of 25 ships that it will keep track of and as soon as the SendMessage(&PeopleOnShip, "lal", MSG_PEOPLES_ON_SHIP_MASTFALL, GetCharacter(chrIdx), mastNum) line is called, past 25 ships, gonna crash.

I can change this to be dynamically sized, even though peoples_on_ship is deprecated for CT and beyond, in favor of the later "Sailors" class.
 
....and now it doesn't crash, with 6 DirectEncounter calls on each sea load; the engine array is now dynamically sized if exceeding the initial 25.

Still would have possible issues with the use of ShipsTypes, instead of a separate, devoted array for RealShips (like CT, COAS), but no more crashes due to many, multiple encounters added. Would advise consideration for script alteration to manage that separate ship array...
 
@ChezJfrey: could you upload your revised files? If they don't cause any adverse side-effects in wider gameplay, I'll include them as well as the code for multiple encounters in the next update.

I think you misunderstand. I did not change or fix anything in the program script code; I used the code from this thread (although I changed it from chance to 100% always generate multiple encounters and made it 6 instead of 3) in order to figure out what caused the crashes. Both of the crash types I encountered were engine problems: one type in sea_ai.dll and one type in peoples_on_ship.dll. The changes I had made to Maelstrom already prevented the crash type in sea_ai.dll, but I could tell that it was a controller-gone-missing type error because I log such a thing...we never see that in COAS, but this does happen occasionally in POTC/NH because as I mentioned, that potential use of the same reference for two or more characters with ShipsTypes array. I did not make that coding change in the scripts, because it's a big job and it was already done for CT, COAS and beyond with the RealShips array...only a problem in POTC and NH.

The more common type of crash for this multiple-encounter addition was in peoples_on_ship and that is because that .dll has a hardcoded, static array sized to 25. If you add more than 25 ships (which will happen because I see in NH scripts that the max ships for setting in a scene is value 32, then it crashes. That also is not a script problem, but an engine limitation. I took away that limitation and made it dynamically resize itself when you exceed the initial 25 size.

In both cases, the change was to the .dll code and what I have is not compatible with the older engines...too much has been altered and they just don't work.

I just posted to inform that this error can't be avoided with the old engine if there are more than 25 ships, at all, ever. I also posted to mention that these types of limitations and problems can be avoided and these types of features can technically be implemented and supported; I actually did make the change, even though we don't use peoples_on_ships in the later games at all...just in case someone might want it.
 
Sorry, yes, it does seem I misunderstood.

From this:
So I decided to help determine the problem and there are two things. If you review your Windows Event Viewer for the crashes, I bet that either Sea_AI.dll or Peoples_on_ship.dll are involved in the crash.
... I thought you were going to try to fix the problem in PoTC:NH, this being a thread in the "POTC: New Horizons Mod" section of the forum, and that you'd nailed the problem down to a couple of dll's.

Then:
I can change this to be dynamically sized, even though peoples_on_ship is deprecated for CT and beyond, in favor of the later "Sailors" class.
... that led me to believe that you were going to change the dll in question - what happens in CT and later games is, of course, not important to a mod for PoTC:NH.

....and now it doesn't crash, with 6 DirectEncounter calls on each sea load; the engine array is now dynamically sized if exceeding the initial 25.

Still would have possible issues with the use of ShipsTypes, instead of a separate, devoted array for RealShips (like CT, COAS), but no more crashes due to many, multiple encounters added. Would advise consideration for script alteration to manage that separate ship array...
That seemed to indicate that you had made the fix and it was working.

Apparently not, though...
In both cases, the change was to the .dll code and what I have is not compatible with the older engines...too much has been altered and they just don't work.
So the .dll change is not compatible with PoTC:NH, and not relevant to CT or later...
even though we don't use peoples_on_ships in the later games at all
 
Sorry, yes, it does seem I misunderstood.

... I thought you were going to try to fix the problem in PoTC:NH, this being a thread in the "POTC: New Horizons Mod" section of the forum, and that you'd nailed the problem down to a couple of dll's.

Then:

... that led me to believe that you were going to change the dll in question - what happens in CT and later games is, of course, not important to a mod for PoTC:NH.

That seemed to indicate that you had made the fix and it was working.

Apparently not, though...

It is fixed for POTC:NH, available today. See shots for 6 encounters....game is NH.
 

Attachments

  • 6Encounters_a.jpg
    6Encounters_a.jpg
    373.4 KB · Views: 258
  • 6Encounters_bsamescene.jpg
    6Encounters_bsamescene.jpg
    330.6 KB · Views: 271
If it is fixed for PoTC:NH, would you be willing to share the fix? Preferably by uploading it here. :onya

Pretend there is a flaw/missing feature in Win95 and is still a flaw/missing feature in Win10. Microsoft announces that it is now "fixed"...do they fix Win95? No, Win95 is past end-of-life so they apply the fix to what is currently supported. Storm 2.0 is way past end-of-life. It is fixed in the equivalent of Win10...the newest, and requires an upgrade to employ this many encounters in NH without crashing now. I can't fix Storm 2.0 binaries for this...that's impossible.
 
Pretend there is a flaw/missing feature in Win95 and is still a flaw/missing feature in Win10. Microsoft announces that it is now "fixed"...do they fix Win95? No, Win95 is past end-of-life so they apply the fix to what is currently supported. Storm 2.0 is way past end-of-life. It is fixed in the equivalent of Win10...the newest, and requires an upgrade to employ this many encounters in NH without crashing now. I can't fix Storm 2.0 binaries for this...that's impossible.
So the fix or .dll file concerned is only applicable to the Maelstrom Engine, then? As that engine is configured to work better on modern OS's unlike the one we have in POTC: NH. Yes? Just so everyone is on the same page.
 
Pretend there is a flaw/missing feature in Win95 and is still a flaw/missing feature in Win10. Microsoft announces that it is now "fixed"...do they fix Win95? No, Win95 is past end-of-life so they apply the fix to what is currently supported. Storm 2.0 is way past end-of-life. It is fixed in the equivalent of Win10...the newest, and requires an upgrade to employ this many encounters in NH without crashing now. I can't fix Storm 2.0 binaries for this...that's impossible.
So it's not fixed in PoTC:NH, and can not be fixed.

By that OS analogy, if PoTC is Win95, then perhaps CoAS is Windows 7 and TEHO is Windows 10. Akella takes the role of Microsoft. But this thread is about a mod for PoTC:NH; if it's converted for use in the later games, perhaps that version of the mod could be posted to the CoAS or TEHO parts of the forum? (Maelstrom is a product from a completely different team; following the OS analogy, perhaps it's MacOS X. It is outside the scope of this thread - perhaps discussion of Maelstrom could continue in the "Other Pirate Games" section?)
 
Did this actually make its way into the main mod, but disabled with a 'bottom of globals.c toggle' that defaults to OFF?
I've done that before with functionality that is technically pretty cool; just not quite perfect enough for regular play...
Update: it's included now, though it's not a toggle but a numeric variable; and it's not at the bottom of "globals.c", it's in that part of "InternalSettings.h" which deals with "Worldmap & Ship Encounters". The variable is set to 0.0 by default, and it's not included in the documentation.
Code:
#define DS_MULTIFLEET           0.0           // FLOAT - percentage chance of an extra group in a direct-sail encounter.  Default 0.0, no additional groups.  May cause crashes if set above 0.0, especially on older PC's
 
Update: it's included now, though it's not a toggle but a numeric variable; and it's not at the bottom of "globals.c", it's in that part of "InternalSettings.h" which deals with "Worldmap & Ship Encounters". The variable is set to 0.0 by default, and it's not included in the documentation.
AWE-SOME!!! :bow

Main reason for me suggesting globals.c is because it's even more hidden and it'd be together with the other technically-cool-but-also-not-good-enough features that are already there.

But either way, having it in is a good thing in my book! :cheers
 
Very unfortunate that it cannot be fixed, even though I did not understand most of the above, to be honest.

Unless, if I read correctly, perhaps by adding a check to limit the spawned ships to 25, could that be easily done?
 
Back
Top