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

Fixed Game Crashes around Specific Islands

Ok, why not? I have had to stop playing because of constant CTDs anyway.

EDIT: After 6 CTDs I am stuck at Marigot. I can not leave.

EDIT2: It managed to hold together long enough for me to get to the world map and I escaped. The constant random CTDs are following me around everywhere now. Six in one session and four in another makes this game unplayable.
 
Last edited:
After installing @Levis last ZIP, I cant land at Hispaniola anymore.
Log says" Directsail aborted during sail to".
 

Attachments

  • error.log
    534 bytes · Views: 128
  • compile.log
    5.3 KB · Views: 132
  • system.log
    667 bytes · Views: 140
  • -=Player=- Open Sea January 4th, 1814.zip
    941 KB · Views: 130
After installing @Levis last ZIP, I cant land at Hispaniola anymore.
Log says" Directsail aborted during sail to".
Did you do an F11 like I said you should?
Did you install the new files by @Pieter Boelen in the main topic (jan 1 version)?
 
@ANSEL I see already what the problem is.
Seems another thing has to be executed in order to keep it working in an existing game.
Execute this too:
Code:
for (int i = 0; i < MAX_CHARACTERS; i++)
{
ref chr = &Characters[i];
DeleteAttribute(&chr,"PerkTypes");
}

This will reset some things so it will work :).
 
@ANSEL I see already what the problem is.
Seems another thing has to be executed in order to keep it working in an existing game.
Execute this too:
If its the consol you mean, then I cant execute those lines.
 
If its the consol you mean, then I cant execute those lines.
Yes in the console.
I see I made a small mistake. Use this instead:
Code:
for (i = 0; i < MAX_CHARACTERS; i++)
{
ref chr = &Characters[i];
DeleteAttribute(&chr,"PerkTypes");
}
 
I tried it out but Im still unable to land at Hispaniola. Game crash every time I try.
I can go to land at other places.
 

Attachments

  • compile.log
    4.1 KB · Views: 115
  • system.log
    519 bytes · Views: 129
I tried two things:

1. Loaded the savegame and used WorldMap to sail to Hispaniola without using F11/F12
Game seemed to work fine in 3D Sailing Mode at the island. Until it crashed, that is....

2. Did the same, but pressed both F11 and F12 twice to ensure that perks stuff was updated.
Got an immediate crash this time instead.

I'd have to investigate this one further to see what is going on.
It reminds me FAR too much of that "game crashes due to dead captain" problem we had before.
Not nice!!! :whipa
 
This is beginning to look uncomfortably familiar:
upload_2016-1-5_15-47-58.png

It is totally this one: Fixed - Levelling: Missing Ships and Crashes on Encounter Reload from Worldmap to Sea | PiratesAhoy!
AGAIN!!!! :boom:
 
Further investigation indicates that this one is *slightly* different from the previous problem.
While that one dealt with ships generated from the worldmap, in this case it is the "CrHispaniola6" character that is DEAD.

This is what happens:
Code:
SetCoastTraffic: Char CrHispaniola5 of type pirate and nation Pirate and we'll check to see if we regen: yes.
Force_GetShipType: Maxclass = 4, Minclass = 8, Per = Napoleonic, Nat = Pirate, Type = war, Loop = 0, Ship ID = Brig1
XP LOG: Start InitAutoSkillsSystem for Clemencien Bouwer id: CrHispaniola5
CrHispaniola5 is not dead, adding.
cr is group commander
SetCoastTraffic: Char CrHispaniola6 of type pirate and nation France is dead and we'll check to see if we regen: yes.
Force_GetShipType: Maxclass = 4, Minclass = 8, Per = Napoleonic, Nat = Pirate, Type = war, Loop = 0, Ship ID = Xebec1
XP LOG: Start InitAutoSkillsSystem for Gonzalo Vaime id: CrHispaniola6
CrHispaniola6 is not dead, adding.
cr is not group commander
do not need to create new group

Apparently what happened is this:
- There USED to be two ships in the "Sea AI group", being "CrHispaniola5" and "CrHispaniola6"
- One of those two died for whatever reason ("CrHispaniola6" to be exact), probably during a previous visit of yours to Hispaniola
- Now the game decided to put some new ships in their place, so the previously dead "CrHispaniola6" needs to be resurrected
- InitAutoSkillsSystem IS called for this character
- However, FinishCharInit is NOT called for this character
- Therefore the HP of this character remains 0 and the game half thinks that the character has now been resurrected AND half thinks the character is now dead
- The "half dead" part prevents the ship from actually being loaded to sea
- The "half alive" part means that it IS part of a "Sea AI group" and can therefore be given tasks
- Giving a "move" task to a character that isn't loaded to sea causes a crash

I can very easily prevent this crash. But I don't want to use that simple solution.
We need to solve the ROOT cause and anything else would just serve to make the problem less visible.
It seems like I have to be the guy with the bad news:rumgone
At least is IS consistent, so you've given us a good testing case. :onya
 
Worth noting is that these Coast Raiders are created in PROGRAM\SEA_AI\sea.c with the void SetCoastTraffic(string islandstr) function.
This contains a fair bit of code to have this reused character slot appear to be a BRAND NEW character instead.
The following part seems the most relevant:
Code:
         // LDH - regen'd characters won't be surrendered - 15Feb09
         DeleteAttribute(cr, "surrendered");   // causes crash on set task?
         RestoreCharacter(cr);     // LDH fix corpses, needed for group processing - 15Feb09
         // LDH added corpse group fix because it's not done in RestoreCharacter() - 15Feb09
         // probably a good thing, because it's the only way we have left to determine if a character is a corpse
         if (cr.chr_ai.group == LAI_GROUP_CORPSES)
         {
           LAi_group_MoveCharacter(cr, LAI_DEFAULT_GROUP);
         }
         
         cr.rank = GetCaptainRank(cr); //Levis
         InitAutoSkillsSystem(cr,false); //Levis

As far as I can tell, the call to 'RestoreCharacter' is meant specifically to prevent issues like these.
But it is probably aborted straight away because of the "is dead" check at the top:
Code:
void RestoreCharacter(ref chCorpse)
{
   if(!CheckAttribute(chCorpse,"corpse")) return;
   else DeleteAttribute(chCorpse,"corpse");
   if(CharacterIsDead(chCorpse)) { LAi_CharacterLogoff(chCorpse); return; }

Not that it would make much difference, because the only code in that function related to "character HP" looks to have been commented out:
Code:
   //if (CheckAttribute(chCorpse, "old.chr_ai.hp")) { chCorpse.chr_ai.hp = chCorpse.old.chr_ai.hp; }//Removed by levis cause it isn't used anymore.
   //if (CheckAttribute(chCorpse, "old.chr_ai.hp_max")) { chCorpse.chr_ai.hp_max = chCorpse.old.chr_ai.hp_max; }//Removed by levis cause it isn't used anymore.

And at no point does 'ResetHP' get called, which is the one thing that would solve this problem properly.

Now I could make some sort of "hack fix" myself, but I am very much inclined to leave this one for @Levis.
It seems the Levelling system isn't resetting properly for these resurrected characters.
 
@ANSEL: You can try to extract attached to your PROGRAM\SEA_AI folder. That seems to help.

I applied the same "hack fix" that I did for worldmap encounter ships before to ERASE the reused characters altogether using ClearCharacter .
At least there is absolutely no left-over crap from "previous incarnations" to mess things up now anymore.
Also allowed me to get rid of quite a bit of additional code to reset specific parts of the character, while leaving other parts.

This may not help with initial game performance during loading, because a lot more extra stuff is being reset now.
But it is probably a lot cleaner than it was before and should happen only occasionally.

I also have NO clue if "too much" is being cleared. We'll find out soon enough, I suppose. :shrug

Still, I would REALLY appreciate @Levis shining his light on this one as well. :rolleyes:
 

Attachments

  • sea.zip
    16.7 KB · Views: 100
While I am happy to say I haven't had this problem quite a while, I think it was going from the map to the 3D sailing mode,
 
Back
Top