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

Planned Feature Include Cannon Weight and Number in Cargo Capacity

@Pieter Boelen: If I'm not mistaken sir you created a code that adds the cannon/crew weight to the ships? Just fired up the new wip and there appears to be weight in the cargo hold when emptied. If so a hearty thanks sir, does it use the weight values from Cannons.Init? I assume so. Going to hit the sack and start fresh this evening. My main priority will be finding a way to make the new goods weight recalculate I have a few ideas on the matter but I'll share them later after I regather my bearings.

As far as the Should we do it? I'd say yes simply because that this may help development of a future system in HOO or maybe other games. At the worst if all we do is improve the cargo/cannon weight system of this rather dated game It won't be time wasted. Who knows maybe GOG will pick up this game and make it more available to the public.
 
It's possible that this was an earlier version in which cannon and crew counted against cargo capacity but your revised capacities had not been implemented. I think the increased cargo capacity is in a newer mod which I've installed since taking that screen shot, and which resulted in the 3rd rate Bellona in which you start the "Hornblower" storyline having a capacity of over 30000, enough to take the entire cargo of a couple of merchant ships as loot while still carrying a reasonable amount of food and ammunition for its wartime duties.

The cutter is supposed to be 100 tons, which is 2000 cwt. It now has a capacity of 2700. The cargo hold is about 35% bigger than the entire ship. xD
 
@Pieter Boelen: If I'm not mistaken sir you created a code that adds the cannon/crew weight to the ships? Just fired up the new wip and there appears to be weight in the cargo hold when emptied. If so a hearty thanks sir, does it use the weight values from Cannons.Init? I assume so.
Indeed it does. In very simple form for now. See here for details:
http://www.piratesahoy.net/threads/...d-number-in-cargo-capacity.24953/#post-505884

My main priority will be finding a way to make the new goods weight recalculate I have a few ideas on the matter but I'll share them later after I regather my bearings.
My personal idea would be to go with the automatic calculation. We did something similar (but much, much simpler) for the ship Tiers as well.
This part in ships_init.c is part of a loop that goes through all ships in the game:
Code:
    // Armada: Ship Tier Mod -->
  refShip.Class = 1;
  if(sti(refShip.MaxCrew) < 900)  refShip.Class = 2;
  if(sti(refShip.MaxCrew) < 550)  refShip.Class = 3;
  if(sti(refShip.MaxCrew) < 400)  refShip.Class = 4;
  if(sti(refShip.MaxCrew) < 250)  refShip.Class = 5;
  if(sti(refShip.MaxCrew) < 100)  refShip.Class = 6;
  if(sti(refShip.MaxCrew) <  60)  refShip.Class = 7;
  if(sti(refShip.MaxCrew) <  30)  refShip.Class = 8;
     if(refShip.id == "boat")      refShip.Class = "";   //PB
     if(refShip.id == "fort")      refShip.Class = "";   //PB
     if(HasSubStr(refShip.id, "obj_")) refShip.Class = "";   //JRH
  // Armada: Ship Tier Mod <--
This function from NK.c is used to put automatic supplies in ships:
Code:
void SupplyShip(ref char)
{
   if(FOOD_ON) AddCharacterGoods(char, GOOD_WHEAT, 1+makeint(makefloat(GetCrewQuantity(&char)) * FOOD_PER_CREW * WHEAT_DAYS));
   if(FOOD_ON) AddCharacterGoods(char, GOOD_RUM, 1+makeint(makefloat(GetCrewQuantity(&char)) * FOOD_PER_CREW * RUM_DAYS));
   AddCharacterGoods(char, GOOD_BALLS, makeint(makefloat(GetMaxCannonQuantity(&char)) * BALLS_PER));
   AddCharacterGoods(char, GOOD_GRAPES, makeint(makefloat(GetMaxCannonQuantity(&char)) * GRAPE_PER));
   AddCharacterGoods(char, GOOD_KNIPPELS, makeint(makefloat(GetMaxCannonQuantity(&char)) * CHAIN_PER));
   if(!USE_REAL_CANNONS) AddCharacterGoods(char, GOOD_BOMBS, makeint(makefloat(GetMaxCannonQuantity(&char)) * BOMBS_PER));
   if(CANNONPOWDER_MOD && GetMaxCannonQuantity(&char) > 0)
   {
     int PowderPerShot = 0;
     ref rCannon; makeref(rCannon,Cannon[GetCaracterShipCannonsType(char)]);
     int shotQty = GetCargoGoods(&char,GOOD_BALLS) + GetCargoGoods(&char,GOOD_GRAPES) + GetCargoGoods(&char,GOOD_KNIPPELS) + GetCargoGoods(&char,GOOD_BOMBS);
     if(CheckAttribute(rCannon,"gunpowder")) PowderPerShot = sti(rCannon.gunpowder);
     AddCharacterGoods(char, GOOD_GUNPOWDER, POWDER_PER * shotQty * PowderPerShot);
   }
   AddCharacterGoods(char, GOOD_SAILCLOTH, makeint(makefloat(GetCharacterShipHP(&char)) * SAIL_PER));
   AddCharacterGoods(char, GOOD_PLANKS, makeint(makefloat(GetCharacterShipHP(&char)) * PLANKS_PER));
}
This uses a copy of the code used by Auto Buy. If that could be rewritten to calculate the weight required without actually adding any cargo, it would be easy to recalculate the ships' cargo capacities based on this.

As far as the Should we do it? I'd say yes simply because that this may help development of a future system in HOO or maybe other games. At the worst if all we do is improve the cargo/cannon weight system of this rather dated game It won't be time wasted. Who knows maybe GOG will pick up this game and make it more available to the public.
That would definitely be my hope. :yes
 
@Hylie Pistof: No worries I'm commited to this project and intend to see this mod through to the finish. My work can sometimes be hectic as I am on call 6 days a week so work ranges from weeks when I work 1 or 2 shifts to weeks when I work all 6 days straight don't mind the overtime though just bought me a bottle of Mount Gay 1703 this weekend so I'll have something nice to drink this evening.
 
Okay gentlemen added the realistic cannon weight to the Cannons.Init it is included in the latest update of my cargo mod. Still working on getting the cargo to recalculate automatically calling in the cavalry tomorrow a friend with coding skills. It is my hope that I can get it up and running before I hit the sack tomorrow morning, headed to bed have a good one guys.
 
As per the next update, all ships will get extra Cargo space to allow for crew and cannon weight.
This should prevent random ships from being generated overweight.

Any ships that are still overweight will trigger a warning and capsize about a minute later.
But not course if you go back ashore in that minute or dump enough Cargo to resolve the problem.
This has been tested and seems to work well.

Sounds like a good idea?
 
Note that while a real cargo hold would likely be pretty full, a gun deck would not. The actual guns don't take up much space; there's a lot of room around them to allow the gun crews to service them. So if guns and cargo are made interchangable, a warship whose free space is mostly gun deck may end up with rather more cargo space than it should have. (Which is possibly why, during my last playthrough of "Hornblower", I found that Indefatigable had enough cargo space to carry plenty of food and rum, plenty of ammo, plenty of sailcloth and planks, and still had enough space left over to take the entire contents of two fast merchantmen.)
 
There's only so much we can do without making things crazy complicated.

At least with my recent changes, Cargo capacity for such navy ships is ten times smaller than it was in Beta 3.4 .

It does allow for 60 days supplies though, which Auto Buy would get automatically.
That is easily disabled though as it is only a single line of code.
Without that line, navy ships really get tiny Cargo capacities next to their supplies.

We'll have to see what it looks like in the game now and we can tweak it accordingly.

Nope also that everything is based on weight and not on volume.
 
Can someone upload the Beta 3.4 version of PROGRAM\STORE\initGoods.c ?
Since I am restoring the cargo capacities, the prices should be changed back too. But I won't have access to my Beta 3.4 install until Tuesday/Wednesday.
@Hylie Pistof, perhaps you still have it lying around somewhere?
 
Ship capacities properly increased to allow for this mod plus overweight ships now capsize.
Changes included in here: http://www.piratesahoy.net/threads/build-14-beta-3-5-internal-wip-for-testing.24817

Please keep an eye on all ships' cargo capacities as well as the extra log messages I added to inform us of overweight ships.
If I did this right, I think non-player ships should never be overweight anymore.

Additionally, I noticed that you can hardly get your ship overweight even by installing larger cannons on an already fully loaded ship.
Apparently there was already code in place to prevent that so "your quartermaster makes an emergency sale of goods" until the new cannons DO fit.
This probably makes it fairly uncommon to accidentally overload your ship and cause a Wasa incident.
But it is still NOT actively prevented, so it is still possible. Now here's a challenge: Try to capsize your ship in port (outside a storm)! :cheeky
 
I never trusted auto-buy anyway and always choose my own amounts of food, rum, planks, sailcloth, ammo, powder and medicaments. So I can make sure that my ships are never overloaded.

Some other captains are apparently not so careful. xD (Neither the Horatio nor the Reasonable are mine, they're presumably random traffic somewhere near the island.)

capsizers.jpg
 
I never trusted auto-buy anyway and always choose my own amounts of food, rum, planks, sailcloth, ammo, powder and medicaments. So I can make sure that my ships are never overloaded.
I did catch an int/float error in the Auto Buy code last week that seemed to be the cause of it doing weird stuff.
However, I fixed that too so you might want to consider trying it again. I did some tests with it and as far as I could tell, it does what it is designed to do.
Medicines aren't part of the normal supplies though; if you have some valid numbers to use (#medicines per crew per day or something?, that could be added though.

Some other captains are apparently not so careful. xD (Neither the Horatio nor the Reasonable are mine, they're presumably random traffic somewhere near the island.)
That's unexpected! While I know the new code would do that for non-player overloaded ships, I didn't think that would happen.
After all, the cargo capacities for merchant and versatile ships are higher now than in Beta 3.4 .
How frequently does that occur? I'll probably have to put some DumpAttributes lines in there so we can figure out the exact cases where this happens.
 
PROGRAM\Characters\CharacterUtilite.c add some extra lines:
Code:
  // PB: Cannons and Crew -->
   loadSpace = loadSpace + GetCannonCurQuantity(_refCharacter) * GetCannonWeightByCharacter(_refCharacter);
   loadSpace = loadSpace + GetTotalCrewQuantity(_refCharacter) * CREW_WEIGHT;

   if (loadSpace > GetCargoMaxSpace(_refCharacter))
   {
     if (bSeaActive && !bAbordageStarted)
     {
       if(CheckAttribute(_refCharacter, "UnstableShip"))
       {
         DeleteAttribute(_refCharacter, "UnstableShip");
         TraceAndLog("The " + GetMyShipNameShow(_refCharacter) + " captained by " + GetMySimpleName(_refCharacter) + " has capsized due to overloading!");
         CapsizeShip(_refCharacter);
       }
       else
       {
         if(IsCompanion(_refCharacter))
         {
           if(IsMainCharacter(_refCharacter))
             TraceAndLog("Captain, it seems our ship is unstable! We have to lose weight and quick!");
           else
             TraceAndLog("Captain, it seems the " + GetMyShipNameShow(_refCharacter) + " captained by " + GetMySimpleName(_refCharacter) + " is unstable! She has to lose weight and quick!");
         }
         else
         {
           TraceAndLog("The " + GetMyShipNameShow(_refCharacter) + " captained by " + GetMySimpleName(_refCharacter) + " is in danger of capsizing!");
           LogIt("This should NOT be happening. Please post your compile.log file at piratesahoy.net!"); // add this
           DumpAttributes(_refCharacter); // and this
         }
         PostEvent("DoCapsize", (50+rand(20))*1000, "i", _refCharacter);
       }
That should at least give us more information when this happens so hopefully we can figure out why.

Did you get a log message later that those ships actually did capsize? That is always supposed to happen 50-70 seconds later.
 
I didn't see any messages about ships capsizing, and I've only even seen the warning messages that one occasion when I was on my way out of Cayman. Since the wind was doing its best to blow me straight back into Cayman, I may have switched to worldmap a bit sooner than 50-70 seconds later, which may be why I never saw any reports about the ships capsizing. (I did wait a little while to see if it would happen, but can't say for sure whether it was up to a minute.)

Apparently the latest update will require starting a whole new game. This I don't want to do just now as I'm rather well advanced into the "Bartolomeu o Portugues" storyline. Once I've finished that, I'll apply whichever update is then current and start something else. (Possibly try free play in someone's navy to try out my own promotion code...)
 
I didn't see any messages about ships capsizing, and I've only even seen the warning messages that one occasion when I was on my way out of Cayman. Since the wind was doing its best to blow me straight back into Cayman, I may have switched to worldmap a bit sooner than 50-70 seconds later, which may be why I never saw any reports about the ships capsizing. (I did wait a little while to see if it would happen, but can't say for sure whether it was up to a minute.)
Next time it happens, please give it 70 seconds to confirm.

Actually, was this with or without my rewritten ships_init.c file and with or without a reinitialization?
That would definitely make a massive difference as without those changes, this could easily occur for all sorts of ships.

Apparently the latest update will require starting a whole new game. This I don't want to do just now as I'm rather well advanced into the "Bartolomeu o Portugues" storyline. Once I've finished that, I'll apply whichever update is then current and start something else. (Possibly try free play in someone's navy to try out my own promotion code...)
You can also install it and set the IS_SGV value back to 14.911 to continue on your old savegame. Make sure to press F11.
There shouldn't be any major issues; just some changes that wouldn't have taken effect.

The main reason for the new game being required is that I want to be sure that any issues reported aren't already fixed by later changes.
 
Back
Top