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

Tutorial TECHNICAL TIP - Understanding Demasting/Flag Graphical Errors and Reducing Problems

TheBlackKnight

Corsaire Flibustier
Storm Modder
Pirate Legend
All,

This post is related to the graphical anomalies that can occur from demasting ships.
It is somewhat from a revisit from old CoAS tutorial post by Jonesie85/Luke159 back in 2012.
They made a basic description of how to disable dismasting which was good at the time because of all the errors and CTD being caused by specific ship models in GOF 1.2.

The definition source of mast damage is located in AIShip.c (Program/SeaAI)
If you change this code to the following values the masts will never fall (but sails continue to take damage):

Code:
switch (iDamageType)
    {
        case SHIP_MAST_TOUCH_ISLAND:
            fDamage = fDamage + 0.0;
        break;
        case SHIP_MAST_TOUCH_SHIP:
            //aref rCollideCharacter = GetEventData();
            fDamage = fDamage + 0.0;
        break;
        case SHIP_MAST_TOUCH_BALL:
            int    iBallType = sti(AIBalls.CurrentBallType);
            switch (iBallType)
            {
                case GOOD_BALLS:
                    fDamage = fDamage + 0.0;
                break;
                case GOOD_GRAPES:
                    fDamage = fDamage + 0.0;
                break;
                case GOOD_KNIPPELS:
                    fDamage = fDamage + 0.0;
                break;
                case GOOD_BOMBS:
                    fDamage = fDamage + 0.0;
                break;
            }
        break;
    }

Now here is the "sticky wicky".
If you do this you are in essence disabling the feature entirely.
But, the problem that I have found in current demasting is the default values are set way TOO HIGH for cannon damage (regardless of cannon damage setting of CoAS, Inbetween, or Realistic)

My recommendation is something closer to this:

Code:
switch (iDamageType)
    {
        case SHIP_MAST_TOUCH_ISLAND:
            fDamage = fDamage + 0.1;
        break;
        case SHIP_MAST_TOUCH_SHIP:
            //aref rCollideCharacter = GetEventData();
            fDamage = fDamage + 0.1;
        break;
        case SHIP_MAST_TOUCH_BALL:
            int    iBallType = sti(AIBalls.CurrentBallType);
            switch (iBallType)
            {
                case GOOD_BALLS:
                    fDamage = fDamage + 0.025;
                break;
                case GOOD_GRAPES:
                    fDamage = fDamage + 0.0;
                break;
                case GOOD_KNIPPELS:
                    fDamage = fDamage + 0.1;
                break;
                case GOOD_BOMBS:
                    fDamage = fDamage + 0.025;
                break;
            }
        break;

Granted, in real life a lucky shot could quickly demast a vessel without a doubt.

However, if you get into a large naval battle with non-realistic damage and/or very high levels of difficulty levels (enemy captains with high skills and ability to shoot at extreme distances), the frequency of demasting with the original file values can just keep getting worse until the whole screen can go black with graphical anomalies, so although this does not completely solve the problem, the above code does reduce the anomalies that occur, but not disable the function, and just make it bit more difficult to demast a ship.

The primary reason this happens is due to the way the Storm Engine handles the demasting graphics procedure between the masts/sails (which are separated gm/texture files) and are combined into the sinking masts into the ocean as a single sail/mast model which "hang around".

These bugs have never been completely eliminated, but were improved in the Storm Engine 2.8+ in POTEHO.
Flag artifacting anomalies are linked the same problem, as they are normally tied to the masts.
Flag anomalies can be corrected by relocating the flags on ship models to a different locator point on the model, but that requires fixing every ship that exhibits the problem and removes what sometimes would be the correct flag location for the ship in the first place.
CTD and general crashes are usually linked to improper mast gm models that were never fully separated from the ship model itself or have some locator issues.
The good news is many gm models have been updated since GOF 1.2, and most of these CTD have been mostly eliminated.

The word of caution here is to be careful about just adding ship models from POTC, AoP:CT, CoAS, or POTEHO into another game directly without full testing the ship IN GAME. The results are not always clear cut, and results can vary.
 
Last edited:
Back
Top