1. Dismiss Notice
  2. GOG.com logo

    Thanks to YOUR votes, GOG.com now sells:
    - Sea Dogs - Sea Dogs: Caribbean Tales
    - Sea Dogs: City of Abandoned Ships

    Vote now to add Pirates of the Caribbean to the list!

    Dismiss Notice
  3. Under the Crossbones Podcast

    A Pirate Podcast with Interviews
    Music, Comedy and all things Pirate!

    - Episode Guide - About - Subscribe -
    - Twitter - Facebook - iTunes - Android -
    - Youtube - Fill the Coffers -

    Dismiss Notice
  4. New Horizons logo

    Quick links for PotC: New Horizons
    - Download latest version
    - Wiki - FAQ - Report bugs here
    - ModDB profile

  5. GOF logo

    Quick links for AoP2: Gentlemen of Fortune 2
    - Downloads and info
    - Historical Immersion Supermod
    - ModDB Profile

Dismiss Notice
New to the forum?
Please take a moment to read our Welcome Message and Forum Rules.

Planned Feature Include Cannon Weight and Number in Cargo Capacity

Discussion in 'Build 15 Brainstorming' started by Pieter Boelen, Apr 12, 2015.

  1. Pieter Boelen

    Pieter Boelen (Not So) Old Seadog Staff Member Administrator Storm Modder Hearts of Oak Donator

    Joined:
    Nov 11, 2004
    Messages:
    66,622
    Gender:
    Male
    Occupation:
    Maritime Research: Project Engineer (Analysis)
    Location:
    Wageningen, The Netherlands
    Two extra new changes for the next update:
    - Cannon weight is shown in the Shipyard Interface, since this is now actually relevant
    - The "capsize timer" is started only once, hopefully reducing the number of log messages when this occurs
     
  2. Pieter Boelen

    Pieter Boelen (Not So) Old Seadog Staff Member Administrator Storm Modder Hearts of Oak Donator

    Joined:
    Nov 11, 2004
    Messages:
    66,622
    Gender:
    Male
    Occupation:
    Maritime Research: Project Engineer (Analysis)
    Location:
    Wageningen, The Netherlands
  3. Pieter Boelen

    Pieter Boelen (Not So) Old Seadog Staff Member Administrator Storm Modder Hearts of Oak Donator

    Joined:
    Nov 11, 2004
    Messages:
    66,622
    Gender:
    Male
    Occupation:
    Maritime Research: Project Engineer (Analysis)
    Location:
    Wageningen, The Netherlands
    Could you give me the exact scenario so that I can check it and/or reproduce the problem?

    I seem to have noticed some bath math related to the overweight ships as well, but I don't know why that happens and haven't been able to trigger it when I actually want. :modding
     
  4. Hylie Pistof

    Hylie Pistof Curmudgeon Staff Member QA Tester Storm Modder

    Joined:
    Jan 15, 2010
    Messages:
    13,768
    Gender:
    Male
    That was the scenario. I happened to be at St. Pierre when it happened in the Sea Hawk storyline, but POTC has always been bad at math and randomly overloads ships. It just never mattered before.
     
  5. Pieter Boelen

    Pieter Boelen (Not So) Old Seadog Staff Member Administrator Storm Modder Hearts of Oak Donator

    Joined:
    Nov 11, 2004
    Messages:
    66,622
    Gender:
    Male
    Occupation:
    Maritime Research: Project Engineer (Analysis)
    Location:
    Wageningen, The Netherlands
    For non-player ships I can imagine the game randomly overloading them, though of course we don't want that to happen.
    But for any ships in your own fleet, you should be in control and any overloading should at least occur on purpose.
    So how did you manage that so that I can try it the same way?

    Also, the regular functions that add cargo have a check to prevent "cargo overups". So with only loading cargo, it should be completely impossible to go over the limit.
    If you do go over, the code should simple add what fits and not add the rest. o_O
     
  6. Grey Roger

    Grey Roger Sea Dog Staff Member Storm Modder

    Joined:
    Feb 12, 2007
    Messages:
    6,413
    There's definitely a problem with loading a ship, though I can't provide a savegame or log files because in my case it happened part way through a battle and you can't save game there. I'd boarded and captured an enemy ship, but this is a new game so I don't have Leadership high enough to put an officer in charge of a prize ship, so I helped myself to as much of its cargo as I could carry. I clicked "Take all <x>" - I think it was food, but it may have been some other commodity. The ship promptly went over its maximum capacity as it overstocked on <x>. I didn't give it the chance to get as far as a capsize warning, I put enough of <x> back to bring my total load back down to the maximum, then let the captured ship sink and continued with the rest of the battle.
     
  7. Pieter Boelen

    Pieter Boelen (Not So) Old Seadog Staff Member Administrator Storm Modder Hearts of Oak Donator

    Joined:
    Nov 11, 2004
    Messages:
    66,622
    Gender:
    Male
    Occupation:
    Maritime Research: Project Engineer (Analysis)
    Location:
    Wageningen, The Netherlands
    One thing I know for sure: If you load cargo, then install cannons and finally add crew, you have the highest chance of overloading your ship.
    Cargo should never overload because there is code in place to prevent that. I noticed the shipyard also prevented overloading from installing cannons.
    But cannons in the ransack interface and crew anywhere has no capacity checks so you could easily go over the maximum.

    It does seem there are all sorts of "magical" things going wrong in the code everywhere that we're only noticing now because of this.
    Perhaps we should disable the whole "overloaded ships capsize" code for non-player ships so we can start with getting things right for only the player.

    I had hoped it would be quite uncommon for NPC ships, but apparently more goes wrong there than I originally anticipated.
    (UGH! Why can't things just work properly to begin with?!? We're always finding more bugs that have to be fixed. :modding )
     
  8. Grey Roger

    Grey Roger Sea Dog Staff Member Storm Modder

    Joined:
    Feb 12, 2007
    Messages:
    6,413
    I didn't move cannon and I don't think I moved crew. I just clicked "Take all <x>" and it took rather too much <x>, so I had to put some back. This was moving cargo from an NPC (defeated enemy) ship to a PC ship (mine, the little jackass bark which you get very early in the "Bartolomeu" storyline).

    But now I have to wonder what the final intended purpose of this mod was. In the beginning ships had cargo capacities for cargo, crew capacities for crew and maximum cannon number and size. Warships had enough cargo space to carry supplies, merchants had rather more so they could carry trade cargo. Gameplay was nicely balanced.

    Then there was the idea to have "realistic" cargo capacities which would account for cannons and crew as well as cargo, which was never going to end well because a deck full of guns takes up a lot more space than indicated by the mass of those guns. Warships ended up with silly capacities, a Razee frigate having enough space for plenty of supplies plus the entire cargo of a couple of merchantmen.

    So now there seems to be some distinction between trade cargo space and supplies cargo space, which won't suit privateers who would not need as much supply space but would want to stuff their holds with cargo looted from ships they can't capture as prizes. Cargo space should be cargo space and it's up to the captain to decide how much will be filled with what sort of supplies. Cannon space, on the other hand, needs to be kept separate because a gun doesn't just occupy its weight's worth of space; it's not tall enough to reach the ceiling so there's empty space above it, and there's also space around it so the gun crew have room to service it.

    Here's a little test someone can try. A Fast Merchantman is supposed to be a Corvette which has had its guns and crew reduced to make space for more cargo. Get a Corvette, sell guns and fire crew so that it has the same cannons and crew as a Fast Merchantman, and see how much cargo space you have. If it's the same as or a bit less than a Fast Merchantman, good. If it's significantly more then something isn't right. ;)

    And in the end, if this works out correctly, warships will have enough space to carry their supplies plus a little extra, while merchants will have more space so they can carry trade cargo. Sort of like it was in the first place. xD
     
  9. Pieter Boelen

    Pieter Boelen (Not So) Old Seadog Staff Member Administrator Storm Modder Hearts of Oak Donator

    Joined:
    Nov 11, 2004
    Messages:
    66,622
    Gender:
    Male
    Occupation:
    Maritime Research: Project Engineer (Analysis)
    Location:
    Wageningen, The Netherlands
    Indeed from a genuine gameplay perspective, I don't think there is any huge need for any changes to the Beta 3.4 capacity functionality.

    From my side, the only REAL difference that we would get when this mod functions properly is that there is no need for ships like the "Fast Merchantman" anymore.
    Conversion from a navy to a merchant ship then wouldn't need to be done on the ships_init.c level anymore at all; it could be done for any ship while ingame.
    Installing smaller cannons or sailing with less crew would directly give you more cargo capacity.


    I don't think there will be a proper correlation between the Fast Merchantman and a Corvette with the same cannons and crew, because the code dealing with them is really quite different.
    But ideally I agree that should be the case.

    In any case, the silly cargo capacities for warships should be undone again. The only reason they still have large holds is because I assumed they would spend double the amount of time at sea.
    But that is one line of code that can easily be disabled again.

    In fact, most of my modifications on this are limited to separate sections and functions in various places.
    Which means that putting a toggle on it would be quite doable. So if we consider it a futile effort to try and get this fully functional,
    we can have it OFF by default and put it under the "unfinished mods" at the bottom of PROGRAM\globals.c .
    Then we can always continue where we left off at a later date.

    This is indeed a potentially VERY complex mod and it sort-of escalated a bit from the original effort.
    Not to mention it is again me doing something that I wasn't intending to do at all.

    Now that we have proven that we CAN make this mod, but there are a lot of unforeseen issues that need to be fixed to make it work properly, the next question is if we should actually continue on this.
    It is possible. But clearly it will take quite a bit more time, effort and testing to get right.
     
  10. Hylie Pistof

    Hylie Pistof Curmudgeon Staff Member QA Tester Storm Modder

    Joined:
    Jan 15, 2010
    Messages:
    13,768
    Gender:
    Male
    Indeed this is a VERY complicated mod that I thought JNorrington was working on. From my point of view all we needed was to get all ships on the same system as the old weight system is all over the place with this ship not having enough cargo capacity for its size and that ship carrying far more than it could.

    Then comes adding cannon and crew weights into the equation.

    Then comes seeing how this works with the modified economy.

    If it is being modified daily I can not test it. All I know so far is that margins are tight and that smuggling, treasure quests, and capturing ships are the only way to make money with small ships.
     
  11. Pieter Boelen

    Pieter Boelen (Not So) Old Seadog Staff Member Administrator Storm Modder Hearts of Oak Donator

    Joined:
    Nov 11, 2004
    Messages:
    66,622
    Gender:
    Male
    Occupation:
    Maritime Research: Project Engineer (Analysis)
    Location:
    Wageningen, The Netherlands
    I don't have any intention of modifying this daily. In fact, it is my intention to stop modifying anything for a while because I've got some other things to take care of.
    But perfore I do that, I want the latest Beta 3.5 version to be as complete and playable as possible.

    So should we keep this modification? Or should we just temporarily disable it altogether and go back to Beta 3.4 state on all the numbers without the dynamic influence?
     
  12. Hylie Pistof

    Hylie Pistof Curmudgeon Staff Member QA Tester Storm Modder

    Joined:
    Jan 15, 2010
    Messages:
    13,768
    Gender:
    Male
    Hmm. It might be best to make a standard install without it and then we can test JNorrington's mod separately. That way you can do what you need to do and we can tinker with it on the side without messing up everyone else who is not testing it.

    I have been looking at larger ships in the shipyard and some things do not make sense to me yet.
     
  13. Pieter Boelen

    Pieter Boelen (Not So) Old Seadog Staff Member Administrator Storm Modder Hearts of Oak Donator

    Joined:
    Nov 11, 2004
    Messages:
    66,622
    Gender:
    Male
    Occupation:
    Maritime Research: Project Engineer (Analysis)
    Location:
    Wageningen, The Netherlands
    Just to be clear here, the only work by J Norrington that is in the current modpack update is his changes to the weights of the various cannon types.
    His work on cargo capacities is NOT in there anymore.

    Instead, I have written some code to automatically mess around with the cargo capacities in ships_init.c based on the original Beta 3.4 values.
    That is now done as follows:

    CREW:
    - Calculate minimum and maximum crew as per Hook's suggestions posted in 2009. See here:
    http://www.piratesahoy.net/threads/some-notes-on-setting-the-ships-crew-numbers.13282/#post-506868
    - If the ships_init.c values are lower than these calculated values, override the ships_init.c values with these instead.
    That should prevent perpetually undercrewed ships that simply cannot fit the crew that they need to operate.

    CARGO:
    - Calculate the weight taken up by a standard "Auto Buy" supply purchase.
    - If the ships_init.c capacity is lower than that, override it with the calculated value.
    That should ensure every ship in the game can actually fit the "Auto Buy" supplies in the cargo hold.

    NAVY ALTERNATE:
    - For navy ships only, the "auto buy" supplies are based on DOUBLE the number of days at sea to assume that they can spend longer without resupplying.
    - Only 1/3rd of the ships_init.c capacity is added on top of this to prevent navy ships from getting extra cargo carrying capacity compared to the other ships.

    CANNONS AND CREW:
    - The weight required for cannons and crew is added to the ships' capacity afterwards.

    So the capacities you see in the game are:
    - Merchant/versatile capacity = ships_init.c value (with a minimum enforced based on "Auto Buy") + crew weight + default cannon weight
    - Navy capacity = Double "Auto Buy" capacity + 1/3rd ships_init.c value + crew weight + default cannon weight

    All of this is handled after the actual ships_init.c entry definitions and can therefore easily be tweaked or disabled completely for all ships in the game.


    INTENTION FOR FUTURE:
    The current situation is intended to be temporary. If we go through with this mod, it would be my intention to have the ships_init.c capacity values represent the "free space for cargo".
    Space required for standard supplies, crew and default cannons would be calculated afterwards and added to this.


    RANDOMIZATION:
    One thing that makes this whole process REALLY fuzzy is the randomization that is applied to the ships in the game itself.
    You have the national ship modifiers (from the top of ships_init.c) which are used as scalars on the ships_init.c values.
    However, these apparently serve as a "maximum" of sorts as every time the same ship is generated with the same nationality, the stats will be different.
    Sometimes this is a little bit different, sometimes more. This can be avoided for individual ships (using the refShip.unique = true; line) or the code responsible could be disabled altogether.


    Does any of the above make any sense to you guys?
     
  14. Grey Roger

    Grey Roger Sea Dog Staff Member Storm Modder

    Joined:
    Feb 12, 2007
    Messages:
    6,413
    Cargo capacity is cargo capacity, it will be up to the captain to decide what he wants to put in there - more food and rum for a longer journey, more planks and sailcloth for repairs, less of the above plus more trade goods, or whatever combination he sees fit.

    If "Auto buy" capacity is greater than 1/3 of Ships_init.c capacity then warships are going to do disproportionately well out of this.

    Ideally if you take a Corvette and strip out guns and crew to match those of a Fast Merchantman, you should end up with less capacity than a genuine Fast Merchantman. You haven't really converted the gun deck into a proper cargo hold, so it is less efficient at storing the cargo. (This ought to happen because guns take up more space than indicated by their weight, so if all you're getting back is a gun's weight equivalent then you're not getting back the full capacity of the gun deck.) So the Fast Merchantman should not be redundant. (Besides, it's a Merchant ship and should be easier to buy. This is because you can't do the reverse conversion and turn it into a Corvette.)

    How are injured crew figured into this? Do they count against the crew weight? You've been in a fight, some of your crew are injured, then you've stuffed your hold with booty from the defeated enemy ship. The next day some of your crew are healed - will the ship now be overloaded?
     
  15. Pieter Boelen

    Pieter Boelen (Not So) Old Seadog Staff Member Administrator Storm Modder Hearts of Oak Donator

    Joined:
    Nov 11, 2004
    Messages:
    66,622
    Gender:
    Male
    Occupation:
    Maritime Research: Project Engineer (Analysis)
    Location:
    Wageningen, The Netherlands
    Of course! If you don't actually use "Auto Buy", then you can use the capacity the number as you see fit.
    The only difference is that Auto Buy will automatically buy double supplies for navy ships and therefore navy ships get the capacity required to fit that.
    This is based on J Norrington's note of large navy vessels having quite huge cargo spaces.

    Ideally I would want the "SupplyScalar" set individually per ship (which is totally possible) so that we can do away with the "navy ships get double" line.
    In fact, we could easily do away with that already. It was only an experiment.

    This 1/3rd is added on top of the supply capacity. So yes, navy ships might still get quite a substantial capacity from all this.
    I did that mainly to include some sort of reduction but maintain a "buffer" to allow for the (annoying!) randomization effects.

    For reference, this is what it currently does:
    Code:
        // NOTE: To be rewritten once all ships' cargo capacities are reconsidered
         if(sti(refShip.Type.War) == true && sti(refShip.Type.Trade) == false)           // For warships
         {
           if (!CheckAttribute(refShip, "SupplyScalar")) refShip.SupplyScalar = 2.0;       // Double amount of supplies
           MinCapacity  = GetSupplyWeight(refShip);                       // Required weight for supplies
           MinCapacity  += sti(refShip.Capacity)/3;                       // Add 1/3rd of defined cargo capacity
         }
         else                                           // For merchant/versatile ships
         {
           MinCapacity  = GetSupplyWeight(refShip);                       // Required weight for supplies to ensure those can fit in the cargo hold
           if (sti(refShip.Capacity) > MinCapacity) MinCapacity = sti(refShip.Capacity);     // If supplies can fit, then use full cargo capacity, else use minimum required
         }
         MinCapacity  += sti(refShip.CannonsQuantity) * GetCannonWeight(sti(refShip.Cannon));   // Add extra capacity to allow for standard cannon type
         MinCapacity  += sti(refShip.MaxCrew)  * CREW_WEIGHT;               // Add extra capacity to allow for crew
         refShip.Capacity = MinCapacity;
    I'll be adding a toggle on the whole mod now because I foresee we won't be able to get it sorted properly in a hurry.

    All true. :yes

    Good question. I used GetTotalCrewQuantity which already includes wounded crew. So that should not make a difference.
    But I could have easily forgotten about that and used the wrong function. Now that would've made some weird effects indeed! :razz
     
  16. Pieter Boelen

    Pieter Boelen (Not So) Old Seadog Staff Member Administrator Storm Modder Hearts of Oak Donator

    Joined:
    Nov 11, 2004
    Messages:
    66,622
    Gender:
    Male
    Occupation:
    Maritime Research: Project Engineer (Analysis)
    Location:
    Wageningen, The Netherlands
    As per the next update, the following functionality will REMAIN:
    Code:
      . Modified cannon weights by J Norrington
      . Minimum Ship Initialization Values Enforced by Pieter Boelen
      > Minimum and maximum crew overwritten if set too low in ships_init.c
      > Default "Auto Buy" supply will always fit into each ship's cargo hold
      > Changes to ensure ship randomization doesn't cause less capacity than the pre-calculated minimum
      > Possibility to set "supply scalars" in ships_init.c to distinguish between coastal, regular and long-distance ships
    However, this will all be DISABLED with a toggle:
    Code:
      . Realistic Cargo Mod by Pieter Boelen
      > Disabled with SHIPS_WEIGHT toggle at the bottom of PROGRAM\globals.c, enabling requires New Game!
      > Crew amount and cannons included dynamically in cargo capacity [WIP: To be tested]
      > Overweight ships capsize if the problem is not resolved within a minute
      > Naval ships have double capacity for supplies, but reduced extra capacity for other cargo
    That basically sets us back to Beta 3.4 state on this, but with some slightly different cannon weights.
    And minimum values enforced for MinCrew, MacCrew and Capacity to prevent gameplay issues resulting from that.
     
  17. Hylie Pistof

    Hylie Pistof Curmudgeon Staff Member QA Tester Storm Modder

    Joined:
    Jan 15, 2010
    Messages:
    13,768
    Gender:
    Male
    One thing I did like about JNorrington's work was that all ships had their stats changed to reflect their actual hull size. Ships like the Brigs, which are small ships designed for speed, having larger holds than much wider and deeper ships like the 6th rates has always bothered me. There are other oddities as well with the large ships.

    So there will no longer be a reason to use merchant ships? Cool. I always thought that the Fragata Latina had far too small holds.

    The actual fastmerchantmen not only had their cannons and crew quarters removed, they also had the extra underdeck bracing to support said cannons removed giving them even more room for cargo.
     
  18. Pieter Boelen

    Pieter Boelen (Not So) Old Seadog Staff Member Administrator Storm Modder Hearts of Oak Donator

    Joined:
    Nov 11, 2004
    Messages:
    66,622
    Gender:
    Male
    Occupation:
    Maritime Research: Project Engineer (Analysis)
    Location:
    Wageningen, The Netherlands
    Beta 3.4 cargo capacity state returned in here: http://www.piratesahoy.net/threads/build-14-beta-3-5-internal-wip-for-testing.24817/
    Only change compared to before is the minimum values which are enforced if required.
    Plus I think all ships have 20% more capacity than in Beta 3.4 due to me increasing the national capacity modifiers to always be values > 1.

    This can be re-enabled at the bottom of PROGRAM\globals.c .
    So I suppose until anyone cares about taking this further, I'll leave it at this.

    No more "WIP", but I'll keep it marked as "Needs Testing".
     
  19. Pieter Boelen

    Pieter Boelen (Not So) Old Seadog Staff Member Administrator Storm Modder Hearts of Oak Donator

    Joined:
    Nov 11, 2004
    Messages:
    66,622
    Gender:
    Male
    Occupation:
    Maritime Research: Project Engineer (Analysis)
    Location:
    Wageningen, The Netherlands
    Alternate idea would be to disable only the capsizing penalty for overloaded ships.
     
  20. Hylie Pistof

    Hylie Pistof Curmudgeon Staff Member QA Tester Storm Modder

    Joined:
    Jan 15, 2010
    Messages:
    13,768
    Gender:
    Male
    I have been checking and so far every load is just under the limit.
     

Share This Page