• 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 Realistic Game Mode: Modify NPC Tacking Behaviour at Sea

The luffing is fine with this ship. It starts luffing about the time the ship starts slowing down. I need to try it in a different ship, preferably a square sail one.
 
As I said, the luffing sound is intended to happen before your speed is affected, so the sound serves as an advance warning.
That is what the value you changed was originally intended for.
 
Ok fine. I will just leave the headphones on the desk to avoid the constant luffing sound.
 
Ok fine. I will just leave the headphones on the desk to avoid the constant luffing sound.
Constant luffing sound? Whatever are you going on about? o_O

My suggestion is very simple: DON'T set that #define to a negative value.
If you use a small positive value (default), you will get the sound just before you actually lose speed.
If you set it to zero, then you will not get that "advance warning".

If you do want it zero, I suggest doing this instead:
Maybe instead of doing that, see what happens if you replace this line:
Code:
if(fOffWind < fClosestPoint + (RS_CP_OFFSET * 8) && fOffWind > fClosestPoint && fSailState > 0.0) {Ship_SetSailState(iCharacterIndex, 1.00);};
With this:
Code:
if(fOffWind < fClosestPoint) && fOffWind > fClosestPoint && fSailState > 0.0) {Ship_SetSailState(iCharacterIndex, 1.00);};
That means the sound remains exactly like it was before BUT the "tacking" behaviour does function as if that number was zero.

That is what you want, right?
 
Since @Hylie Pistof was asking about it, I applied my suggested solution for testing purposes in the coming modpack update.
Then we'll see what happens. :shrug
 
Just woke up again, still groggy............:ko

Constant luffing sound = Most of the time I'm fighting a headwind and the luffing is happening. Side winds are a blessing and tail winds are a rare treat to be explited while it lasts. I have changed what ships I sail for this reason and only sail ships that do well sailing into the wind. The Hoy, Diligente, Polacca, CastelF, Caravel, Fragata Latina are examples of ships I sail now.:sail
 
Do you not like the sound at all? You're, of course, not supposed to be hearing it because you make virtually no speed while you do.

There is a toggle for it in InternalSettings.h:
Code:
#define SAIL_LUFFING_SOUNDS       2       // INT - Set from 1 to 3 to play sail luffing sounds when sailing too close to wind.  0=off, higher numbers add more luffing sound.
So you can disable it independently of anything else.
 
How does the luffing sound affect the NPCs? They don't seem to be doing so well the way it is now in the latest EXE. They stop too soon and start tacking long before I do, but recover well when the wind shifts. When the wind does not shift favoribly they are soon off the map.
 
The luffing sound does not affect NPCs.
But that define that you were editing affects their tacking behaviour AND your luffing sound.
It is used twice in the code, just search for all instances in that same file and you'll see.
 
@Hylie Pistof: Can you confirm that the NPC ships DO behave the way you want with that #define set to 0.0?
But NOT without you doing that?
 
Last night the NPC ship was NOT doing well with your settings. Many times he fell so far behind that he fell completely off the map. :sparrow Both ships are the CastelF and mine is slower by 1 1/2 knots or so.

So I tried to modify those files meself and got it so the game would not start at all. Tried the file from an older install and it still would not start. :pirate07: So I reinstalled which allowed me to still use my saves, but lots of little changes are gone. I will be slowly putting it all back together again today. :bird:

Bottom line: The NPC behave better the way I had it rather than the way you have it. The way you have it now he drops sail and starts tacking far too early while I just continue sailing along and pull away from him. :pirateraft
 
Bottom line: The NPC behave better the way I had it rather than the way you have it. The way you have it now he drops sail and starts tacking far too early while I just continue sailing along and pull away from him. :pirateraft
Then please post the file where you think it works well and I'll see how that works.
 
I no longer have that file. That was the one I was attempting to change back to the way it used to be when I managed to make the install not work.
 
You might want to consider saving your modified files before installing new updates.
And see if you can get WinMerge; that program is a huge help.

Do you happen to remember what you tweaked?
I thought you said you changed that #define to 0?
Or was it the one where you had it negative that seemed to work well?
 
That was the one. First I changed it from 0.02 to -0.02 and play tested it. Then I changed it to 0.00 and was play testing that (it seemed ok) when I installed the patches, which made it worse. I was attempting to put it all back the way it was pre-patches and failed, so had to start over from the latest patches. Basically I am stopped and doing nothing to this anymore.
 
That was the one. First I changed it from 0.02 to -0.02 and play tested it. Then I changed it to 0.00 and was play testing that (it seemed ok) when I installed the patches, which made it worse. I was attempting to put it all back the way it was pre-patches and failed, so had to start over from the latest patches. Basically I am stopped and doing nothing to this anymore.
See attached for a copy of the file that has all related code restored the way it was.
Apparently my quick-and-dirty fix didn't work, so I now undid it. At least that gives you a "clean slate" again.

The RS_CP_OFFSET variable is actually used in a whole bunch of spots and I don't quite understand the intricacies of the background.
I think if you set it to 0.0, then effectively your speed is either "maximum" or "zero" depending on whether you are just in or out of the "ClosestPoint" heading.
So it is meant to give a more "gradual progression" between that. Lower numbers means a steeper progression in speed.
Negative numbers should effectively make no sense.

Forcing the AI to do natural tacking manoeuvres requires quite a bit of "code hacking" and a good understanding of how it works.
Do you have any idea exactly why those other ships seem so slow?
I assume they are far behind you and you cannot observe them very well when it happens.
So I'd suggest using Ctrl+Arrow keys to switch the camera to one of your companion ships.
And then see what happens and figure out specifically in what way they should do better.
 

Attachments

  • AIShip.c
    219.4 KB · Views: 132
Why the NPC ships are so slow is easy for anyone to see. When the wind gets to a moderate attack angle they furl the sails and start tacking. Meanwhile I am sailing along doing just fine and quickly disappear over the horizon.
 
Why the NPC ships are so slow is easy for anyone to see. When the wind gets to a moderate attack angle they furl the sails and start tacking. Meanwhile I am sailing along doing just fine and quickly disappear over the horizon.
Should be this code responsible then:
Code:
//TM --> Detect when non player ship is sailing into wind and use rotate function to turn it out of wind
     float fTacking2 = 0;
     
     if (iCharacterIndex != GetMainCharacterIndex()) {
       if (fSeaExpTimer > 5) {
         if(fOffWind < fClosestPoint + (RS_CP_OFFSET * 8) && fOffWind > fClosestPoint && fSailState > 0.0) {Ship_SetSailState(iCharacterIndex, 1.00);};
         if(fOffWind < fClosestPoint) {
           if (fSailState > 0.0) {   
             Ship_SetSailState(iCharacterIndex, 0.001);
             float fTacking = stf(arCharShip.Speed.y);
             if(fTacking <= 0) {fTacking2 = -0.0015; arCharShip.Impulse.Rotate.y = fTacking2;}; //Left
             else {fTacking2 = 0.0015; arCharShip.Impulse.Rotate.y = fTacking2;}; //Right
           } else {
             arCharShip.Impulse.Rotate.y = 0
             fTacking = 0
             fTacking2 = 0
           }
         } else {
           arCharShip.Impulse.Rotate.y = 0
           fTacking = 0
           fTacking2 = 0
         }
       }
     }
// <-- TM
I'd suggest you delete that completely and see what happens.

According to that code, the "furling sails and start tacking" should start only when they are heading so far into the wind that they can't make any speed anymore.
So that shouldn't be "a moderate attack angle".
 
My alleged memory says that it was adjustable.
I see the following adjustments that could in theory be made:

- "(RS_CP_OFFSET * 8)" affects the point where the ships MAKE sail again. The higher that number, the later they'll make sail (I think).
You could try to reduce that number of "8", which should make ships wait less "angle" before making sail again.

- Values of "(-)0.0015"; increasing this should make the ships turn faster.
Note that this is a manual hack to override the normal game system and therefore doesn't use ship TurnRate at all.

That is all I can think of.
 
Back
Top