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

Adding new Sail-Down and Sail-Up steps

I'll be happy to test it out more. So far, I just tested it out with the Pearl and was a bit disappointed to have her only turn 45 degrees. And the Pearl is pretty maneuverable for a ship of it's size. What ship should I try it with next?
 
Thanks for testing the mod, by the way! Seems it was forgotten about. :doff

Yeah, I was snooping around in the modder download folders and found your projects, along with others and scooped them up to see if I can help with their development such as testing club hauling. :p
 
Try one of those tiny ships, say a Xebec, then try a real sluggish ship like the HMS Victory, for example.
 
Ok I tested club hauling with a Xebec, the Pearl, and the Victory. The Pearl and the Xebec both only turned 45 degrees and the HMS Victory did about 60 maybe. The turn rate on club hauling definitely has to be increased.
 
Was that with Arcade or Realistic Game Mode? I strongly suspect that'd make a difference.
 
Arcade. I'm almost always playing in arcade mode. I can't stand the snail pace of realistic mode. o_O
 
I'd expect the Xebec to do WELL over 90 degrees on Realistic Game Mode. Either that or the HMS Victory would.
 
Arcade. I'm almost always playing in arcade mode. I can't stand the snail pace of realistic mode. o_O

:facepalm
I designed the mod with Realistic mode in mind. That would explain your comments.
So basically, we need Realstic/Arcade dependent turning angles. Pieter, would you be able to try that out?
 
The Realistic vs. Arcade mode code would look something like this:
Code:
void Ship_Turn180(ref rCharacter)
{
    rCharacter.TmpPerks.Turn = true;
    if(bArcadeMode)    rCharacter.TmpPerks.Turn.Angle = PI;
    else            rCharacter.TmpPerks.Turn.Angle = PI/3; //Armada: Changed to represent 'club hauling' manoeuvre. 
                    //Uses 60 degree turn to compensate for continued turning speed after manoeuvre, to make a near-90 degree turn overall.
}
Values would need to be adapted accordingly though. Not to mention that it could very well still be different per ship.
 
Certainly would need adapting; you've still got Arcade mode set to a 180 degree turn. :p
Global values like these were never going to be perfect for all ships, that's for sure.
Just a thought, would it be possible to make it turn-rate dependent? So larger turn rates could have a smaller initial turning angle, and vice versa?
 
Just giving you some concept code; yes, the actual values would need adapting.

It should be possible to have the value turn-rate dependent if we'd be able to come up with a formula for it. Personally, I'm thinking that the inertia values would be related too.
I'm not sure how the ability works, but I'd imagine something to the extent of "start turning the ship until you reach the set turn angle".
At that point, the additional turning momentum is removed, but the built-up momentum would be retained so the ship will slow down the turn gradually.
This means that ships with a high inertia value could very well continue further than the set angle.
 
That does seem to be how the mod currently works. The ship turns a certain amount and is then left to stop turning of its own accord.
Now that you mention it, the inertia values might be more important that the turn rate. I guess we're only interested in the 'InertiaBrakingX' values?

Thinking about it further, technically the ship is meant to stop travelling forward when the imaginary 'anchor' is dropped, and the forward momentum is transformed into a turning momentum.
Is it possible to set the ship's speed to suddenly slow to zero (or near-zero)?

In theory, the player should also get the option to lower the anchor on a specific side (i.e. ship turns right or left, so the turn angle is positive or negative).
That's just another thought, not sure how easy it would be to implement.
 
It's not possible to actively set the ship's speed to 0. What IS possible is to give a negative speed impulse by setting rCharacter.Ship.Impulse.Rotate.z with a negative value.
Of course that should subsequently be cancelled once the speed actually drops down to 0 to prevent the ship going backwards.
Edit: On that subject, is it worth the effort to do that? The turn itself is over fairly quickly so would people notice?

As for the direction of the turn, maybe you can do some tests? See what happens if using the ability with either this line:
Code:
rCharacter.TmpPerks.Turn.Angle = PI/2;
Or this line:
Code:
rCharacter.TmpPerks.Turn.Angle = -PI/2;
If it does what I hope, one will always go "90" degrees the one side and the other always "90" degrees the other side.
Then to make things simple, we should be able to read out the ship's current turning direction when the ability is triggered and do the turn in that direction.
That way, we wouldn't need two abilities, one for Port and one for Starboard.

Edit 2: It appears that the line of code here is not used ANYWHERE in the PROGRAM folder, which means the turning is handled internally by the game engine.
So this line is the ONLY thing we can tweak for this ability before it gets fed into the black box.
 
Maybe we should let an actual player decide whether the ship should slow/stop before it turns, don't you think? :rolleyes:

About the turn direction: making the angle negative is what I was going to try anyway, so I'll see if it works.
So do you reckon the player should be advised to press/hold the left or right arrow and then hit the ability button to initiate a turn in that direction? Sounds simple enough, and better than two abilities for sure.
 
At the moment, with the turn set to 180 degrees, it could be that the turn can be either way because the shortest direction is either way.
But alternatively, it could be set up to randomly go either way regardless, in which case we can do whatever we want, but we won't be able to choose.
 
Some test results with "Barque4_47" and angle = PI:
- Arcade Game Mode: Boat turns MORE than 180 degrees (about 200 or 220) probably due to leftover inertia
- Realistic Game Mode: Boats turns ALMOST 360 degrees probably due to INCREASED leftover inertia

Turn is ALWAYS to starboard until I changed it to -PI, which made it to port. So at least we CAN set the direction.
 
BTW: Quick way to test anything with this mod is to execute these two lines through console:
Code:
    pchar.TmpPerks.Turn = true;
    pchar.TmpPerks.Turn.Angle = PI;
You can adjust as required in mid-game.
 
Also, the ship's current ROTATION is not stored anywhere in Ship.Impulse.Rotate . However, the ship's COURSE is stored in ship.ang.y .
This does not make things easier though, because then we'd have to calculate from the ship's course which way the ship is turning.
To do this, we'd have to store the ship's course, say, every second, then when the ability is called, compare the stored course with the current course.
However, when inbetween you pass the "0" point, this could make you turn in the exact opposite direction.

Alternate idea: Take a key that is used ashore but not at sea and use this to swap between "default to PORT" or "default to STARBOARD".
For example, we can do this with the "always run" key, eg. KEY_K .
 
Well you've been busy! Good to know that a negative turn angle does what it's supposed to.

I like the idea of using a port/starboard toggle button. Makes things even simpler still. :D
Obviously you'd need a text notification to say which way the toggle is currently set, but that should be straightforward (though the toggle should only be activated for use if the player has the Club hauling ability).
 
PROGRAM\CONTROLS\init_pc.c find:
Code:
    CI_CreateAndSetControls( "General", "NK_AlwaysRunToggle", CI_GetKeyCode(CTL_ALWAYS_RUN_TOGGLE), 0, true );
    MapControlToGroup("NK_AlwaysRunToggle", "PrimaryLand");
    MapControlToGroup("NK_AlwaysRunToggle", "FightModeControls");
Add two lines like so:
Code:
    CI_CreateAndSetControls( "General", "NK_AlwaysRunToggle", CI_GetKeyCode(CTL_ALWAYS_RUN_TOGGLE), 0, true );
    MapControlToGroup("NK_AlwaysRunToggle", "PrimaryLand");
    MapControlToGroup("NK_AlwaysRunToggle", "FightModeControls");
    MapControlToGroup("NK_AlwaysRunToggle", "Sailing1Pers");
    MapControlToGroup("NK_AlwaysRunToggle", "Sailing3Pers");
PROGRAM\seadogs.c find:
Code:
        case "NK_AlwaysRunToggle":
            AlwaysRunToggle = !AlwaysRunToggle;
            BeginChangeCharacterActions(GetMainCharacter()); // NK 04-09-17 have it change now.
            SetDefaultNormWalk(GetMainCharacter());
            SetDefaultFight(GetMainCharacter());
            EndChangeCharacterActions(GetMainCharacter()); // NK ditto
            if(AlwaysRunToggle) Log_SetStringToLog(TranslateString("","Always run is now on"));
            else Log_SetStringToLog(TranslateString("","Always run is now off"));
        break;
Replace with:
Code:
        case "NK_AlwaysRunToggle":
            if (!bSeaActive || bAbordageStarted)
            {
                AlwaysRunToggle = !AlwaysRunToggle;
                BeginChangeCharacterActions(GetMainCharacter()); // NK 04-09-17 have it change now.
                SetDefaultNormWalk(GetMainCharacter());
                SetDefaultFight(GetMainCharacter());
                EndChangeCharacterActions(GetMainCharacter()); // NK ditto
                if(AlwaysRunToggle) Log_SetStringToLog(TranslateString("","Always run is now on"));
                else Log_SetStringToLog(TranslateString("","Always run is now off"));
            }
            else
            {
                if(sti(GetAttribute(GetMainCharacter(), "clubhauling")) == 1 )
                {
                    Characters[GetMaincharacterIndex()].clubhauling = -1;
                    LogIt("Clubhauling default direction set to PORT");
                }
                else
                {
                    Characters[GetMaincharacterIndex()].clubhauling = 1;
                    LogIt("Clubhauling default direction set to STARBOARD");
                }
            }
        break;
PROGRAM\SEA_AI\AIShip.c find:
Code:
void Ship_Turn180(ref rCharacter)
{
    rCharacter.TmpPerks.Turn = true;
    rCharacter.TmpPerks.Turn.Angle = PI;
}
Replace with:
Code:
void Ship_Turn180(ref rCharacter)
{
    rCharacter.TmpPerks.Turn = true;
    rCharacter.TmpPerks.Turn.Angle = PI * sti(GetAttribute(GetMainCharacter(), "clubhauling"));
}
NOTE: Not yet tested (dinner time), but I'd imagine that's how it should be made to work.
 
Back
Top