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

Musket fire - luck or grappling skill?

Should musket fire depend on the "Luck" or "Grappling" skill?

  • Luck

    Votes: 0 0.0%
  • Grappling

    Votes: 7 100.0%

  • Total voters
    7

Grey Roger

Sea Dog
Staff member
Administrator
Storm Modder
One thing I found in @Levis' stuff was a change in "LAi_boarding.c" to the way casualties from musket fire at the start of a boarding are calculated. At present there's a modifier for the attacker's "Luck" skill. This version replaces it with the same size modifier, but based on "Grappling" instead.

There are arguments both ways. Muskets were not accurate, so it could be a matter of luck whether the musketeer hits anything. Or the placing of the musketeers could be dependent on the captain's or boatswain's experience in boarding actions.

In terms of balance, it could also go either way. Personally I find "Grappling" goes up much quicker than "Luck", partly because I do a lot of boarding and partly because I have "ITEM_REALISM" in "InternalSettings.h" set on, so I don't get "Luck" boosts from gems or Indian trinkets. So switching musket fire to "Grappling" will make it more effective for me. Other people might play differently, especially since "ITEM_REALISM" is set off by default.

So, any thoughts from anyone else? Switch musket fire to depend on "Grappling", or leave it depending on "Luck"?
 
If possible, I'd like it if it were clear which skills influence which parts of the game.
I recall this being really quite fuzzy and I suspect that is still the case now.
Based on that, my first thought would be to link it to Grappling instead so that boarding-stuff relates to boarding-stuff.
 
Either grappling, or accuracy, as @fjx said.

Because, even though muskets where not accurate, skill could still help to aim at targets. :pirate41:
 
"Accuracy" - and "Leadership", for that matter - is already figured in:
Code:
   int leadership0 = GetShipSkill(mchr, SKILL_LEADERSHIP);
   int leadership1 = GetShipSkill(echr, SKILL_LEADERSHIP);
   int accuracy0 = GetShipSkill(mchr, SKILL_ACCURACY);
   int accuracy1 = GetShipSkill(echr, SKILL_ACCURACY);
   float delta = makefloat((leadership0 - leadership1) + (accuracy0 - accuracy1)) / (4.0 * MAX_CHARACTER_SKILL);
The calculation for casualties is:
Code:
int musketkills = makeint(0.25*ecrew * (1.0+delta+fLuck-fShipDefense-fCharDefence)+0.5);
'fLuck' is a fraction of the attacker's "Luck" skill, to be replaced by 'fGrap' which is the same fraction of the "Grappling" skill. 'fShipDefense' is dependent on the defender's "First Aid" abilities. 'fCharDefence' is a fraction of the defender's "Defence" skill. (Yes, "Defense/Defence" is spelt differently in the two, consistently throughout the musket fire code. :))

Personally I'm not sure why "Accuracy" should be a factor, for the same reason I agree that it should be "Grappling" rather than "Luck". Accuracy and luck might be involved but it would be the musketeers' accuracy and luck. The player and officers probably aren't the ones up in the mast firing muskets; they're on deck commanding the ship or leading the boarding. The only influence they'd have would be preparing the musketeers before the boarding, and that would be down to "Grappling". But I don't intend to rewrite the whole musket fire system to get rid of "Accuracy"!

Though perhaps put a random factor into the calculation for 'musketkills' so that it's not totally deterministic, and to account for the musketeers' luck. Replace that 0.5 on the end of the calculation with 'FRAND(1.0)', or possibly 'FRAND(0.5) + 0.25' to make it not quite as random.
 
That's a lot of variables to keep track of!

My personal thought would be to simplify it and have it depend only on accuracy (for example) and get rid of everything else.

"Luck" was renamed to "Sneak" a long time ago and I think it makes sense to work towards it mainly factoring into sneaky situations.
Actual luck is not a skill that exists, so I reckon that should be factored in as a purely random element.
 
The variables are already being tracked so it's not too much effort to leave them that way. As I said, I don't plan to rewrite the whole musket system - just adopt the change from 'fLuck' to 'fGrap' and randomise the final 0.5, so that the calculation looks like this:
Code:
int musketkills = makeint(0.25*ecrew * (1.0+delta+fGrap-fShipDefense-fCharDefence)+FRAND(0.5) + 0.25);

Restricting "Sneak" to sneaking would make sense if there were any significant sneaking to do. You can walk, you can run, but you can't creep on tiptoe to sneak up on someone or sneak past a guard. Disguise is almost unheard of, the game generally doesn't care which outfit you use, so you can walk through Antigua naval base in French uniform and nobody will care. xD (Do patrolling soldiers take any notice of the "Sneak" skill when deciding whether to talk to you, or do they just follow the same rules as random civilians who might talk to you rather than wait for you to talk to them? And does anyone other than me enforce disguises in any quests?)
 
The variables are already being tracked so it's not too much effort to leave them that way.
I was thinking more that it looks needlessly complicated, which means that the players will not understand.
So whatever skill is actually used doesn't matter much, because for the players it will feel pretty random.
Or they'll notice things get better as skills increase across the board; but they won't be able to pin-point what affects what.

Restricting "Sneak" to sneaking would make sense if there were any significant sneaking to do. You can walk, you can run, but you can't creep on tiptoe to sneak up on someone or sneak past a guard. Disguise is almost unheard of, the game generally doesn't care which outfit you use, so you can walk through Antigua naval base in French uniform and nobody will care. xD (Do patrolling soldiers take any notice of the "Sneak" skill when deciding whether to talk to you, or do they just follow the same rules as random civilians who might talk to you rather than wait for you to talk to them? And does anyone other than me enforce disguises in any quests?)
Not so much "sneaking" then, but general (semi-)illicit activities. Smuggling, gambling, using false flags, etc.
 
Players don't tend to look at the code anyway, and if they do, they'll understand. If they don't look at the code, maybe they'll guess that "Grappling" has something to do with musket fire, or maybe they'll guess that it's someone else doing the shooting so it is semi-random, which will be as of next update because I'm adding that random factor. Muskets weren't accurate. ;)

About the only thing linking smuggling, gambling and false flags is luck. The ability to dodge coastguard patrols has nothing to do with reading the face of the person on the other side of the cards table, nor with hoping the captain of that Spanish frigate doesn't know that your supposedly French sloop was captured by the British a few weeks ago.

Besides, apart from tweaking a couple of lines in "LAi_boarding.c", I don't plan on rewriting the skill use throughout the game, partly due to not wanting to break the game and partly due to having other things to work on... ;)
 
Last edited:
The randomisation needed to be rewritten:
Code:
int musketkills = makeint((0.25*ecrew * (1.0+delta+fGrap-fShipDefense-fCharDefence) + 0.5) * (FRAND(0.25)+FRAND(0.25)+0.75));
I then tested it by sailing to Nevis, saving game while out of range of any other ship, then auto-boarding a pirate schooner. This allowed me to repeatedly reload the savegame and board the same ship with a full crew, giving a consistent start to tests. Against a crew of 105, musket fire was killing 42 without randomisation and a reasonable spread with it. (Using 'FRAND(0.25)' twice rather than 'FRAND(0.5)' once gives a better distribution concentrated around the average rather than a linear distribution.)

That's fair enough given that I'm in a frigate with over 400 crew, but in general, all factors being equal, you can expect to kill at least 25% of the enemy crew. 'delta' is based on the difference between your "Leadership" plus "Accuracy" and his; 'fCharDefence' is his "Defence" skill divided by 10; 'fGrap' is your "Grappling" divided by 20. 'fShipDefense' is always 0 because it's a fixed percentage depending on whether the defending character has the "Basic First Aid" or "Advanced First Aid" abilities, only officers get those, NPC captains don't. So you're facing a ship the same size as yours with a captain whose skills (but not abilities) match yours, then at least 25% of your crew need to be musketeers to inflict those losses. Therefore perhaps we should reduce the base 25%?

Now consider an extreme case. Captain Jack Sparrow in the Jolly Mon meets Cutler Beckett in the Dauntless. Sparrow is awesome so give him 10 to all skills; Beckett is an idiot so give him 1 to all skills.
Sparrow's crew of 3 firing muskets: 'delta' is 0.45, 'fGrap' is 0.5, 'fCharDefence' is 0.1, so he kills 0.5875* Dauntless crew = 599. As the Jolly Mon only has 3 crew, they'd need a very rapid fire machinegun to do that!
Beckett's crew of 1020 firing muskets: 'delta' is -0.45, 'fGrap' is 0.05, 'fCharDefence' is 1, so he kills 0.025*Jolly Mon crew = 0. Even if half of Beckett's crew are still in nappies and don't know one end of a musket from the other, there should still be enough shots going into the Jolly Mon to leave its 3 crew looking like Swiss cheese!
Perhaps make the number of kills based on the size of the attacking crew rather than the defending crew?
 
That does indeed sounds like nonsensical balancing.
Good find!

Perhaps make the number of kills based on the size of the attacking crew rather than the defending crew?
Makes much more sense.
If more are killed than are on board, that's early checked against. :onya
 
Excess kills are already checked, though I'm not sure how they'd happen under the original system. :D

The current formula is now:
Code:
int musketkills = makeint((0.125*mcrew * (1.0+delta+fGrap-fShipDefense-fCharDefence) + 0.5) * (FRAND(0.25)+FRAND(0.25)+0.75));
I tried the same savegame and the same boarding with this system, and instead of killing an average of 42 out of 105 enemy crew, I'm now killing an average of 98. That's because, although the base factor is 0.125 instead of 0.25, it's now applied to my frigate's crew of 491 instead of the schooner's crew of 105, and the new system gives a bonus for "Grappling" (which for me is maxed to 10) instead of "Luck" (which isn't).

Perhaps 0.125 is still too high? It's unlikely that 1/8 of your crew is firing muskets, and anyway the bonuses for 'delta' and 'fGrap' (0.3 and 0.5 respectively in this battle) plus the fixed 1.0 bring it up to 0.2, i.e. 1/5. Even allowing that some of the "muskets" aren't muskets, they're swivel guns possibly firing grapeshot and hitting multiple targets, that's still rather a lot of your crew doing it.

Also, perhaps factor in cover based on the target ship's tier. Tiers 7 and 8 are luggers, sloops etc. with no cover, everyone is in the open and a potential target. Tiers 5 and 6 are brigs, small frigates and that schooner in the example, as well as pinnaces, in which at least some crew will be below deck and safe from muskets. Tiers 3 and 4 are most frigates and galleons with at least one fully covered gun deck providing safety for rather more crew. And tiers 1 and 2 are the big battlewagons with several fully covered decks.

Any comments?
 
Also, perhaps factor in cover based on the target ship's tier. Tiers 7 and 8 are luggers, sloops etc. with no cover, everyone is in the open and a potential target. Tiers 5 and 6 are brigs, small frigates and that schooner in the example, as well as pinnaces, in which at least some crew will be below deck and safe from muskets. Tiers 3 and 4 are most frigates and galleons with at least one fully covered gun deck providing safety for rather more crew. And tiers 1 and 2 are the big battlewagons with several fully covered decks.
That does sound like it makes sense to me. :onya
 
Here's the revised version of "PROGRAM\Loc_ai\LAi_boarding.c" in case anyone wants to test it.

Protection by ship tier is calculated thus:
Code:
   int eclass = GetCharacterShipClass(echr);
   float fProtected = 0.0;       // Fraction of enemy crew protected from musket fire due to being below decks
   if(eclass < 7) fProtected = 0.1;   // Tier 5 and 6 have a few gunners below deck
   if(eclass < 5) fProtected = 0.2;   // Tier 3 and 4 frigates have a full gun deck under cover
   if(eclass < 3) fProtected = 0.3;   // Tier 1 and 2 ships of the line have two or more gun decks under cover
Then the casualties are worked out:
Code:
      int musketkills = makeint((0.1*mcrew * (1.0+delta+fGrap-fShipDefense-fCharDefence) + 0.5) * (FRAND(0.25)+FRAND(0.25)+0.75));   // GR: random element added, muskets weren't accurate. Base multiplier 0.25 reduced because there weren't enough musketeers to do that much damage
//       int musketkills = makeint(0.25*ecrew * (1.0+delta+fGrap-fShipDefense-fCharDefence)+0.5);   // Original version used 'ecrew' and no randomisation, so a small ship attacking a big ship would cause more casualties than vice versa
       if (musketkills < 0) musketkills = 0;   // just in case
       if (musketkills > ecrew * (1.0-fProtected)) musketkills = ecrew * (1.0-fProtected);       // Muskets can't kill crew who are below deck
Using my test savegame, the frigate with 491 crew against a schooner with 105 crew, this resulted in 79 crew kills plus or minus randomisation. The schooner, being tier 5, doesn't get much protection, so there are more than 79 crew on the top deck available to be shot, meaning the deck protection code doesn't help them. The frigate is going to score the same number of musket kills regardless of target size, but anything big enough to get better protection from decks is also going to have a bigger crew - if my musketeers can see more than 79 enemy crew on the top deck, they're all potential targets regardless of how many more are below decks.
 

Attachments

  • LAi_boarding.c
    98.8 KB · Views: 218
I'll suggest another option:

Tie the effectiveness of musket salvos to the crew's skill (Greenhorn, seadogs, etc.). Grappling to me applies to the player character at how he's directing the boarding. And personally I would think that a bunch of noobs with muskets shouldn't be able to slaughter another crew in one salvo. On the other hand, seadogs can be expected to handle guns professionally and know where to aim, even though the bullets won't always hit due to the weapon's poor accuracy.
 
How do you suggest measuring the crew skill? "Seadog" is one of the game difficulty settings - presumably you don't mean that!

The 'delta' factor in the formula is based on the difference between the attacker's and defender's sums of their "Leadership" and "Accuracy" skills. This could reflect the training of the attacking musketeers, and the training of the defending crew in making best use of available cover on deck.

Otherwise, I'm open to suggestion.
 
Back
Top