• 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 Sea Relations: Behaviour for Recognizing False Flags

How should enemy forts treat players sailing into port under a false flag?

  • Other, please specify below

    Votes: 0 0.0%

  • Total voters
    20
So the AI has to check the location of the ports relative to its own position now too?
It will have to. The suggestion is that if you sail too close to another ship while flying a false flag, that makes it suspicious of you even if it can't recognise you by reading your name or see your face. Since this is inevitable when you approach a port and another ship is near that port, we're back to the situation where you're automatically detected by any ship in the area.

NPC ships don't use false flags (yet? Build 15 idea!) so if you are Dutch, flying a Dutch flag and encountering a Dutch merchant, there is no false flag checking to be done.
On the other hand, the logic does stand from the side of the NPC merchant ship, but again, that is adding more complexity to something doesn't even work right now in a simplified form.
The point is that running away from a warship which is flying a (possibly false) friendly flag is illogical. You'd be going to a lot of effort to exchange one illogical behaviour pattern for another illogical behaviour pattern. :D

Your worry is that a false flag will only be detected when you're right alongside the other ship. Which indeed it will, if the other ship is only a poor lugger with a novice captain. The pirate's problem is when a frigate with a more experienced captain takes a look at him - higher skill captain and naval ship so it's likely to detect him further away, and that's the sort of ship which can do something about it. Hence my suggestion that ship size should be a factor and so should whether it's navy or merchant.

The other question is, what if there are multiple ships? If there are four ships in the other group, do you check for each ship or for the entire group? If the chance of a single ship detecting you is high enough to be a worry, and you do the same check for every ship in the group, then four (or more) ships will almost certainly get you every time.
 
It will have to. The suggestion is that if you sail too close to another ship while flying a false flag, that makes it suspicious of you even if it can't recognise you by reading your name or see your face. Since this is inevitable when you approach a port and another ship is near that port, we're back to the situation where you're automatically detected by any ship in the area.
Getting into a hostile port SHOULD be risky, so I don't see any major concerns there just yet.
We'll see from actual gameplay once the system is doing what I want it to.

The point is that running away from a warship which is flying a (possibly false) friendly flag is illogical. You'd be going to a lot of effort to exchange one illogical behaviour pattern for another illogical behaviour pattern. :D
Hmm.... Skipping false flag detection for merchant ships altogether might be an idea there.
That should be relatively doable.

Your worry is that a false flag will only be detected when you're right alongside the other ship. Which indeed it will, if the other ship is only a poor lugger with a novice captain. The pirate's problem is when a frigate with a more experienced captain takes a look at him - higher skill captain and naval ship so it's likely to detect him further away, and that's the sort of ship which can do something about it. Hence my suggestion that ship size should be a factor and so should whether it's navy or merchant.
I'm not sure if captain rank is related to ship size at all; it might be in some parts of the code, but not all.
Have you noticed such a relation from actual gameplay?

If we indeed skip false flag detection for merchants altogether, we can balance the range and chance values based on navy ships and pirates only.

The other question is, what if there are multiple ships? If there are four ships in the other group, do you check for each ship or for the entire group? If the chance of a single ship detecting you is high enough to be a worry, and you do the same check for every ship in the group, then four (or more) ships will almost certainly get you every time.
I think the functionality does work for every ship in the group individually.
Having a higher chance of being recognized close to many ships as opposed to close to only one does sound quite logical to me, though.
More ships = more officers watching you = higher chance of them noticing something wrong/one of you having heard of you before.

But if we exclude any merchants being escorted, that cuts down on the number. And then it becomes a balancing act again.
 
In the near future, I will be looking into this functionality and will rewrite it so that it hopefully works better and makes more sense.

Here's what I've got in mind:
- False flag detection works only for ships within the appropriate visibility range (see below)
- False flag detection works only for ships that are hostile to you personally
- Detection chance increases the closer you get to the ship, so passing them at a distance should be OK
- If recognized, you will automatically hoist the flag of your Served Nation

Situation where you are hostile to a ship you are close to, but are friendly based on your current false flag:

CURRENT SITUATION:
When you hoist a flag hostile to them within visibility range of them, they will (of course) turn hostile AND you will be marked as "traitor" by their nation.
If that has happened, you can be recognized ashore for your actions in towns of that nation. You can only be "traitor" to one nation at a time.

Alternate idea: Do away with this feature altogether and instead have the "traitor" functionality linked to your ServedNation.
If this is PIRATE for whatever reason, you can be recognized as a traitor in ALL non-pirate towns.


-----------------------------------------------

There are four visibility ranges defined which affect what you can see through the Spyglass/Sail-To Interfaces:
default = 3000.0: You cannot see any details for ships exceeding this range
1 = 1000.0: You can recognize ship type for ships exceeding this range
2 = 500.0: You can see nation for ships exceeding this range
3 = 300.0: You can see name for ships exceeding this range

These values are halved at night and further reduced by any fog density.

At the moment in some cases the other ships' captains' leadership and sailing skill are added as per this formula:
Code:
SKILL_LEADERSHIP + SKILL_SAILING * 5
This number can vary between 6 and 60 which seem like relatively low values compared to the value of the ranges.
So I'm not sure if this serves any purpose and if this is something we should maintain.

One extra idea is to have an on-screen message indicating the value of the visibility in words (e.g. "Good"/"Moderate"/"Poor").
We could then also change the values used here to match with specific of these ranges,
so that it would be clearer to the player what they and other ships can and cannot see of each other.
To clarify on this, I plan to start work on this over the weekend.
The only addition to the above so far is by @Grey Roger to exclude all merchant ships from the false-flag-recognizing.

Setting "ServedNation" to PIRATE in some cases is already done now, so I'll adapt the traitor functionality to use that instead of the .traitor attribute.
This means that there will no longer be a specific penalty for hoisting a hostile flag within visual distance of a previously friendly ship.
You may still get a penalty depending on what you do after hoisting that flag though, eg. sink/capture a ship from a non-hostile nation.
 
I'm not sure if captain rank is related to ship size at all; it might be in some parts of the code, but not all.
Have you noticed such a relation from actual gameplay?
I haven't been keeping note of enemy captain ranks. If he doesn't surrender and I have to kill him, there's no clear way to know his rank; if he does surrender, I'm likely to ransom him. But my suggestion was to make ship size a separate contributing factor from captain rank, on the grounds that a bigger ship is likely to be better equipped. Although it's not depicted in the game, the larger ship is likely to have a better spyglass and thus be better able to see your ship's name, your crew wearing English clothes on what's supposed to be a French ship, or your famous face. :D And the larger ship will have more officers who might spot something suspicious.
 
I'll consider that for when we've got a working simple system in place.
 
For the "traitor" functionality, I am proposing the following change:
Code:
      // ccc Dec 05 You are recognized after raising pirateflag
     //   if(CheckAttribute(Pchar,"traitor") && sti(pchar.traitor) == makeint(GetLocationNationFromID(NPchar.location)))   // checks if you once hoisted a hostile flag in sight of their ships
       if(GetServedNation() == PIRATE && GetCurrentLocationNation() != PIRATE)   // PB: Link this to acting as a pirate
       {
     //     DeleteAttribute(Pchar,"traitor");   // so that recognizing happens only once
This means that hoisting an enemy flag close to an apparently friendly ship no longer has any repercussions ashore.
Instead, it would be triggered by:
- Starting the game as a pirate
- Actively betraying a nation you were friendly with
- Repeatedly sinking/capturing non-pirate ships without having a LoM or navy commission

There is a chance to be recognized like this by random town folk (NOT fixed citizens) and some tavern folks and soldier patrols, but mainly those triggered by the Shore Crewmembers mod.

As your ServedNation doesn't easily change from PIRATE to something else once you got it there, that means "being recognized" here that can continue happening throughout the game.
In fact, being a pirate will probably make all non-pirate towns relatively dangerous after this change.

Do you guys think that is reasonable? Or do we need to start putting more fancy code in here too?
Options might involve false flag detection chances and whatchamacallits?

At the moment I am inclined to not complicate this yet and only apply what I suggested above.
Subsequent testing will tell us if any changes would be required.
 
Last edited:
If you're going to change the definition of "traitor" then dialog file "Enc_Walker.h" will need some editing. In fact, if you're not going to change the definition of "traitor" then it needs some editing. At the moment, you are accused thus:
Hmm.. I have seen you before.. during a ship skirmish some time ago, on a quarterdeck, I think... Yes, and with a black flag.... HEY, you are the devious bastard who sailed close to our ship and then suddenly hoisted the Jolly Roger!!! ALARM! A pirate in disguise!
The implication is that the person saw you hoist a Pirate flag. So I was puzzled when I met someone who said this, having never hoisted a Pirate flag during the whole game. Of course, it's because I sailed next to a French convoy while flying a French flag, then raised the British flag and boarded them. :rpirate

Possibly something like this would cover it either way:
Hmm... I have seen you before... during a ship skirmish some time ago, on a quarterdeck I think... HEY, you are the devious bastard who sailed close to our ship. We thought you were friendly right up to the moment you opened your gun-ports, fired into our ship, then boarded us and slaughtered our crew! ALARM! A pirate in disguise!
Line 296 is where the deed needs to be done.
 
If you're going to change the definition of "traitor"
From what I gathered, several people here weren't very happy with the current definition of traitor. So now that the served nation can get stuck on pirate, that has given us another option to make use of.
Probably the new version will be better as one single small act will no longer trigger it.

dialog file "Enc_Walker.h" will need some editing. In fact, if you're not going to change the definition of "traitor" then it needs some editing. At the moment, you are accused thus:The implication is that the person saw you hoist a Pirate flag. So I was puzzled when I met someone who said this, having never hoisted a Pirate flag during the whole game. Of course, it's because I sailed next to a French convoy while flying a French flag, then raised the British flag and boarded them. :rpirate
Ah! Indeed it used to be linked to pirate flags only, until I change the code so it was all in line and changed it to allow any nation.

Possibly something like this would cover it either way:
Code:
Hmm... I have seen you before... during a ship skirmish some time ago, on a quarterdeck I think... HEY, you are the devious bastard who sailed close to our ship. We thought you were friendly right up to the moment you opened your gun-ports, fired into our ship, then boarded us and slaughtered our crew! ALARM! A pirate in disguise!
Line 296 is where the deed needs to be done.
With the new version, even that wouldn't be appropriate anymore, would it?
Your traitorous acts aren't linked to attacking anymore, but to sinking/capturing ships or attacking towns without license.
This might be more accurate for the new system:
Code:
"Hey, I have heard of you before... Aren't you that devious bastard who attacks ships and towns without excuse? ALARM! A pirate in disguise!",
By the way, I edited my above post as I now realise I wasn't quite clear enough:
This means that hoisting an enemy flag close to an apparently friendly ship no longer has any repercussions ashore.
Instead, it would be triggered by:
- Starting the game as a pirate
- Actively betraying a nation you were friendly with
- Repeatedly sinking/capturing non-pirate ships without having a LoM or navy commission
 
You're unlikely to be attacking any towns unless you've been attacking some ships first. If the town doesn't have a fort then you need the "Troopers" perk, which means you need to be pretty high level. If it does have a fort then you need a big ship. Either way, you've probably started off on something smaller, e.g. ships. And a more detailed account sounds more personal - this isn't someone who knows you by reputation, this is a survivor of one of your attacks, hence your reply:
Should have killed ALL witnesses of my piratical past..
However, the important thing is that the line needs to be replaced by something more appropriate and that was just a suggestion. I've no objection if something else is used. :)
 
You're unlikely to be attacking any towns unless you've been attacking some ships first. If the town doesn't have a fort then you need the "Troopers" perk, which means you need to be pretty high level. If it does have a fort then you need a big ship. Either way, you've probably started off on something smaller, e.g. ships. And a more detailed account sounds more personal - this isn't someone who knows you by reputation, this is a survivor of one of your attacks, hence your reply:
However, the important thing is that the line needs to be replaced by something more appropriate and that was just a suggestion. I've no objection if something else is used. :)
Fine by me. Your version it is. :cheeky
 
As your ServedNation doesn't easily change from PIRATE to something else once you got it there, that means "being recognized" here that can continue happening throughout the game.
In fact, being a pirate will probably make all non-pirate towns relatively dangerous after this change.
As this seemed a bit excessively nasty to me, I have now made it a bit easier to get your ServedNation to something else again.
You need to make sure you get only a single LoM and get rid of any from the Pirates you might have, then get yourself promoted.
That will set your ServedNation back to the nation whose LoM you now have and therefore will reset your "traitor" status.
 
Served Nation PIRATE instead of the former "traitor" functionality is now included in here:
http://www.piratesahoy.net/threads/build-14-beta-3-5-internal-wip-for-testing.24817/

Testing will hopefully tell us if this is currently "too evil" or if it works properly.
Also, keep an eye out for the dialogues related to this as some may still refer to the act of hoisting a pirate flag, which is no longer linked to this functionality.
So if that is the case, please post here so we'll know to fix it! :cheeky
 
Currently working on making the False Flag recognizing work again and ran into something funny:
- Was flying a French flag and used Sail-To to get me close to some pirates
- Of course they were hostile and started to chase me
- Sail away until they couldn't see my flag anymore, then hoisted a Pirate flag
- They turn friendly, because they didn't see what I did; however, THEY KEEP BLOODY CHASING ME! :rofl

---------------------------------------------------------------------

Even without dynamic false flag recognizing, this one may require a bit more thought though....

Should we perhaps have ANY ship within visible range from you remember you AND store the nation whose flag you were flying at the time?
And as default revert to that nation's relations to yourself? So if you passed a ship under a (false) Spanish flag, they'll remember you as being Spanish.
Or something like that?

As usual, I welcome any thoughts people might have on what NPC ships should and shouldn't be aware of.
 
With the zip from yesterday starting a game with jean latiffe I get these errors
Some might be my fault (working on the xp thing) but they look to be yours mostly :p.
 

Attachments

  • compile.log
    6.6 KB · Views: 142
  • error.log
    5 KB · Views: 158
With the zip from yesterday starting a game with jean latiffe I get these errors
I claim full responsibility for those error.log entries. I also got them and fixed them earlier today.
Just change the related function in nations.c to this to set it right again:
Code:
int GetNationTypeByID(string nationName)
{
   for(int i=0; i<NATIONS_QUANTITY; i++) // PB: I had this starting at -1 to include personal nation, but that isn't a very good idea ;-)
   {
     if (Nations[i].id == nationName) return i;
   }
   return UNKNOWN_NATION;
}

Not sure how far I'll get with actually making a complete EXE today.
I'm now diving into the "Improved Sea AI" code which is definitely also another complicated matter. :facepalm
 
No problem. I don't expect to finish everything I want today also ... seems I have to dive into character generation again to get this fully sorted also :p.
 
Why am I not finding any "Directenc" groups in the game to "improve AI" on???
That would mean that any ships encountered during DirectSail won't make use of all the clever, mod-added functionality and they'll never recognize your false flag.
That's not good. o_O
 
Right, so DirectSail encounters ARE in the player location, but the game doesn't care to give them a "location" attribute.

Going further, it appears that at the moment all AI stuff, including false flag recognizing, is taken per group and not per ship.
Which means that only the flagship of a fleet can recognize the player "on the fly".
However, ALL ships can recognize you on a "BattleInterface update" like is triggered on Sail-To.
That doesn't make much sense to me.

While indeed I do understand that the group should all follow the same "orders", the current situation would have quite an odd effect.
In my savegame, the flagship is far ahead of the group. So as long as I stay out of the way of that one, none of the other ships will be any the wiser.
I'd like to change things so that ALL ships have a chance of recognizing you.
But if they do, the entire group should become hostile.

Actually, that might not even need any specific code at all; if we automatically hoist your Served Nation flag, that WILL turn them all hostile.
That suggests perhaps I should untie the "false flag detection" from the regular "improved AI".
 
Well, the other ships in the group now ARE also looking at your flag. They don't look properly yet, but at least they're being considered.
I still fear there is more wrong though; only the flagship actually bothers to go anywhere. All the other ones just start to drift aimlessly about. :facepalm
 
Back
Top