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

[REQ] Decreasing turning speed mod?

Hyde911

Sailor Apprentice
Ahoy

Is there a mini mod compatible with GoF which decrease turning speed of ships or maybe there is a way to tweak it in game files. I don't want make this game sailing simulator but I think that ships turn way tooooo fast. With appropriate skill even largest ship can spin at spot. I think turning speed should be proportional to movement speed. Eventually at 0 speed ships should not be able to turn at all.
 
Totally agreed.

Totally dismasted ships spins over their axis, spitting metal for every board and rendering my usual tactis useless.

If some modder can point me to the code/zone may be I can do a try. Searched some of the SEA_AI sources a week ago but found nothing relevant.

Cheers.
buho (A).
 
Found some

Code:
float FindShipTurnRate(aref refCharacter)

in Program/scripts/ShipsUtilities.c.

Dunno if it is what we need. I added it in my "Things I Want to Try" list, can take me some time to reach that point of the list. Moreover checking the eventual changes is going to be a royal pain.

Any advice against meddling with this function? Or this function NOT being what I'm searching for? Or any advice about how to check the tweaks?

Cheers.
buho (A).
 
Found some

Code:
float FindShipTurnRate(aref refCharacter)

in Program/scripts/ShipsUtilities.c.

Dunno if it is what we need. I added it in my "Things I Want to Try" list, can take me some time to reach that point of the list. Moreover checking the eventual changes is going to be a royal pain.
I believe this function just returns turn rate of current hero's ship.
 
Found some

Code:
float FindShipTurnRate(aref refCharacter)

in Program/scripts/ShipsUtilities.c.

Dunno if it is what we need. I added it in my "Things I Want to Try" list, can take me some time to reach that point of the list. Moreover checking the eventual changes is going to be a royal pain.
I believe this function just returns turn rate of current hero's ship.
 
Added a trace in the function.

BUHO FSTR: Luck's Favorite - Unicorn1 - fenc_942 <<<<<<<<<< FOE
BUHO FSTR: Annunciation - Caravel1 - fenc_944 <<<<<<<<<< FOE
BUHO FSTR: Libertalia - La_Licorne1 - Blaze <<<<<<<<<< ME
BUHO FSTR: Coquette Sue - Sirius11 - fenc_941 <<<<<<<<<< FOE
BUHO FSTR: Barracuda - Salamander1 - GenChar_395 <<<<<<<<<< COMPANION
BUHO FSTR: Witch - Frigate_sat1 - GenChar_401 <<<<<<<<<< COMPANION
BUHO FSTR: Imp - Salamander1 - GenChar_391 <<<<<<<<<< SEIZED
BUHO FSTR: del Rosario - SloopofWar1 - fenc_945 <<<<<<<<<< FOE
BUHO FSTR: Bien Saceso - Hebek1 - fenc_943 <<<<<<<<<< FOE


BUHO FSTR: Annunciation - Caravel1 - fenc_944 <<<<<<<<<< FOE
BUHO FSTR: Libertalia - La_Licorne1 - Blaze <<<<<<<<<< ME
BUHO FSTR: Almandena - Salamander1 - GenChar_404 <<<<<<<<<< COMPANION
BUHO FSTR: Luck's Favorite - Unicorn1 - fenc_942 <<<<<<<<<< FOE

Apparently the function is called for every ship in combat, sooner or later. Some ships in combat are not in the log, but the test run was very short and the log is very poluted with messages about "invalid cannons on bort", lines are difficult to pint-point on the fly.

May be adding a Q&D "if SP < SomeMagicNumber" somewhere can do the trick.

Will make some trys next days, checking thoroughly and testing tweaks .

Cheers.
buho (A).
 
Failed. :modding

The function returns the "maneuverability", as shown in the ships screen, and can be zero without stopping the turning.

The search continues.

Cheers.
buho (A).
 
Got another take on it last night.

If the code governing the ship physics is in the open sources I can't find it.

No tweak in FindShipTurnRate (FSTR) will stop the spin. FSTR, apparently, returns a factor used in some -for me- unknown ecuation. You can make the turn speed waaaaay faster tweaking FSTR but you can't stop it. May be tweaking some other factor can do the trick, but I'm not aware of it.

I'm having serious fears about the use of Bring2Range. As it is used in FSTR it makes very little sense. It is not related to the spin issue, but I'm fearing Bring2Range is being used wrong not only in FSTR but in some other places too. In FSTR the use is crazy or hellishly tricky, no doubt about.

Cheers.
buho (A).
 
No tweak in FindShipTurnRate (FSTR) will stop the spin. FSTR, apparently, returns a factor used in some -for me- unknown ecuation. You can make the turn speed waaaaay faster tweaking FSTR but you can't stop it.
But that means its does affect it at least. Its quite possible that they gave it a minimum value in the engine, and thats why you cant make it stop.
Btw, have you tried using negative values?

I'm having serious fears about the use of Bring2Range. As it is used in FSTR it makes very little sense.
I dont know what bring2range does but Im guessing its either cannons which are affected by turning, or boarding which just as well might be.

And I dont have the files here but have you tried tracking from controls (keys)? Considering how turning has ones directly assigned to it. Im almost sure it will just lead to an engine command, but who knows...
 
[...]
Btw, have you tried using negative values?
Yup. A lot till -10000. No effect.



[....]
And I dont have the files here but have you tried tracking from controls (keys)? Considering how turning has ones directly assigned to it. Im almost sure it will just lead to an engine command, but who knows...
KEY_A and KEY_D are basically eaten by the engine. The signal of KEY_A (Ship_TurnLeft), as an example, appears only in init_pc.c, init_xbox.c, ControlNames.txt and the net code. If it is reconverted and rerouted to somewhere else in the sources I can't find to where.

Cheers.
buho (A).
 
Hi Buho,

Ok, I found that you can stop a ship turning by adding "fTRResult = 0.000001" in the "Ship_UpdateParameters" function in AIShip.c, just after the line:
fTRResult = Bring2Range(0.07, 0.95, 0.00001, 1.0, fTRResult);
So maybe you can use that to get what you want.

Note, Bring2Range just takes a number in one range and gives you a value in the second range, and the parameters for the function are Bring2Range(ToMin, ToMax, FromMin, FromMax, InitValue)
So BringToRange(0, 100, 0, 1, 0.5) would take 0.5 (which is halfway between 0 and 1) and give 50 (which is halfway between 0 and 100)

So "fTRResult = Bring2Range(0.07, 0.95, 0.00001, 1.0, fTRResult);" makes sure that the turn rate has a value between 0.07 and 0.95
 
Hi Buho,

Ok, I found that you can stop a ship turning by adding "fTRResult = 0.000001" in the "Ship_UpdateParameters" function in AIShip.c, just after the line:
fTRResult = Bring2Range(0.07, 0.95, 0.00001, 1.0, fTRResult);
So maybe you can use that to get what you want.

Note, Bring2Range just takes a number in one range and gives you a value in the second range, and the parameters for the function are Bring2Range(ToMin, ToMax, FromMin, FromMax, InitValue)
So BringToRange(0, 100, 0, 1, 0.5) would take 0.5 (which is halfway between 0 and 1) and give 50 (which is halfway between 0 and 100)

So "fTRResult = Bring2Range(0.07, 0.95, 0.00001, 1.0, fTRResult);" makes sure that the turn rate has a value between 0.07 and 0.95


Thank you very much, Jonathan, will try it tonight or may be tomorrow (as soon as I can get some time).

- o -

My problem with B2R is the way it is used in FTSR:

Code:
fTRFromSailDamage = Bring2Range(0.05, 1.0, 0.1, 100.0, stf(refCharacter.ship.sp));

The declared possible range is 0.1...100, when the possible range of refCharacter.ship.sp is well over 100 for most of the ships in most of the cases (it is not the actual value shown in the F2 ship screen, but it is somewhat close).

So, the result is something like this:

SP -----------> B2R
SP: 1.0 -> 0.059
SP: 2.0 -> 0.068
SP: 3.0 -> 0.078

[...]

SP: 97.0 -> 0.971
SP: 98.0 -> 0.981
SP: 99.0 -> 0.990
SP: 100.0 -> 1.000
SP: 101.0 -> 1.000
SP: 102.0 -> 1.000

[...]

SP: 397.0 -> 1.000
SP: 398.0 -> 1.000
SP: 399.0 -> 1.000

After 100 SP, the result is the same no matter what. So, having more than 100 SP does not matter for this turning factor.

May be it is WAI, but I can't make sense of it.

What I'm wondering is if the right use is not

Code:
fTRFromSailDamage = Bring2Range(0.05, 1.0, 0.1, 100.0, GetSailPercent(refCharacter));

or something like that.

Cheers.
buho (A).
 
Hi Buho,

Yes I think you're right with your:
Code:
fTRFromSailDamage = Bring2Range(0.05, 1.0, 0.1, 100.0, GetSailPercent(refCharacter));

What's happened here, is that in the base code, ALL ships had max sail amount of 100. Having SP higher than 100 was added in one of the later mods. So that's a good catch, and there's likely a couple of other places in the code with the same issue.

Edit: Ok, I did find another copy of that bug: line 340 in ShipsUtilities.c, which I'll fix.
 
Jonathan:

I have some code in place, but it is very Q&D. I'm going to study the issue some more, now that you pointed me to the area.


EDITED: There was some wrong assumptions here.

Cheers.
buho (A).

NOTE:

Just now, if someone wants a quick and dirty fix, the code I'm using is:

Code:
void Ship_UpdateParameters()       // In AIShip.c
{
[...]
fTRResult = Bring2Range(0.07, 0.95, 0.00001, 1.0, fTRResult);             // <- ORIGINAL LINE, KEEP

//// {*} BUHO-PT - ADDED CODE - Dismasted spin fix.                              <--- ADDITION STARTS HERE
/* 
Dismasted ships spins like crazy, this tweak is intended to stop
her spin - Thanks JA for pointing me to the insertion point.
*/
{
float fSPC = GetSailPercent(rCharacter);	
if (fSPC <= 20)
{
/*
If the sail power is below 20%, create and use a lineal handicap for the speed.
The handicap affects the turning and the lineal speed (the ship can't move at all if
the handicap factor is little enough).
*/
float fHandicap = Bring2Range(0.000001, 1.0, 0.000001, 20.0, fSPC);
fTRResult := fTRResult * fHandicap;

// Log_SetStringToLog(rCharacter.Ship.Name + ": " + fSPC + "% - Handicapped by: " + fHandicap);	// {*} TRACE
} 
}
//// {*} BUHO ADDITION END

arCharShip.MaxSpeedY =	fTRResult;                // <- ORIGINAL LINE, KEEP


[...]
}

I can't post the entire source because my one have the Mates Voices changes.
 
I can't believe this!

Tried a lot of saves, worked one of them again to have 3 dismasted ships around.... no one is spinning WITHOUT the fixes, so I can't check the code.

buho (A). :ko
 
I'm not sure if you know what I meant. I want turning speed decreased of all ships, including my own. For now I've halved turning speed of all ships. It's still not what I really want (0 turning rate at 0 speed), but I think it's better. Ships don't turn like crazy.
 
I'm not sure if you know what I meant. I want turning speed decreased of all ships, including my own. For now I've halved turning speed of all ships. It's still not what I really want (0 turning rate at 0 speed), but I think it's better. Ships don't turn like crazy.

How you made it? You managed to changing the turning without affecting the lineal speed?

Cheers.
buho (A).
 
How you made it? You managed to changing the turning without affecting the lineal speed?

I modified Ships_init.c file. I decreased (halved) "refShip.TurnRate" factor of every ship. Ships still spin, but not so fast like they used to. What I really want is to couple speed of ship with its turning rate and prevent ship from spinning without moving. However, I'm not a coder and I don't know how to do that.
 
Back
Top