• 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 False Flags: Modify Memory Functionality

But what is the part that seems wrong to you? I read through that 1.5 times and I must be missing something.
Code:
FLAGS: The 'Santiago Fort' has spotted us at 696.52 and will remember us as Pirate in Shnyava2 with visibility=867.5
[...]
FLAGS: The 'Santiago Fort' remembered us as having Shnyava2, which we no longer have.
^ There it also seems like it is doing exactly what you meant it to.
To some extent, yes. Except that the fort saw me pirate the SP_CastelF. Anyway, I added your modifications from post 78 and the problem is solved. At least, it is now.

After adding those modifications I tested it by reloading my Playa de Sierra Maestra savegame, capturing the payroll ship, then going away and pirating something else. When I returned to Santiago I wasn't attacked and "compile.log" correctly reported that Santiago fort remembered me being in a SP_CastelF which I no longer had. Then I reloaded the savegame, captured the payroll ship, went away and did not get a new ship, and returned to Santiago. The fort still didn't attack me and "compile.log" still reported that the fort remembered me being in a SP_CastelF which I no longer had. Huh?

This is why:
Code:
     compidx = GetCompanionIndex(GetMainCharacter(), n);
     if (compidx > 0)
That made "HasThisShip" fail. You are companion index 0! So that condition didn't allow your own ship to be checked. Changing it to 'if (compidx >= 0)' solved the problem. I ran the test both ways again and it worked perfectly - the fort forgot me and did not attack if I returned with a different ship, but it remembered me and did attack if I returned with the SP_CastelF. It's probably the only time when I've been glad to see a fort shooting at me. xD

Should the ResetCharacterMemory not be triggered only within visible range? Otherwise they'd forget even if they don't even know you're there.
And when they do forget, shouldn't they immediately remember your new ship and flag instead?
I merely put the forget code in the same place as the remember code. If it can remember your ship then it can forget because you don't have it any more. When you next come within visible range, if you give them reason to remember your new ship then that's when they'll remember it. If you don't come within visible range then it doesn't really matter.

While Hylie's example was definitely surprising, as I said earlier, I don't see it as being actually wrong.
For all that fort knows, the flag you flew last time was actually true. Which means that now you're an enemy because war has been declared.
They don't know it was a false flag. There was no need to use that flag, so that makes it a player mistake, not an issue with the system.
It wasn't a player mistake - he's not to know that some time in the future Portugal and France will go to war, so at the time it was fine. Another possible scenario is if you're on good terms with Portugal and Holland, they're on good terms with each other, you've just come from Kralendijk so you're flying a Dutch flag, and you're planning on going back soon so there's no reason to change to Portuguese. If Sao Jorge remembers you as Dutch and Portugal later goes to war with Holland, you're in trouble next time you visit Sao Jorge even though you've personally done nothing against Portugal. But if Sao Jorge doesn't care about you when it sees you as a friend then, provided you don't do anything to provoke them, it still won't care if you return as a friend.

Reading Hornblower, those crews can recognize specific ships (with names!) when they appear at the horizon, quite literally "from the cut of their jibs", e.g. from their rigging.
So if ship crews can do that, it isn't such a stretch that a fort could maintain some sort of log of all ships that it sees.
Maybe increase visibility ranges again? Anyway, I suspect that's rather optimistic because even in WW2 with better optics, it wasn't that easy to identify a ship properly until it got rather closer. That's from reading books written by the ships' officers about real events, not fiction. ;)

Probably this wouldn't be 100% watertight as ship identification systems and record keeping at the time must have been less good than they are now.
But still, I imagine they would have given it their best shot.
If they did that, they'd end up with so much paper that they'd never have been able to find the record of the ships which were actually important, i.e. the ones they knew to be suspicious.

On the other hand, thinking about it a bit more, I'm inclined to agree with you on making the memory depend on model rather than type, provided a default model is indeed assigned where none is specified in the ship's own entry in "Ships_init.c". My analogy with a crook repainting a car to avoid detection would be valid if repainting the ship was as much of an effort as repainting a car to a good enough standard to be convincing, which it isn't; and anyway, detecting model rather than type doesn't get in the way of doing what I want to do, which is go away, pirate something else, then return and the fort doesn't remember me as I'm not in the ship it saw me steal.

So, pending a test of whether "GetCharacterShipModel" works as intended, try this version. Friendly ships still aren't remembered but ships which are worth remembering should now be remembered by model rather than type.
 

Attachments

  • Screwface_functions.c
    24.2 KB · Views: 270
To some extent, yes. Except that the fort saw me pirate the SP_CastelF. Anyway, I added your modifications from post 78 and the problem is solved. At least, it is now.
Apparently then the fort did NOT see you pirate the SP_CastelF or the ship type was not properly updated.

After adding those modifications I tested it by reloading my Playa de Sierra Maestra savegame, capturing the payroll ship, then going away and pirating something else. When I returned to Santiago I wasn't attacked and "compile.log" correctly reported that Santiago fort remembered me being in a SP_CastelF which I no longer had. Then I reloaded the savegame, captured the payroll ship, went away and did not get a new ship, and returned to Santiago. The fort still didn't attack me and "compile.log" still reported that the fort remembered me being in a SP_CastelF which I no longer had. Huh?

This is why:
Code:
compidx = GetCompanionIndex(GetMainCharacter(), n);
if (compidx > 0)
That made "HasThisShip" fail. You are companion index 0! So that condition didn't allow your own ship to be checked. Changing it to 'if (compidx >= 0)' solved the problem. I ran the test both ways again and it worked perfectly - the fort forgot me and did not attack if I returned with a different ship, but it remembered me and did attack if I returned with the SP_CastelF. It's probably the only time when I've been glad to see a fort shooting at me. xD
Ah, yes; it would do that. :facepalm

For reference, this is how I usually handle that (example from console.c):
Code:
for (i = 0; i <= GetCompanionQuantity(PChar); i++) {
limit = GetCompanionIndex(PChar, i);
if (limit < 0) continue;
ch = GetCharacter(limit);
GiveShip2Character(ch,ch.ship.type,ch.ship.name,-1,ch.ship.stats.nation,true,true);
}
Then it does work for number 0 too.

I merely put the forget code in the same place as the remember code. If it can remember your ship then it can forget because you don't have it any more. When you next come within visible range, if you give them reason to remember your new ship then that's when they'll remember it. If you don't come within visible range then it doesn't really matter.
If they can forget even when you pass at 30 miles in your new ship, isn't that rather "magical"?

I do agree that it is unlikely for you to then return with your old ship again later on; but you never do know, so I wouldn't rule it out.

It wasn't a player mistake - he's not to know that some time in the future Portugal and France will go to war, so at the time it was fine. Another possible scenario is if you're on good terms with Portugal and Holland, they're on good terms with each other, you've just come from Kralendijk so you're flying a Dutch flag, and you're planning on going back soon so there's no reason to change to Portuguese. If Sao Jorge remembers you as Dutch and Portugal later goes to war with Holland, you're in trouble next time you visit Sao Jorge even though you've personally done nothing against Portugal. But if Sao Jorge doesn't care about you when it sees you as a friend then, provided you don't do anything to provoke them, it still won't care if you return as a friend.
Other example:
You are a proud English naval officer who only flies an English flag. England and France are neutral and you sail into a French port under your English flag.
Later, England and France declare war on each other. Next time you want to get into the French port using the same ship, you use a false French flag.
The fort then opens fire on you because they remember you as English (which is true) and therefore now an enemy (which is also true).
In other words: The fort is quite right to do so.

This is the exact same situation as Hylie's and your examples. It is therefore not wrong. Using different nation flags actually means something.
If you pretend to belong to a certain nation, why is it so strange when forts/ships believe you and subsequently treat you as if you do belong to that nation?

If you don't want those difficulties, either:
1. Use the flag of your actual served nation so that the nation ships and forts believe you to be is actually correct.
2. Use the flag of the nation whose fort you are approaching. Then for all they know, you're one of their own.
3. For non-hostile ports, you can use your Personal Flag as well. That is never false anyway.

Based on @Hylie Pistof's description earlier, I think he should probably start the game AS Personal Nation.
Then only the Pirates are hostile and random relation changes do not affect you much at all.
In other words: That allows you a relatively simple way to play the game, especially as honest merchant, that bypasses most complex nation relations.

That seems a much better solution to me than to actually bypass functionality that for all intents and purposes IS correct.

So yes, I stand by my earlier claim that this WAS a player mistake.

Maybe increase visibility ranges again? Anyway, I suspect that's rather optimistic because even in WW2 with better optics, it wasn't that easy to identify a ship properly until it got rather closer. That's from reading books written by the ships' officers about real events, not fiction. ;)
WW2 ships were probably mass-produced and would look much more similar to each other than sailing vessels.
So I'm not convinced you can directly compare those periods.

If they did that, they'd end up with so much paper that they'd never have been able to find the record of the ships which were actually important, i.e. the ones they knew to be suspicious.
That's why I said it wouldn't have been 100% watertight. But that doesn't mean it wasn't possible and wasn't done.
Even if it isn't "the fort" that does it, isn't it the harbour master's job to keep a record of relevant ships?

If you want realism, my earlier suggestion of "forget after a certain period" makes a lot more sense to me than "don't remember at all".
So I'd rather keep the memory functionality intact, because it isn't actually wrong, and at some time in the future maybe add that extra level of realism.

On the other hand, thinking about it a bit more, I'm inclined to agree with you on making the memory depend on model rather than type, provided a default model is indeed assigned where none is specified in the ship's own entry in "Ships_init.c".
That does happen. You can see the code that does that near the bottom of ships_init.c . :yes

My analogy with a crook repainting a car to avoid detection would be valid if repainting the ship was as much of an effort as repainting a car to a good enough standard to be convincing, which it isn't; and anyway, detecting model rather than type doesn't get in the way of doing what I want to do, which is go away, pirate something else, then return and the fort doesn't remember me as I'm not in the ship it saw me steal.
I would probably be fine with the "repainting" option if that would actually cost money and/or take time.
Right now it is free and happens instantly, which is fine for a visual thing, but becomes silly when it is actually relevant to game functionality.

So, pending a test of whether "GetCharacterShipModel" works as intended, try this version. Friendly ships still aren't remembered but ships which are worth remembering should now be remembered by model rather than type.
Cool! :cheers
 
Apparently then the fort did NOT see you pirate the SP_CastelF or the ship type was not properly updated.
It certainly saw me pirate the SP_CastelF. The ship type was not properly updated. It is now. That's due to the modifications you proposed to "Screwface_functions.c" earlier. :onya

If they can forget even when you pass at 30 miles in your new ship, isn't that rather "magical"?

I do agree that it is unlikely for you to then return with your old ship again later on; but you never do know, so I wouldn't rule it out.
Perhaps put a check for visible range around the whole section:
Code:
    else
    {
        if (ship_range < visibility_range) // <---
        {
            if (!HasThisShip(chr.PlayerShip))
            {
                Trace("FLAGS: The " + GetMyShipNameShow(chr) + " remembered us as having " + chr.PlayerShip + ", which we no longer have.");
                ResetCharacterMemory(chr);
            }
            else
            {
                iNation = sti(chr.PlayerNation);
                Trace("FLAGS: The " + GetMyShipNameShow(chr) + " remembers us as " + GetNationDescByType(iNation) );
            }
        }
        else
        {
            Trace("FLAGS: The " + GetMyShipNameShow(chr) + " is out of range so can neither remember nor forget us");
        } // <--
     }
So it either remembers or forgets you only if it's actually seen you.

Other example:
You are a proud English naval officer who only flies an English flag. England and France are neutral and you sail into a French port under your English flag.
Later, England and France declare war on each other. Next time you want to get into the French port using the same ship, you use a false French flag.
The fort then opens fire on you because they remember you as English (which is true) and therefore now an enemy (which is also true).
In other words: The fort is quite right to do so.
Ideally the system could take account of whether you'd visited the port in a conspicuous warship or an inconspicuous freighter, or whether you're wearing a naval uniform. A warship from a foreign nation is of interest even if that nation is friendly, whereas a humble merchant is not.

Also, since you already quoted Hornblower, recall that when Hornblower chooses to be returned to the Spanish prison, Indefatigable approaches under a flag of truce. We don't have that, so the only way to indicate peaceful intent is to fly a friendly false flag. It's not as though you can go there on a spying mission, except perhaps in some storylines.

This is the exact same situation as Hylie's and your examples. It is therefore not wrong. Using different nation flags actually means something.
If you pretend to belong to a certain nation, why is it so strange when forts/ships believe you and subsequently treat you as if you do belong to that nation?

If you don't want those difficulties, either:
1. Use the flag of your actual served nation so that the nation ships and forts believe you to be is actually correct.
2. Use the flag of the nation whose fort you are approaching. Then for all they know, you're one of their own.
3. For non-hostile ports, you can use your Personal Flag as well. That is never false anyway.
Option 1 won't help if you later want to get in under a false flag. Option 2 is fine, but really the fort shouldn't care if you are under someone else's friendly flag unless there's a good reason to do so.

WW2 ships were probably mass-produced and would look much more similar to each other than sailing vessels.
So I'm not convinced you can directly compare those periods.
I'm thinking more of the time when a German heavy cruiser (or, informally, a "pocket battleship") pretended to be a British cruiser in order to approach a British merchant ship without that ship sending a distress signal. Presumably you're not going to try to claim that the Admiral Scheer came off the same production line as a County class cruiser. xD

That's why I said it wouldn't have been 100% watertight. But that doesn't mean it wasn't possible and wasn't done.
Even if it isn't "the fort" that does it, isn't it the harbour master's job to keep a record of relevant ships?

If you want realism, my earlier suggestion of "forget after a certain period" makes a lot more sense to me than "don't remember at all".
So I'd rather keep the memory functionality intact, because it isn't actually wrong, and at some time in the future maybe add that extra level of realism.
That would be fine. I seem to recall you having trouble with actually implementing it, though. But if you can get the time limit to work, it could indeed be used for friendly ships. Maybe increase the time period if the fort recognised you as hostile, also increase it if your ship has the "Type.War" trait - warships and dual-purpose ships are more noteworthy than plain merchants. You also had the idea to make the length depend on how hostile the fort is, -60 is just routine for nations at war whereas -119 means you've actively been attacking them. But until then, I really think friendly ships shouldn't be remembered.
 
Last edited:
It certainly saw me pirate the SP_CastelF. The ship type was not properly updated. It is now. That's due to the modifications you proposed to "Screwface_functions.c" earlier. :onya
Ah, that would explain it too! :cheeky

Perhaps put a check for visible range around the whole section:
Code:
else
{
if (ship_range < visibility_range) // <---
{
if (!HasThisShip(chr.PlayerShip))
{
Trace("FLAGS: The " + GetMyShipNameShow(chr) + " remembered us as having " + chr.PlayerShip + ", which we no longer have.");
ResetCharacterMemory(chr);
}
else
{
iNation = sti(chr.PlayerNation);
Trace("FLAGS: The " + GetMyShipNameShow(chr) + " remembers us as " + GetNationDescByType(iNation) );
}
else
{
Trace("FLAGS: The " + GetMyShipNameShow(chr) + " is out of range so can neither remember nor forget us");
}
} // <--
}
So it either remembers or forgets you only if it's actually seen you.
You may want to correct the nesting of your if-statements there. You currently have an "if-else-else".
But I get what you mean and that is indeed pretty much what I was after. :yes

The actual storing of the memory should probably be in that same section too, though.
Can't remember anything if you don't see it. ;)

Ideally the system could take account of whether you'd visited the port in a conspicuous warship or an inconspicuous freighter, or whether you're wearing a naval uniform. A warship from a foreign nation is of interest even if that nation is friendly, whereas a humble merchant is not.
For the time being, I am just going with some simple "ship = ship" logic. Whether it's a warship or a merchant doesn't matter.
For all intents and purposes, merchants should have absolutely zero need for false flags anyway.
So if a merchant DOES start using false flags, I don't mind there being potential consequences to that.

Also, since you already quoted Hornblower, recall that when Hornblower chooses to be returned to the Spanish prison, Indefatigable approaches under a flag of truce. We don't have that, so the only way to indicate peaceful intent is to fly a friendly false flag. It's not as though you can go there on a spying mission, except perhaps in some storylines.
A friendly false flag does not signify "peaceful intent".
False flags are for when you want to secretly get into hostile ports or get close to ships that normally would be rather unhappy with you approaching them.
If you are actually friendly to a certain nation, there is no need to use false flags at all. If you do, then you're confusing them.
So it comes as no surprise that they can potentially confuse you for an enemy later on either.

Actually, there IS a "flag of trace" option in the PotC game code: The white flag.
This currently has no function for the player ship and has therefore been deliberately disabled.
But it does still exist and if we ever get to it, we can make it into a proper feature and re-enable it.

Option 1 won't help if you later want to get in under a false flag. Option 2 is fine, but really the fort shouldn't care if you are under someone else's friendly flag unless there's a good reason to do so.
Regarding Option 1, if you can safely get into a port under your own flag, why bother using a false one?
Sure you can, but it is pointless and confusing.

As for Option 2, the fort doesn't care if you use someone else's friendly flag if you yourself are also friendly.
They just don't know what nation you really are and therefore end up thinking you belong to that other nation.
Can't blame them later for still believing that what you showed them was actually not quite true.
Yes, they're wrong to be confused. But THEY don't know that. This is why the "pay governor to make forts forget" option exists.

I'm thinking more of the time when a German heavy cruiser (or, informally, a "pocket battleship") pretended to be a British cruiser in order to approach a British merchant ship without that ship sending a distress signal. Presumably you're not going to try to claim that the Admiral Scheer came off the same production line as a County class cruiser. xD
Maybe not identical, but they might still appear similar. WW2 era ships also have much less details to recognize them by, making them more ambiguous.
Not to mention that warships are all grey, a colour that is specifically used because it does not stand out against the sea.
Plus they're lower, so can be spotted later than the masts of a sailing vessel.

Long story short: I am quite willing to believe that it is easier to tell sailing vessels apart than WW2 era motor vessels.

That would be fine. I seem to recall you having trouble with actually implementing it, though.
I didn't actually start on doing that. All I did was a quick investigation to see if what I had in mind might be easy. It isn't as simple as I had hoped though.
If I had the time, energy and enthusiasm, I know I could make it work. But I don't have any of that. Rather the opposite.

And while I do believe it would be an improvement that eventually should be added, I don't see why it needs to be a high priority.
The current system as it is in Beta 4.0 works as it was intended to. Whatever "weird effects" are perceived with it aren't actually wrong.
Plus there are workarounds available, both within the game and as "console cheats".

Not to mention that the lack of reponse on my often repeated question "Do people want a simplified mode and how should that work?" now means that I no longer care.
I've given chances aplenty for people to influence what I was doing at the time I was doing it. And then I asked several times afterwards again.
As far as I'm concerned, now it is too late. The opportunite has come and gone.

But until then, I really think friendly ships shouldn't be remembered.
I'm afraid I do not agree. Having the memory for ALL ships makes perfect sense to me.
I said it before and I stand by it: The effect may not be what you might want, but it isn't wrong.

If you want to have it like that, feel free to make it happen. With a toggle on it.
As long as it is me doing the modpack compilation, I'll keep the default setting how I myself prefer it.
But at least people who don't like it then have the opportunity to change it. I have no objection to that.
 
You may want to correct the nesting of your if-statements there. You currently have an "if-else-else".
But I get what you mean and that is indeed pretty much what I was after. :yes
It's a pity that "Tab" doesn't work when formatting posts, so indents have to be done with spaces. I've edited the post so hopefully it looks more correct now.

The actual storing of the memory should probably be in that same section too, though.
Can't remember anything if you don't see it. ;)
No, but the 'else' at the top of that quoted piece of code is the alternative to a condition which checks whether the fort / ship already has the "PlayerNation" or "PlayerShip" attributes. The code on the other side of that 'else' is where the memory is stored, and has its own check for visibility. This bit is for where the fort / ship already remembers you and is deciding whether to keep remembering you.

For the time being, I am just going with some simple "ship = ship" logic. Whether it's a warship or a merchant doesn't matter.
I did say "ideally". ;) It would get messy trying to add these extra factors.

A friendly false flag does not signify "peaceful intent".
False flags are for when you want to secretly get into hostile ports or get close to ships that normally would be rather unhappy with you approaching them.
If you are actually friendly to a certain nation, there is no need to use false flags at all. If you do, then you're confusing them.
So it comes as no surprise that they can potentially confuse you for an enemy later on either.

Actually, there IS a "flag of trace" option in the PotC game code: The white flag.
This currently has no function for the player ship and has therefore been deliberately disabled.
But it does still exist and if we ever get to it, we can make it into a proper feature and re-enable it.
So, at the moment we have no flag of truce and the only way to signal peaceful intent is to use a false flag.

Regarding Option 1, if you can safely get into a port under your own flag, why bother using a false one?
Sure you can, but it is pointless and confusing.
To avoid micromanaging when it's not apparently necessary. For example, shuttling between Kralendijk and Sao Jorge when Portugal and Holland are at peace.

Maybe not identical, but they might still appear similar. WW2 era ships also have much less details to recognize them by, making them more ambiguous.
Not to mention that warships are all grey, a colour that is specifically used because it does not stand out against the sea.
Plus they're lower, so can be spotted later than the masts of a sailing vessel.
WW2 ships might have been proportionately lower than sailing ships. Actual size is another matter. HMS Indefatigable - the real one, originally a 3rd rate ship of the line until it was razeed down to a heavy frigate - was 48.8m long at the gundeck and had a little over 1384 tons burthen. HMS Suffolk, a County class cruiser, was 190m long and had 13450 tons burthen. Also, WW2 ships had a couple of masts - maybe not the complex masts seen on a sailing ship, but that just means they'd have been easier to distinguish at long range. As for less details, that may be true for earlier era ships but certainly not for "Napoleonic" period. For example - quickly, what sort of ship hull is this?
whatisit.jpg

Not to mention that the lack of reponse on my often repeated question "Do people want a simplified mode and how should that work?" now means that I no longer care.
I've given chances aplenty for people to influence what I was doing at the time I was doing it. And then I asked several times afterwards again.
As far as I'm concerned, now it is too late. The opportunite has come and gone.
Alright: no, I'm not particularly bothered about a simplified mode, the reason being I always play in "Realistic" mode to get the superior sailing model. But:
You want something different and aren't going to make the required changes yourself?
Then really the very least you can do is to describe quite clearly what it is that you want.
I did describe what I wanted and I did make it happen. One is being overridden and the other looks as though it will be overwritten. That doesn't provide much incentive to do it again...

If you want to have it like that, feel free to make it happen. With a toggle on it.
As long as it is me doing the modpack compilation, I'll keep the default setting how I myself prefer it.
But at least people who don't like it then have the opportunity to change it. I have no objection to that.
How do I go about setting up such a toggle?
 
It's a pity that "Tab" doesn't work when formatting posts, so indents have to be done with spaces.
Very true. :facepalm

I've edited the post so hopefully it looks more correct now.
It most certainly does. :onya

No, but the 'else' at the top of that quoted piece of code is the alternative to a condition which checks whether the fort / ship already has the "PlayerNation" or "PlayerShip" attributes. The code on the other side of that 'else' is where the memory is stored, and has its own check for visibility. This bit is for where the fort / ship already remembers you and is deciding whether to keep remembering you.
Eventually I should probably have a good think about it.
I was considering now also if perhaps part of this functionality should go with the periodic "false flag detection" instead, but I'm unsure of that.

Imagine if a fort or ship "remembers you as an enemy" for whatever reason, but you're flying a flag friendly to them.
At the moment that "memory" takes presedence over anything else, which means that they will turn hostile IMMEDIATELY, even when you're 30 miles away.
Logically, they should only turn hostile once you actually get within visible range to them. That should be possible by moving that to the "false flag detection".

But should we want that?

I did say "ideally". ;) It would get messy trying to add these extra factors.
Yep.

So, at the moment we have no flag of truce and the only way to signal peaceful intent is to use a false flag.
Fly their own flag. Or your Personal flag, assuming that they're not actually hostile to you.

To avoid micromanaging when it's not apparently necessary. For example, shuttling between Kralendijk and Sao Jorge when Portugal and Holland are at peace.
Assuming that the player is also not hostile to Portugal and Holland, then using your Personal flag serves that purpose perfectly well.

If you do want to play for a specific nation, then I suggest sticking with that nation's flag.
That does mean that if Portugal and Holland declare war, you will no longer be free to sail into Sao Jorge.
But that only makes sense and I see nothing wrong with that.

WW2 ships might have been proportionately lower than sailing ships. Actual size is another matter. HMS Indefatigable - the real one, originally a 3rd rate ship of the line until it was razeed down to a heavy frigate - was 48.8m long at the gundeck and had a little over 1384 tons burthen. HMS Suffolk, a County class cruiser, was 190m long and had 13450 tons burthen. Also, WW2 ships had a couple of masts - maybe not the complex masts seen on a sailing ship, but that just means they'd have been easier to distinguish at long range.
I will not claim to be an expert on either time period. Just arguing that recognizing isn't that far-fetched.

For example - quickly, what sort of ship hull is this?
Frigate. Ish. Sort of thing. :razz

I did describe what I wanted and I did make it happen.
And I very much appreciate that too! :onya

That doesn't provide much incentive to do it again...
My reason for disagreeing with some of your suggestions is mainly out of PERSONAL PREFERENCE though and not because you are actually wrong.
In fact, you're perfectly right to prefer things the way you describe. I am just also quite right about my own reasons and preferences.

Basically all I am saying is that, since I agree with some of your changes, but not all of them,
I don't think the changes I don't agree with should become the "Build default" based on the feedback of just 1-2 people.

How do I go about setting up such a toggle?
Adding a #define at the top of InternalSettings.h should be easy enough. For example:
Code:
#define SIMPLIFIED_NATION_RELATIONS 1
Then you can use:
Code:
if (SIMPLIFIED_NATION_RELATIONS)
{
// put your stuff here
}
else
{
// put my stuff here
}
Of course it doesn't need to look exactly like that. It could also be if (something || SIMPLIFIED_NATION_RELATIONS) in various spots.
Depends on what things you want to have different. It is all straightforward if-then-else logic though, so you should be fine. :doff

If you want to link it to realism modes or the ingame preferences menu, then some more tweaking is required.
Once the actual #define toggle is in place, linking it to other stuff isn't that big of a step afterwards. I'll happily help you with that.
 
Eventually I should probably have a good think about it.
I was considering now also if perhaps part of this functionality should go with the periodic "false flag detection" instead, but I'm unsure of that.

Imagine if a fort or ship "remembers you as an enemy" for whatever reason, but you're flying a flag friendly to them.
At the moment that "memory" takes presedence over anything else, which means that they will turn hostile IMMEDIATELY, even when you're 30 miles away.
No it won't, the reason being there's a check for visibility in both the section which assigns a memory to a fort / ship has none, and in the section in which it remembers or forgets you. So in both sections, if you're out of visible range then nothing happens.

I'm assuming that the function gets called again when you enter visible range.

Fly their own flag. Or your Personal flag, assuming that they're not actually hostile to you.
Their own flag is a false flag for you. As for Personal flag, some people like the concept but I'm not one of them, and being required to use it is sufficient grounds for me to revert to an earlier version and stay there.

If you do want to play for a specific nation, then I suggest sticking with that nation's flag.
That does mean that if Portugal and Holland declare war, you will no longer be free to sail into Sao Jorge.
But that only makes sense and I see nothing wrong with that.
On the other hand, if you're a privateer with multiple LoM's and therefore no single served nation then you use whatever flag is convenient, and continually switching between Portuguese and Dutch flag starts to look like micromanagement.

Frigate. Ish. Sort of thing. :razz
And that's my point. Napoleonic era ships are very similar. (Which, incidentally, is one reason why I set "Ardent" in "Golden Age". More distinctive ship types.) But the general point I got from reading those actual accounts is that at long range it's difficult to make out any detail. Even with 20th century optics you couldn't identify a ship reliably at horizon distance. You certainly wouldn't be able to see its rigging. You might just about be able to see that the nearest mast had three sails instead of two.

My reason for disagreeing with some of your suggestions is mainly out of PERSONAL PREFERENCE though and not because you are actually wrong.
In fact, you're perfectly right to prefer things the way you describe. I am just also quite right about my own reasons and preferences.

Basically all I am saying is that, since I agree with some of your changes, but not all of them,
I don't think the changes I don't agree with should become the "Build default" based on the feedback of just 1-2 people.
Or to put it another way, 100% of the people who have given feedback so far. :p

Adding a #define at the top of InternalSettings.h should be easy enough. For example:
Code:
#define SIMPLIFIED_NATION_RELATIONS 1
Then you can use:
Code:
if (SIMPLIFIED_NATION_RELATIONS)
{
// put your stuff here
}
else
{
// put my stuff here
}
Of course it doesn't need to look exactly like that. It could also be if (something || SIMPLIFIED_NATION_RELATIONS) in various spots.
Right, take a look at these. "InternalSettings.h" now defines "RELATION_IGNORE_FRIENDLY" as 0 by default. The comment says it's a BOOL but I can't see how the #define knows the difference between an INT and a BOOL, so it can easily change to an INT later and possibly change its name if we want to do other things with it. But right now its only use is this line in "Screwface_functions.c":
Code:
if (GetNationRelation(iNation, nNation) == RELATION_ENEMY || RELATION_IGNORE_FRIENDLY == 0)
That's the condition which determines whether a memory will be set - previously only if you're hostile, now also if "RELATION_IGNORE_FRIENDLY" is 0, which by default it is. I routinely change several things in "InternalSettings.h" anyway so one more isn't that much of a hardship. Of course, this means a new game will be needed, which means there wasn't much point in making sure the system is compatible with old savegames. xD
 

Attachments

  • InternalSettings.h
    69 KB · Views: 250
  • Screwface_functions.c
    24.4 KB · Views: 254
NOTE: The following post was written BEFORE I saw @Grey Roger's message above.


Might be worth to take a step back and consider what we've been talking about.
I think there are several separate issues at play, that have different solutions.


@Hylie Pistof's original report: Used the flag of one nation in the port of another nation, which became a problem when those nations declared war
I can imagine it being potentially annoying, but it is a direct and logical consequence of player actions and is exactly what is meant to happen.
This is a very rare occurrence; and will become even more so with @Grey Roger's "changing ship type causes a reset" feature.

Assuming that the nation is not actually hostile, there is an ingame workaround by paying a governor of that nation to make the forts reset again.
If the nation IS hostile, you'll have to buy Amnesty, which is more expensive, but still possible.

Unless you want to be caught out by changing nation relations, I recommend using the flag of the nation whose port you are entering OR (easier) just use your Personal Flag.
As long as you deal only with nations that aren't hostile to you, this is easily the best solution that requires no micro-management.
You can even start the game with Personal Nation, which means NO enemies, except for the Pirates.
In other words: Brilliant situation for traders who don't want to get into the complexity of nation relations.

Verdict: Not a Bug, rare event triggered by specific player actions, valid workaround available within the game, no action required.


Once a fort has recognized your false flag, that fort will remember you until FOREVER
Since you should be using false flags primarily to get near HOSTILE forts (and ships), I am assuming here that the fort is hostile.
As it IS hostile, they're not wrong to fire on you. But that does mean you're "banned" from that town for the rest of the game.
Unless you buy amnesty, that is. But that isn't always feasible.

So while there IS a workaround available in the game (buying amnesty), this effect is far, far worse than the one mentioned above.
I agree this is excessive and something should be done about it. @Grey Roger's "changing ship type causes a reset" feature serves that purpose quite nicely.

Verdict: Needs to be improved, @Grey Roger's work should take care of this


Recognizing and memory is "too good"
This is a side-effect of the current implementation being still relatively simple (yet already complex enough for my liking!).
There is no "forgetting after time" mechanism in place.

Definitely a lack of realism there and ideally something that should be changed in the future.
Unfortunately, implementation is decidedly less than straightforward than I had hoped, so solving this properly will take substantial time and effort.
Fortunately, the effect players will notice from this should be very limited. Even more limited with @Grey Roger's "change ship" feature included.

Verdict: Current situation is an oversimplification, consequences of this are minor, solving it is not simple, therefore Low Priority for "some undetermined time in the future"


As far as I'm concerned, with @Grey Roger's feature included to make ships and forts forget you if you lose the ship model they remember, all pressing issues are taken care of.
Other improvements could be made, but are not high priority.

That is how I see the current state and that seems fair enough to me. :shrug
 
No it won't, the reason being there's a check for visibility in both the section which assigns a memory to a fort / ship has none, and in the section in which it remembers or forgets you. So in both sections, if you're out of visible range then nothing happens.
Ah, I see you added that now. :onya

I'm assuming that the function gets called again when you enter visible range.
It should do now that I made this change:
Code:
         if (!CheckAttribute(chr, "PlayerShip") && ship_range < visibility_range) CheckInitialFlagRelations(chr, visibility_range, ship_range);
         Recognized = CheckForMainCharacterfalseflag(chr, visibility_range, ship_range);

Their own flag is a false flag for you.
Technically, not it is not. If they are not hostile to you, then flying their own flag is not considered a "false flag" by the game.
They're perfectly happy for you to use their flag if you're not hostile to them.

As for Personal flag, some people like the concept but I'm not one of them, and being required to use it is sufficient grounds for me to revert to an earlier version and stay there.
Nobody is saying that are REQUIRED to use it.
If you want to avoid micro-managing AND want to be unaffected by nation relation changes, THEN you would need to use it.
I suggested it mainly for @Hylie Pistof's predicament as I think it should be a near-perfect solution for him.

If you want to play as a loyal citizen of a nation, then you can also stick to your "served nation" flag.
Sure, that may cause consequences when nations turn hostile to your served nation, but that makes complete and utter sense.

If you want to not have that problem, then you can switch flags to match with the port that you are sailing into.
This is micro-managing, but does then do what you want.

If you don't want ANY of the above and are ALSO opposed to using a Personal Flag,
then apparently you deliberately want to not fit into the actual game mechanics.

But I honestly have no clue why you would want that.
If you want to fit in with a certain nation, then having consequences from relations to that nation changing is part of the game.
Otherwise what is the purpose of belonging to a nation and having Changing Nation Relations??? o_O

On the other hand, if you're a privateer with multiple LoM's and therefore no single served nation then you use whatever flag is convenient, and continually switching between Portuguese and Dutch flag starts to look like micromanagement.
No single served nation starts to sound like Personal Flag!
What you describe is basically the exact reason why a "personal flag" exists in the game.

And that's my point. Napoleonic era ships are very similar.
I know that's your point. I'm going along with you there. :cheeky

But the general point I got from reading those actual accounts is that at long range it's difficult to make out any detail. Even with 20th century optics you couldn't identify a ship reliably at horizon distance. You certainly wouldn't be able to see its rigging. You might just about be able to see that the nearest mast had three sails instead of two.
Actual WW2 accounts. Where does the concept that ship crews can recognize a sailing ship from REALLY far away then?
I am inclined to believe that as being potentially true. I myself couldn't do it, but if you spend your whole life around sailing ships, it sounds feasible to me.

Anyway, the "visible distances" we're talking about here in the actual game are not that far at all.
So this discussion is purely academic and I think we're comparing apples to oranges, which makes it maybe fun but somewhat pointless. :razz

Or to put it another way, 100% of the people who have given feedback so far. :p
We have over 400 downloads on Beta 4.0. Assuming that 50% of those people play it and 50% again might be inclined to comment, that is still 100 players.
So the 1-2 people who did comment account for 1-2% and 98% apparently aren't bothered enough to comment.

When have people EVER responded to say they DO like stuff the way it currently is?
To be fair, that does occasionally happen. But only extremely rarely. Mostly people remain silent if they're OK with things.
Shame really; I'd much rather have POSITIVE feedback as well. But fact is that any feedback is virtually always negative.
Which does not at all mean that the "general consensus" is also negative.

Right, take a look at these. "InternalSettings.h" now defines "RELATION_IGNORE_FRIENDLY" as 0 by default.
Works for me! :cheers

The comment says it's a BOOL but I can't see how the #define knows the difference between an INT and a BOOL
It doesn't know. That comment is just to clarify its use for the players.

Extending it with additional levels or renaming it in the future should indeed be easy enough. :onya

this means a new game will be needed
What, why? I can think of no reason at all why a new game should be required for that. :shock
 
No single served nation starts to sound like Personal Flag!
What you describe is basically the exact reason why a "personal flag" exists in the game.
Or I'm playing as one of the not-quite-pirate privateers who in reality took several LoM's and then switched flags as and when it was convenient. So although I'm PERSONAL_NATION for game purposes, I still never use a Personal flag.

(Lots of stuff deleted as the argument is hopefully about to be settled by the toggled memory function so everyone gets what he wants. Toggles are good for that. :D)

Works for me! :cheers
Provided, of course, that it does in fact work. Testing time...

What, why? I can think of no reason at all why a new game should be required for that. :shock
Wouldn't a savegame in which "RELATION_IGNORE_FRIENDLY" has not been defined cause an error message when "Screwface_functions.c" tries to check it?
 
Or I'm playing as one of the not-quite-pirate privateers who in reality took several LoM's and then switched flags as and when it was convenient. So although I'm PERSONAL_NATION for game purposes, I still never use a Personal flag.
I think then technically you would indeed need to do the micromanaging.
Or stick to one flag friendly to all those nations you serve and IF relations between those nations turn hostile, pay the money to reset it.
That isn't very likely to happen anyway.

And even if it does, now you're serving two nations that are hostile to each other,
so you'll probably have some additional worries to deal with.

I wonder how the "multiple LoMs" work out in the game. Having a LoM from all nations in an alliance should be quite safe.
But if any of the nations drop out of the alliance, the next step could be hostility. So at least you get some "advance warning".
Of course they might just as well join the alliance again. You never do know with the changes being random....

(Lots of stuff deleted as the argument is hopefully about to be settled by the toggled memory function so everyone gets what he wants. Toggles are good for that. :D)
Yep. Whenever we can get away with not having a toggle, I do prefer that. But in some cases, having one is the only good solution.
This is definitely one of those cases. :onya

Provided, of course, that it does in fact work. Testing time...
Good luck! I really hope it does, because this is a definite improvement.
And please also accept my gratitude to you for working on this; much appreciated! :cheers

Wouldn't a savegame in which "RELATION_IGNORE_FRIENDLY" has not been defined cause an error message when "Screwface_functions.c" tries to check it?
That does apply to options that need to show in the ingame menu, but #defines are initialized when you start ENGINE.exe and not saved in savegames at all.
So you should be fine for savegame compatibility. :yes
 
I wonder how the "multiple LoMs" work out in the game. Having a LoM from all nations in an alliance should be quite safe.
But if any of the nations drop out of the alliance, the next step could be hostility. So at least you get some "advance warning".
Of course they might just as well join the alliance again. You never do know with the changes being random....
Yes, I know. That's what makes playing a multi-LoM privateer interesting - you need to keep an eye on international relations.

Good luck! I really hope it does, because this is a definite improvement.
It works, sort of. The toggle certainly works. If I approach port under a friendly flag with "RELATION_IGNORE_FRIENDLY" set to 0 and then check "compile.log", it shows the fort remembering me. If I do the same with "RELATION_IGNORE_FRIENDLY" set to 1, "compile.log" shows the fort ignoring me. But that's if I exit worldmap next to the port.

Memories are not updated if you start out of visible range and then close in. I moved my ship on the worldmap to be well away from the port but still in range of the island, went to 3D sailing, then Sailed-To the port. "compile.log" showed the fort ignoring me because I was out of range, then had no further memory-related logs before I docked at the port. However, it's not as bad an exploit as I'd feared because if the fort sees you with a hostile flag then it attacks anyway. So you can't enter 3D sailing under a pirate flag, have the fort ignore you due to range, and then Sail-To port and wave the pirate flag in the fort's face. It does mean the fort won't remember you as a pirate, though.

Evidence: several "compile.log" files renamed to make them distinct.

In "compile_arrive_out_of_range.log", observe "The 'Santiago Fort' is out of range so can neither remember nor forget us", then no further "FLAGS" reports before "ItemLogic: On load location Santiago_port".

In "compile_ignore_friendly.log", "The 'Port Royale Fort' has spotted us at 159.17but is not interested as we are not hostile", and a few ships report the same. (A space needs to be added to the relevant trace line, in front of "but".)

In "compile_remember_friendly.log", "The 'Port Royale Fort' has spotted us at 155.41 and will remember us as Spanish in Indiaman with visibility=430." So do some ships. I got a bit worried at first when the fort started firing but it wasn't a problem because the fort wasn't aiming at me, even though it put a few holes in my sails. What it was aiming at was Bravo and Pompée, which were a couple of suicide pirates.
 

Attachments

  • compile_arrive_out_of_range.log
    5.8 KB · Views: 222
  • compile_ignore_friendly.log
    4.9 KB · Views: 220
  • compile_remember_friendly.log
    4.4 KB · Views: 225
Last edited:
Yes, I know. That's what makes playing a multi-LoM privateer interesting - you need to keep an eye on international relations.
:onya

Memories are not updated if you start out of visible range and then close in.
Dammit, I had hoped this additional line would have taken care of that:
Code:
if (!CheckAttribute(chr, "PlayerShip") && ship_range < visibility_range) CheckInitialFlagRelations(chr, visibility_range, ship_range);
But indeed that would only set it if you approach and it hadn't been already set.
If it HAS already been set though, it doesn't trigger another update. So not quite good enough....

Not entirely sure what would be the best way of solving that though.
Ideally it should be:
Code:
if (ship_range == visibility_range) CheckInitialFlagRelations(chr, visibility_range, ship_range);
Then it would do a single update when you are AT the visibility range. But there is no guarantee that will work, because they're two 'floats' and for them to be exactly equal seems rather unlikely.
Maybe....
Code:
if (abs(ship_range-visibility_range) < 0.1) CheckInitialFlagRelations(chr, visibility_range, ship_range);
That value may need to be changed though as this could result in the function being called either too often or not often enough.

The rate that ship_range changes of course depends on the relative speeds between both ships, so if you approach VERY FAST, then the update doesn't trigger.

Annoying. :diomed
 
:onya


Dammit, I had hoped this additional line would have taken care of that:
Code:
if (!CheckAttribute(chr, "PlayerShip") && ship_range < visibility_range) CheckInitialFlagRelations(chr, visibility_range, ship_range);
But indeed that would only set it if you approach and it hadn't been already set.
If it HAS already been set though, it doesn't trigger another update. So not quite good enough....
I'm not sure if it's even doing that. I tried the same thing at Port Royale. That time "compile.log" said "FLAGS: The 'Port Royale Fort' is out of range and is not checking our flag", which is the message for wanting to set a new memory and not doing so due to being out of range. This is because last time I was at Port Royale, "PlayerShip" hadn't been invented, so although its fort probably has a "PlayerNation" for me, it doesn't have "PlayerShip". Again, having reported me as being out of visible range, it didn't report again when I Sailed-To the port and docked.

Not entirely sure what would be the best way of solving that though.
Ideally it should be:
Code:
if (ship_range == visibility_range) CheckInitialFlagRelations(chr, visibility_range, ship_range);
Then it would do a single update when you are AT the visibility range. But there is no guarantee that will work, because they're two 'floats' and for them to be exactly equal seems rather unlikely.
Maybe....
Code:
if (abs(ship_range-visibility_range) < 0.1) CheckInitialFlagRelations(chr, visibility_range, ship_range);
That value may need to be changed though as this could result in the function being called either too often or not often enough.

The rate that ship_range changes of course depends on the relative speeds between both ships, so if you approach VERY FAST, then the update doesn't trigger.
It's also probably not going to work if you go from beyond visible range straight to the fort as a result of Sail-To.
 
I'm not sure if it's even doing that. I tried the same thing at Port Royale. That time "compile.log" said "FLAGS: The 'Port Royale Fort' is out of range and is not checking our flag", which is the message for wanting to set a new memory and not doing so due to being out of range. This is because last time I was at Port Royale, "PlayerShip" hadn't been invented, so although its fort probably has a "PlayerNation" for me, it doesn't have "PlayerShip".
But because the check is on "PlayerShip", it SHOULD trigger if only "PlayerNation" is stored.
And if ship_range < visibility_range is 'true' BEFORE it calls CheckInitialFlagRelations, then it must also be 'true' IN that function.
Bit mysterious because that at least should work.

It's also probably not going to work if you go from beyond visible range straight to the fort as a result of Sail-To.
True. Though that probably triggers a call to RefreshBattleInterface. If that is with 'false', it can be changed with 'true' and then that should solve that.

Still... At the moment I cannot quite think of a 100% watertight solution that also doesn't call the various functions more often than it needs to.
I also don't have time right now to think that through. So if you have any clever ideas, I'm all ears.
The basic concept is that there is RefreshBattleInterface that is called in specific cases when the interface itself should be updated
AND there is also the periodic (once per minute) update that is used for the False Flag Detection.
 
In the various "compile.log" files, there are several "SEA" traces up to "Sea_FirstInit". Then come the "FLAGS" traces indicating the fort and various ships reporting, and in particular the fort reporting out of visible range, followed by "Sea_FirstInit done".

Then come some traces like these:
Code:
Reload: Process started for locator_name = reload_2 and lockedReloadLocator =
reload_cur_island_index = 1
reload_cur_location_index = -1
reload_island_index = -1
reload_location_index = 31
Start reload
PauseAllSounds
ReloadStartFade
DS: Player ship was at sea for 27 days
ReloadEndFade
Those are from "reload.c" and are probably the result of the Sail-To. I wonder if a call to "CheckInitialFlagRelations" or "CheckAllShips" could go in there somewhere?

I never had time to try direct-sailing all the way from out of visible range to within visible range so it may be that the problem only exists after a Sail-To.

The once-per-minute check appears to be in "LogInterface.c", specifically in function "procUpdateTime". That's where a trace in one of the log files, "== Directsail called at 14:14", originated. This was before the "reload" traces and did indeed result in a couple of ships reporting again, but those two also reported being not interested due to not being hostile during the initial reports, which means they were in visible range when I first went to 3D sailing. So "CheckAllShips" does seem to be doing its stuff correctly. It's just not being called after the Sail-To.
 
So "CheckAllShips" does seem to be doing its stuff correctly. It's just not being called after the Sail-To.
Have a look through all the RefreshBattleInterface(false) calls. One of those must be triggered after a Sail-To, because I do believe the needs to update then.
I probably figured that relations don't change when you just move around and set it to 'false', but indeed it should be 'true' because the distances have changed.

Remember that RefreshBattleInterface(true) means that it calls CheckAllShips which in turn calls CheckInitialFlagRelations.
I don't think there is any situation where those subfunctions are called by themselves (except CheckAllShips for a different purpose from LogInterface.c).
But for "CheckInitialFlagRelations", that is always triggered by a battle interface update.
 
One in "sea.c". It's followed by a couple of trace lines which appear in the log files before the reports of fort and ships being outside visual range, so it's probably responsible for those reports and certainly didn't happen as a result of the Sail-To.

One in "option_screen.c". I doubt that has anything to do with this problem!

And in "BattleInterface.c", one a long way down in "BI_Frame":
Code:
    if(bYesUpdateCommand)
   {
     BI_SetCommandMode(-1,-1,-1,-1);
     RefreshBattleInterface(false); // PB: No need updating relations when reload status changes
   }
Plus another couple in "BI_DeleteShip" and "BI_DeadShip", presumably to do with sinking a ship, which I didn't do during the tests at Santiago and Port Royale.

What is "BI_Frame", and specifically what is "bYesUpdateCommand"? By process of elimination, if a "RefreshBattleInterface(false)" needs to be changed to "true" then that's the only one I can't rule out.
 
What is "BI_Frame"
I think that is a function that gets called for every frame update, so several times per second.

specifically what is "bYesUpdateCommand"?
Looks to be a boolean to determine if the battle interface actually needs to be changed.
For example, if:
- You could not board a ship/fort, but now you can (or the other way around)
- You could reload to shore/fort/map before, but now you can't (or the other way around)
 
I've done some investigating and apparently Sail-To does NOT directly trigger a RefreshBattleInterface at all.
Probably the update relies on that "bYesUpdateCommand" instead so it only gets triggered IF something changed.

In addition, I found where the Sail-To is actually triggered and ends.
Managed to trace it all the way to the bottom of SeaAI_SailToEndFade in PROGRAM\SEA_AI\AISea.c .
That is where it gets taken over by the game engine itself and I lose track of it.

Unfortunately placing the RefreshBattleInterface there also doesn't work.
It does get triggered when you do a Sail-To, but despite being near the end of the process,
it is still TOO EARLY and it therefore happens with the old distances.

The only way around that would be to set a variable/player attribute and then trigger it at the next minute or something if that has been set.
Maybe that would work.

That still doesn't tell us how to handle it when you "gradually approach" a ship.
Ideally I want to call the memory stuff only ONCE when the scene is loaded and ONCE again when you get close and it needs to be updated.
Not sure if that is quite possible though. :confused:
 
Back
Top