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

Capsizing Ships

The capsizing mod is still in its infancy, so any comments you might have are much appreciated.

I did most my testing with small barque-like ships and I found that a 15 degree roll angle is fairly rare and can be avoided by putting the ship's head into the wind in a storm. However, it could be that on other ships, this angle CAN be reached more easily, which can make things really annoying.

Although capsizing is more realistic at 40-45 degrees, I don't think the game ever puts any ships in that situation.
My intention with this mod is not full realism, but more to encourage players to actually DO something in a storm.
After all, previously you'd furl all sails and wait out the storm, but that seemed rather uninteresting to me.
So instead now, I wanted to encourage players to observe the weather, turn the head into the waves and try to prevent excessive ship motions.

You have the roll angle displayed on the screen during storms, right?
Can you tell me what ship you're using and what you commonly see as roll angle on the screen?

Also, I don't know if you got the release version of Patch 2 (available from forum and ModDB) or the pre-release version (available from POTC Modding subforum). The pre-release version had a very simple capsize mod included that would sink your ship whenever your roll angle would exceed 15 degrees. However, in the release version this has been recoded so you'll get several warnings first, along with various other attempts to make things more playable and less of a pain.
 
I installed Patch 2 last night and have gotten caught in one storm so far. I got two warnings before I got the standard Lugger turned into the waves. Then it held course fairly well. It is easy to see where a slow turning, top heavy ship that doesn't hold its course well in weather could get in trouble. Would adding a sea anchor be possible?
 
A storm lasts at least 60 seconds (120 or 180 if it's a heavy one).
With the release version of Patch 2, there is no chance of capsizing until 40 (or was it 50?) seconds into the storm.
However, if you can delay the occurrance of the warning by decreasing the roll angle, you're also delaying the time at which you can capsize.
 
Is there an animation showing a ship capsizing? I ask because last night I had to escort a troop ship from Jamaica to Barbados. There were three ships. I was sailing the light fluyt. We got caught in a twister storm. I suffered damage but the other ships sank. Methinks it was the twister and storm damage, not capsizing that sank them, but I'm not sure. I didn't even get a warning about capsizing.

I see no roll angle displayed, but maybe I'm looking in the wrong part of the screen.
 
In the release version of Patch 2, capsizing can only happen for the player (not even companion ships).
The reason is because the AI is not going to try to avoid it, so you might just randomly lose ships in the squadron, which is no fun.

In the pre-release version, I added a log message indicating whenever a ship capsized, so you should know when this happens.

The roll angle is displayed as a log message on the screen in storms in the release edition, so that should be rather hard to miss. In the pre-release version, it's only displayed if you've got the cheatmode on though.
 
Ah. Thanks. I get messages about the crew getting seasick, but I was looking for numbers in degrees.

I lost another ship. It was a frigate this time. It seems that occasionally when one storm ends another starts right up with no break. I noticed the screen flickers as this happens.
 
Sorry about the confusion; the roll angle in degrees is only displayed if ENABLE_CHEATMODE is on in the release version of Patch 2 also.
Pirate_KK sent me some help on how to add it as part of the regular battle interface, but I have yet to try that.

As for storms, we've recoded them for the sake of the DirectSail mod.
In the original game, storms could only be found on the worldmap and once you're in one,
you're stuck for 60 seconds, after which you can return to the worldmap or stay in the storm, which doesn't stop.

For the DirectSail mod, we changed the code so that the weather slowly changes (one update per hour) and a storm can develop without using the worldmap.
To prevent such storms from lasting forever, we made it so that after the 60 seconds of being locked in, another weather update is triggered.
When this happens, the storm either ends or continues for another 60 seconds, during which you will remain locked in.
This is the same also for worldmap encountered storms because it'd be complicated to make things behave differently.
 
Can everybody please post his/her comments in this thread very soon?
If modifications need to be made, I can still do it the coming week while I'm on holiday,
but afterwards it's back to working-time for me and I'll be able to do much less for PA! again.
 
Find attached an update for the Capsize mod.
The roll angle will now be displayed on the screen when there is a danger of capsizing.
Additionally, the colour coding will show you what the capsize danger is.
This should help making it clearer to understand what is going on with this mod and make it easier to prevent capsizing.

Once you enter a storm, the roll angle will be displayed as ordinary light yellow.
The colour will change as your roll angle exceeds various warning/damage limits.
If the roll angle is sometimes indicating bright red, it means that if you don't do anything, there is a risk of capsizing.
However, before this happens, you'll get several warning first and you cannot capsize until the roll angle is displayed consistantly as light red.

I didn't change much to make capsizing less frequent, but at least this'll help you understand what's going on.
Please give me any feedback you might have on ships that are capsizing too easily with this update.

Also included in this update are the French rank rename fix and the fix to the bug when you've got a Letter of Marque.
 
I dl'ed the capsize.exe, unzipped it and installed all of the files manually. The game started and ran fine until I tried to save, when it ctd'ed. So, in another b14 p2 install I installed the files one at a time, running the game and saving. This resulted in the game not starting after the "sea.c" file was installed. That looks to be the culprit. More testing needed.
 
Can you enable error logging and post your error.log file?
I thought I had all required files included, but maybe I missed one.
 
On my first install that ctd'ed when trying to save, when restarting it gave a "bad save" message. I replaced the new sea.c with the old one with no change. Then started a new game, and it runs and saves fine. Right now both games are working, but here are the logs.
 
With the old sea.c, the whole mod probably won't be working properly.
Can you please go into a storm and see if any of the roll-dependent events still occur?
 
Can everybody please post his/her comments in this thread very soon?
Sorry I've been a bit inactive here lately- I would have commented sooner.
Anyway, I've just downloaded and tried the improved capsize mod (plus the morale fix), and I'm very impressed!
I managed to get all the warnings (and ALMOST sank), and I think the roll angle display works very well. :onya
(This was just in the lugger Nathaniel starts with)

Just a thought; would some of the game's sound effects be a good idea to add?
For example, when some cargo damages the ship, the crew could shout out like when you rescue survivors?
Or perhaps some visual effects, such as wood splintering off the ship when some cargo damages it?

Even without those, at the very least you've made storms a lot more exciting! :woot
 
With the old sea.c, the whole mod probably won't be working properly.
Can you please go into a storm and see if any of the roll-dependent events still occur?


You are correct. Everything is back to like it was with no warnings. What did I do wrong to make it crash when the new sea.c is added? Would installing patch 2 again overwrite these files? If so I will do that and try again.
 
A thought I had: Do you think maybe this mod should be linked to the Realistic Game Mode and be disabled when you play Arcade mode?
Although I've tried to make it quite playable and not too annoying, there might be people who won't like it much... :?

You are correct. Everything is back to like it was with no warnings. What did I do wrong to make it crash when the new sea.c is added? Would installing patch 2 again overwrite these files? If so I will do that and try again.
I'm not sure really. It's working quite fine for me. You can try installing Patch 2 again, then capsize.exe once more and see what happens.

Just a thought; would some of the game's sound effects be a good idea to add?
For example, when some cargo damages the ship, the crew could shout out like when you rescue survivors?
Or perhaps some visual effects, such as wood splintering off the ship when some cargo damages it?
Definitly good ideas. I was thinking of adding that and randomizing the events a bit further, but ran out of time.
It'd be quite easy adding these things; just requires some time.
I can do it myself some time in the future, but if somebody else wants to give it a try, I'm quite willing to tell you how.
It's not complicated and could probably be done by a beginning Modder. :yes

Even without those, at the very least you've made storms a lot more exciting! :woot
HA! Success! That's exactly the intention! :dance
 
You are correct. Everything is back to like it was with no warnings. What did I do wrong to make it crash when the new sea.c is added? Would installing patch 2 again overwrite these files? If so I will do that and try again.
I'm not sure really. It's working quite fine for me. You can try installing Patch 2 again, then capsize.exe once more and see what happens.


I have done that twice. I am really not comfortable digging around in the innards of a program. I am happy with patch 2 as released, so won't bother with the "capsize" thingy. Maybe a toggle in "options" would work.
 
In that case you can just wait for the new update until Patch 3 is released. :doff

If anybody is interested in adding sound and visual effects into this mod, you can find the relevant code in PROGRAM\NK.c:
Code:
// PB: Capsizing -->
#define ROLL_ANGLE_WARNING 11
#define ROLL_ANGLE_MORALE  12
#define ROLL_ANGLE_GOODS   13
#define ROLL_ANGLE_DAMAGE  14
#define ROLL_ANGLE_CAPSIZE 15

void UpdateShipRoll()
{
ref rCharacter = GetMainCharacter();
if(Whr_IsStorm() && CheckAttribute(rCharacter,"Capsize") && GetCharacterShipClass(rCharacter) < 8)
{
int RollDamageValue;
int i;
string sshiproll;
float RollAngle = makeint(-Radian2Degree(stf(GetAttribute(rCharacter, "ship.ang.z"))));
if(RollAngle < -180) RollAngle = RollAngle + 360;

if(RollAngle > 0 )	sshiproll = "Roll angle is " + abs(makeint(RollAngle)) + " degrees to starboard";
else				sshiproll = "Roll angle is " + abs(makeint(RollAngle)) + " degrees to port";
if(RollAngle == 0)	sshiproll = "Roll angle is " + abs(makeint(RollAngle)) + " degrees";

switch(sti(GetAttribute(rCharacter, "Capsize.Warning")))
{
case ROLL_ANGLE_WARNING: // First Warning
IShipRoll.Log.color = COLOR_NORMAL;
if(abs(RollAngle) >  ROLL_ANGLE_WARNING) IShipRoll.Log.color = COLOR_GREEN_LIGHT;
if(abs(RollAngle) >  ROLL_ANGLE_MORALE ) IShipRoll.Log.color = COLOR_GREEN;
if(abs(RollAngle) >  ROLL_ANGLE_GOODS  ) IShipRoll.Log.color = COLOR_YELLOW;
if(abs(RollAngle) >  ROLL_ANGLE_DAMAGE ) IShipRoll.Log.color = COLOR_RED_LIGHT;
if(abs(RollAngle) >  ROLL_ANGLE_CAPSIZE) IShipRoll.Log.color = COLOR_RED;
if(GetSeaTime() > 10 && abs(RollAngle) > ROLL_ANGLE_WARNING)
{
LogIt("Captain, we have to put our bow to the waves to decrease the rolling movement of the ship");

rCharacter.Capsize.Warning  = ROLL_ANGLE_MORALE;
rCharacter.Capsize.Time = GetSeaTime();
}
break;

case ROLL_ANGLE_MORALE: // Second Warning
IShipRoll.Log.color = COLOR_GREEN_LIGHT;
if(abs(RollAngle) >  ROLL_ANGLE_MORALE ) IShipRoll.Log.color = COLOR_GREEN;
if(abs(RollAngle) >  ROLL_ANGLE_GOODS  ) IShipRoll.Log.color = COLOR_YELLOW;
if(abs(RollAngle) >  ROLL_ANGLE_DAMAGE ) IShipRoll.Log.color = COLOR_RED_LIGHT;
if(abs(RollAngle) >  ROLL_ANGLE_CAPSIZE) IShipRoll.Log.color = COLOR_RED;
if(GetSeaTime() - sti(rCharacter.Capsize.Time) > 10 && abs(RollAngle) > ROLL_ANGLE_MORALE)
{
RollDamageValue = sti(rCharacter.Ship.Crew.Morale) - 10;
LogIt("Captain, the morale of the crew decreased from " + XI_ConvertString(GetMoraleName(rCharacter.Ship.Crew.Morale)) + " to " + XI_ConvertString(GetMoraleName(RollDamageValue)) + " because the ship's rolling is making them seasick");
rCharacter.Ship.Crew.Morale = RollDamageValue; // Decrease morale one level
if (sti(rCharacter.Ship.Crew.morale)<MORALE_MIN) rCharacter.Ship.Crew.morale=MORALE_MIN;

rCharacter.Capsize.Warning  = ROLL_ANGLE_GOODS;
rCharacter.Capsize.Time = GetSeaTime();
}
break;

case ROLL_ANGLE_GOODS: // Third Warning
IShipRoll.Log.color = COLOR_GREEN;
if(abs(RollAngle) >  ROLL_ANGLE_GOODS  ) IShipRoll.Log.color = COLOR_YELLOW;
if(abs(RollAngle) >  ROLL_ANGLE_DAMAGE ) IShipRoll.Log.color = COLOR_RED_LIGHT;
if(abs(RollAngle) >  ROLL_ANGLE_CAPSIZE) IShipRoll.Log.color = COLOR_RED;
if(GetSeaTime() - sti(rCharacter.Capsize.Time) > 10 && abs(RollAngle) > ROLL_ANGLE_GOODS)
{
for(i=GOODS_QUANTITY-1;i>=0;i--)
{
if(GetCargoGoods(rCharacter, i) <= 0) continue; // Don't dump cargo that isn't in the hold
if (CheckAttribute(rCharacter, "quest.generate_trade_quest.iQuantityGoods")) 
{
if ( i == sti(rCharacter.quest.generate_trade_quest.iTradeGoods) ) continue; // Don't dump quest cargo (not realistic, but less frustrating)
}
break;
}
if(GetCargoGoods(rCharacter, i) > 0)
{
RollDamageValue = 1 + makeint(0.1*GetCargoGoods(rCharacter, i));
LogIt("Captain, the cargo has started shifting due to the rolling and " + RollDamageValue + " " + Goods[i].Name + " went overboard");
RemoveCharacterGoods(rCharacter, i, RollDamageValue);
}
else // The cargo hold is empty
{
RollDamageValue = makeint(0.1*GetCrewQuantity(rCharacter));
LogIt("*" + RollDamageValue + " crewmembers are heard yelling from inside the empty cargo hold*");
RemoveCharacterCrew(rCharacter, RollDamageValue); // 10% crew damage
}
rCharacter.Capsize.Warning  = ROLL_ANGLE_DAMAGE;
rCharacter.Capsize.Time = GetSeaTime();
}
break;

case ROLL_ANGLE_DAMAGE: // Fourth Warning
IShipRoll.Log.color = COLOR_YELLOW;
if(abs(RollAngle) >  ROLL_ANGLE_DAMAGE ) IShipRoll.Log.color = COLOR_RED_LIGHT;
if(abs(RollAngle) >  ROLL_ANGLE_CAPSIZE) IShipRoll.Log.color = COLOR_RED;
if(GetSeaTime() - sti(rCharacter.Capsize.Time) > 10 && abs(RollAngle) > ROLL_ANGLE_DAMAGE)
{
switch(rand(1))
{
case 0:
RollDamageValue = makeint(0.1*sti(rCharacter.Ship.HP));
LogIt("Captain, shifting cargo did " + RollDamageValue + " damage to the hull");
Ship_ApplyHullHitpoints(rCharacter, RollDamageValue, KILL_BY_TOUCH, -1); // 10% hull damage
break;

case 1:
RollDamageValue = makeint(0.1*GetCrewQuantity(rCharacter));
LogIt("Captain, that last violent roll washed " + RollDamageValue + " crewmembers overboard");
RemoveCharacterCrew(rCharacter, RollDamageValue); // 10% crew damage
break;
}
rCharacter.Capsize.Warning  = ROLL_ANGLE_CAPSIZE;
rCharacter.Capsize.Time = GetSeaTime();
}
break;

case ROLL_ANGLE_CAPSIZE: // Fifth Warning
IShipRoll.Log.color = COLOR_RED_LIGHT;
if(abs(RollAngle) >  ROLL_ANGLE_CAPSIZE) IShipRoll.Log.color = COLOR_RED;
if(GetSeaTime() - sti(rCharacter.Capsize.Time) > 10 && abs(RollAngle) > ROLL_ANGLE_CAPSIZE)
{
if(RollAngle > 0)	LogIt("Captain, we're capsizing to starboard... ABANDON SHIP!");
else				LogIt("Captain, we're capsizing to port... ABANDON SHIP!");
rCharacter.Capsize.Angle = RollAngle;
ShipDead(sti(rCharacter.Index), KILL_BY_OWNER, sti(rCharacter.Index));
}
break;
}
SendMessage(&IShipRoll, "lll", LOG_AND_ACTIONS_INIT, false, true);
}
else sshiproll = "";
SendMessage(&IShipRoll, "lls", LOG_ADD_STRING, true, sshiproll);
}
// PB: Capsizing <--
For a sound effect, add a line like PlaySound("objects\abordage\abordage_loosing.wav"); (this is the survivor rescue sound).
For visual (particle) effects, you can use some code like this:
Code:
			float fX = stf(rCharacter.Ship.pos.x);
float fY = stf(rCharacter.Ship.pos.y);
float fZ = stf(rCharacter.Ship.pos.z);
CreateParticleSystemX("gunfire",    fX+4-rand(8), fY+4-rand(8), fZ+4-rand(8), 6.0, 4.0, 0.0, 0);
I recall "gunfire" was debris flying around.
"flyers" and "flyers2" would be crewmembers flying through the air.
"ball_splash" is white splashy stuff. There's other particle effects as well that you can experiment with.

All the above code can be added near the LogIt lines for the various events.
 
I can do it myself some time in the future, but if somebody else wants to give it a try, I'm quite willing to tell you how.
It's not complicated and could probably be done by a beginning Modder. :yes
*Hint hint- EC...* ;)
OK you've persuaded me- doesn't look complicated at all, so I'll do a bit of experimenting and let you know what happens...

Maybe a toggle in "options" would work.
I agree with this idea- it would let the players decide for themselves whether they want it or not. Some may want realistic sailing, but not like capsizing, and vice versa... so everyone's covered. :onya

P.S. I've noticed the spellings of Abordage_loosing and Abordage_wining, and I think someone confused the double letters here... :no
 
ARGH! It's so hard to actually find a storm LONG ENOUGH to properly test my changes!!!
Normally, by the time I've found one and reached the 3rd warning, the storm ends (most of my changes are later than that)!
Either that, or I find myself being torn to shreds by a twister and sinking seconds later!

Here's what I'm trying to achieve:

- 1st warning (change course): no adjustment
- 2nd warning (crew are seasick): no adjustment
- 3rd warning (cargo overboard/ crew yell): play sound 'abordage_loosing' to make crew shout. TESTED: WORKS
--------------------------------------------------------BELOW THIS LINE: UNTESTED-------------------------------------------------------
- 4th warning (1.cargo damages hull/ 2.men overboard):
1.crew shout as per above, 'ship_explosion' plays, and debris flies off the ship
2.crew shout as above, some crew fly off the ship (having trouble with how to code this one)
- 5th warning (capsizing): crew member shouts 'Abandon ship!', crew shout as above, 'mast_fall3' plays (sounds like capsizing, don't you think?)
 
Back
Top