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

Confirmed Bug Sea Relations: When commander of group surrenders the whole group surrenders

Basically you end up adding extra code to deliberately make the code NOT do what it is meant to do.

No, this is compeltely not the case. There are only two parts of the code.

The retargeting logic for targeting away from surrendered enemies was ALREADY in place, I just corrected it so it actually works by adding a lone. It was always intended and present.

The only other part is an if statement making the refresh conditional on being the last member of the group. Hardly some distortion of the code, it is one of the cleanest fixes imaginable, basically 2 lines of code.


With fixing bugs, I firmly they should be fixed properly or not at all..

Uh...this had been declared unfixable. An "engine limitation." In other words, a final fix had been given up on. And had been plaguing players on the meantime.

So players should continue suffering from a bug that could be easily fixed, because fixing it would require skipping a check in some circumstances when it isn't needed, because the check is broken and therefore we must use it until it is fixed...nope, not seeing this as compelling reasoning.:p

And jeez, if a bug can be fixed in 99% of cases, or not at all, it certainly SHOULD be fixed for the 99% of cases. The alternative makes no sense.


As for the minimap issue, I'm sure if that did end up being the case it would be easy enough to fix with an extra line of code (oh, the horror, an extra line of code). But I'm not certain it would be an issue--even without the refresh, relations are ALREADY set to relation_neutral (I had traces set up, so I am certain of this). Meaning it either won't be an issue or would be easy to fix.


As long as I still make the official EXE files, this change will NOT go into any official releases. Not until it is fixed for real.

There is no compelling reason why a refresh has to happen on every single surrender. Doing so creates this bug, and every single goal achieved by refreshing can be achieved otherwise, without much trouble and in a couple of additional lines of code.

Or maybe not, testing would show. But frankly, for you to adopt this kind of absolutist position right from the outset, without being even willing to see how this fix works out, makes no sense.

And quite honestly makes me feel like I wasted my time in working on thiings. If it had proved a bad idea after being tested, or created problems that couldn't be solved, that would be fine, and I would understand.

But instead you seem to be throwing away the only solution anyone has come up with for a bug that has been unsolved for years, that will prevent it from occuring in 99% of cases and that has shown no signs of any negative effects for the player in the fairly extensive testing I have done so far that can't be easily solved in maybe 5 lines of extra code at the most, and doing all that without even waiting to see what happens or test at all.


If you were actively working on this bug rather than having declared it hopeless and an "engine limitation", or if you were waiting and seeing if there were actually any problems in testing that could not be easily fixed, then I would understand not wanting to implement my 99% solution.

But such an absolute declaration as you make at this stage doesn't make sense, and the tone of it is far too dismissive and absolutist to be consistent with the conditions under which I would like to spend my free time modding.

It is also of such an extreme and premature nature, and so inconsistent with attitudes towards bugfixing taken elsewhere here (when have we not chosen to fix 99% of a problem when it was the best available solution? When have we not tested things to see if they work out?), that I find it really strange, and I simply don't feel like dealing with these sorts of personality issues on my free time.

I am going to take a break from the board and modding for at least a while. I'll leave a final note with some info on next steps if someone takes over the AI improvements over in that thread. I bear nothing but goodwill towards everyone here, and I appreciate all of the fun I've had here discussing things here. Goodbye.
 
Tinygun calm down.. Pieter is right, if you don't fix this 100% right somewhere else will pop up bugs, and even if I didn't code that much, I am 100% sure about this. The group surrender bug isnt that bad at all and if you really want to fight every single ship of the group you just have to quicksave and quickload after the flagship surrendered - this is not bothering me at all, there are many things in this game for which I could instantly move the whole game folder in the trash, but this is such a tiny tiny tiny problem, it isn't worth the effort it would need to fix this.

I usually only start fights to loot and increase my pirate booty, so I most of the time attack merchants. And even my Heavy Pinnace oW "only" can store max. 2 traders goods, so I don't see any problem at all here. And if I still had place or want to sell the escort ship, because it is pretty good, I still can quicksave and reload and board it..

The only thing that come to my mind here is that we probably should add this to Tips&Tricks @Pieter Boelen ?
 
There is no compelling reason why a refresh has to happen on every single surrender.
Of course there is!
Relations between ships have just changed, therefore relations should be updated so all others ships are made aware of this change.
That is the exact purpose of that function. o_O

If I understand correctly, you managed to find the code that triggers the bug to become visible.
But that same code cannot possibly be the actual cause, because the bug existed before that code did.
In other words: The real root cause still remains hidden.

Disabling the trigger may seem like a quick and easy fix, but it is a "bandaid" at best and "hiding the existence of the bug" at worst.
The problem with "quick fixes" and "shortcuts" is that, sooner or later, somebody ends up paying the price for it.
Historically speaking, that somebody more often than not ends up being me, so that explains why I seem more firm on this than I might normally be.

In any case, I do not object at all to the work you have done here and, in fact, think you've been doing some quite valuable investigations!
All I am saying is that what you suggest is unfortunately not a real fix as the root cause apparently goes deeper than this.
This is a complicated issue indeed and one that has completely baffled at least three experienced programmers so far.


Please don't be discouraged by this though. I do believe a real fix should be possible, but that will require further investigation for sure.
What would be VERY interesting for example:
1. Disable that 'RefreshBattleInterface(true);' line in the Surrender code
2. Add it into console instead
3. Add debug code to Screwface_functions.c so that it logs exactly what relations it sets between which ships
4. Trigger a surrender
5. Remove the compile.log from your main game folder with the game still running (using Alt+Tab)
6. Now press F12

This should give you a complete list of actions that were conducted by the 'RefreshBattleInterface(true);' line.
You can then find the names of the non-flagships that "fake surrendered" when the flagship really did.
So that should tell you if indeed they were being set to Neutral to your player ship deliberately or if they were left alone.

If it indeed did happen deliberately, then the big question is: Why? Did their nationality also change to NEUTRAL_NATION?
If it did, then that is the real cause and the code responsible for that should be tracked down.

even without the refresh, relations are ALREADY set to relation_neutral (I had traces set up, so I am certain of this).
That strongly suggests there is code outside the "refresh" that is also changing nation relations.
This should not be the case, because I deliberately wrote that 'CheckInitialFlagRelations' function so everything would be handled in one central spot.
If surrender is also being handled elsewhere, then most likely that "elsewhere" is doing things differently and/or interfering with the general update.
So that might be the real reason why this happens.

Ultimately, I strongly believe you are on the right track to figure out this bug for real.
I do believe a proper fix should indeed be possible, so I sincerely hope you won't give up just yet, but take also the next step so that you might be able to find the REAL culprit!
 
In other words, a final fix had been given up on. And had been plaguing players on the meantime.
I have to say here, that this problem neither really bothered me at all nor did I ever care for it, especially because it's gone after boarding. That's a "quirk" in the code I can easily live with and if the allied ships of the surrendered flag ship attack me right before or after the boarding doesn't make any difference to me. As far as I have seen another ship of the enemy fleet becomes the new flagship after a reload/boarding, so my roleplaying mind always took this behavior as some sort of "re-organising".
 
The other ships only sometimes turn hostile again after boarding. Which is very weird because it appears to be completely random if they turn hostile again or not.
 
@Grey Roger ran into what seems to be a very related problem in his Ardent Storyline. See here (Modders only!):
http://www.piratesahoy.net/threads/how-to-start-a-storyline.26646/page-18#post-550399

Based on this new evidence, my suspicion is that this line in PROGRAM\Screwface_functions.c is preventing the code from doing what it is intended to do:
Code:
if (SeaAI_GetRelation(GetMainCharacterIndex(), sti(chr.index)) != RELATION_ENEMY)
That is there mainly for performance reasons, e.g. there should be no need to trigger the "turn ships hostile" code if they're already hostile.
But that does assume that this function matches with the regular nation/character relations and the Battle Interface, which may not be the case after all.
If so, this check could prevent the rest of the "turning hostile" process from being completed properly.

Hypothesis: Commenting out that if-statement will fix the bug.
Anyone care to try that out? :rolleyes:
 
Ok so the first results are unfortunally not with the flagship by now. But surrendering and (sea) relations still work properly without that code-line. I also noticed a much smoother game when ships surrendered (it sometimes had a minimal freeze before when a ship surrendered). I will continue my testing ;)

EDIT: Well.. I have bad news. Just fought a merchant and went for the flagship. They still all surrendered when the flagship surrendered.
 
Well.. I have bad news. Just fought a merchant and went for the flagship. They still all surrendered when the flagship surrendered.
Thanks for trying anyway. Your observation matched with @Grey Roger's as well, so it seems that despite my part of the code doing exactly what it is supposed to, something still goes wrong.
To be investigated further. At some undetermined point in the future due to our perpetual lack of manpower (especially from my own side....).
 
Another thing that might be related to this one: Fought a battle against some merchants, boarded the flagship, that surrendered during fighting, afterwards all remaining enemy ships were neutral as expected. Reload helped, the battle went on, boarded the second one, surrendered as well, this time i was civilized to the enemy captain, took over the most interisting cargo and went on; now the strange thing, on the minimap the ship turned grey, but the other enemy ships started to shooting on this ship, so somehow for the enemy ships the ship that surrendered was not turning neutral but belonged to me although i didn´t take it over... Will try to confirm this in a similar encouter so far i havent realised such behaviour before...
 
This is already known. As soon as any enemy ship surrenders, their former mates will try to sink them (for their betrayal ;P ) ;)
 
It's new to me! :shock

Should not be possible; Neutral Nation should be neutral to everyone.
So the whole surrender needs even more serious looking at.

Just to be sure, which exact mod version are you playing?

Also, do only flagships get attacked by their own after they surrender?
 
No. Every ship with a white flag gets attacked by its former mates (but wont get attacked anymore by former enemies). Only those who have been boarded (or surrendered while being boarded) are "out of the battle". I thought you know :shock this "bug" is there like.. forever? Can't remember any build version which didnt hat this effect.
 
I honestly had no clue.
That's not a pretty bug! This whole surrendering business requires looking at!!!
 
Just to be sure, which exact mod version are you playing?

Also, do only flagships get attacked by their own after they surrender?
Game Version is your exe from the 23rd of September with additionally Lewis latest fix from the 7th of October.

Can´t tell anymore if it was a flagship, the original one surrendered before, all other ships went neutral, i saved and reloaded. After the next ship surrendered, this one was attacked, but maybe it was the "new" flagship.

No. Every ship with a white flag gets attacked by its former mates (but wont get attacked anymore by former enemies). Only those who have been boarded (or surrendered while being boarded) are "out of the battle". I thought you know :shock this "bug" is there like.. forever? Can't remember any build version which didnt hat this effect.
This was different for me, I boarded the ship, while boarding it surrendered, and i just took the cargo and one of the abilities you can get from surrendered captains.
 
Back
Top