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

issue with boarding: current role of luck

Tingyun

Corsair
Storm Modder
While poking around LAi_boarding, I discovered something: luck plays a significant role in boarding results.

Luck is used (not grappling) to determine the effects of the musket volley perk, for both player and ai.

Player Luck has an equal role to grappling in determining surrender chances. Both are added together and then multiplied by another term, so a low luck high grappling score means that morale/surrender mechanic will operate as if they had only a middling ability.

It seems odd to have such a huge role. Also, my understanding is moving to a less magical luck is a long term goal?

Also, making musket volleys dependant on luck really messes with AI importances defined in officer types--officers like the pirate captain who should be good at musket volleys become worse at using them, because they define luck importance to 0.


PROPOSAL:

EDIT: see my revised proposal and attached file at end of thread
 
Last edited:
One further note: Luck has a very good effect in determining the quality of loot the player gets. I don't think it needs a boarding effect to remain relevant.
 
It seems odd to have such a huge role. Also, my understanding is moving to a less magical luck is a long term goal?
Technically we never did take an "official decision", but it does make sense as far as I'm concerned.
So I support all changes to make more sensible use of skills and use Luck only where players might be able to actually influence their own Luck.

Also, I'm inclined to say ideally only a single skill should contribute to a single effect.
So if it is currently Luck and Grappling, simplify it to make it only Grappling.
Using multiple different skills just makes the logic very fuzzy so that players don't stand a chance of ever figuring out what does what. :facepalm
 
Surrender chance seems to be a mix of Grappling, Luck, Leadership and Fencing, which is fair enough. I'd leave that alone.

Musket volley kills are currently base on your Luck skill and the target's ship defence perks. Those tend to be used by the surgeon and possibly carpenter, so those are the officers you'll need on the enemy ship to resist your musket attack. Perhaps factor in the Defence skill as well, since its purpose is to reduce crew casualties during the battle. As for the attack, I'd imagine it's based on Luck precisely because all your officers are busy elsewhere and the shots are being fired by random crew somewhere up the masts - not exactly the most stable platform, plus muskets weren't all that accurate, so good luck hitting anything! Perhaps factor in Accuracy as well, so that the cannoneer can indeed contribute with the swivel guns.
 
edit: cleaning up my rambling posts filled with half-baked ideas, see end of thread for revised proposal and file. ;)
 
Last edited:
As for the attack, I'd imagine it's based on Luck precisely because all your officers are busy elsewhere and the shots are being fired by random crew somewhere up the masts - not exactly the most stable platform, plus muskets weren't all that accurate, so good luck hitting anything!
If that is the reasoning, my personal preference would be to replace it with real random chance, e.g. just roll a random number between 1 and 10 instead.
 
EDIT: taking another look at this in response to grey roger's post...
 
Last edited:
For surrender, if you simply double the effect of Grappling then you're going to get a higher value overall. Maybe make it 4/3 Grappling + 2/3 Sneak, so that if both skills are equal then you'll end up with the same number as if it had just been Grappling + Sneak, only now Grappling is contributing twice as much as Sneak to that total.

The idea of making the number of musket kills purely random has some merit - none of your officers have much effect on the result and you don't either. Unless, that is, you or your boatswain are the ones who have been training the snipers during long periods at sea when nothing is happening, in which case your Leadership and Fencing skills would play a role - Fencing is also your skill in personal firearms, including muskets, while Leadership affects how well you've been passing on that skill to the crew. Add in an Accuracy factor so the cannoneer has some effect with the swivel guns.

Or, if it's all about skill, then concentrate on the swivel guns - Cannons to determine who shoots first, Accuracy for kills, as that's also how the larger calibre guns work for ship combat.
 
The problem is then accuracy has NO role in determining kills. It only determines speed. Shouldn't accuracy contribute some amount to kills? I get that the deck is moving, but it isn't completely random, a better shot is a better shot.
I think for musket shots, it makes a lot of sense to use Accuracy.
 
Ok, took another look, I had missed a part. Here is how it works currently.

Leadership and accuracy difference with enemy ship both do influence who shoots first AND kill ratio (I was mistaken on that, and grey roger is certainly right leadership should play a role)
float delta = makefloat((leadership0 - leadership1) + (accuracy0 - accuracy1)) / (4.0 * SKILL_MAX);
Then luck effects the result.
float fLuck = 0.5 * GetShipSkill(chr1, SKILL_SNEAK) / SKILL_MAX;
and modified by target defense and defensive perks:
int musketkills = makeint(0.25*ecrew * (1.0+delta+fLuck-fShipDefense-fCharDefence)+0.5);

So accuracy and leadership have a strong role. I think there the most relevant skill we are missing is grappling. The bosun, a grappling specilist, is the only officer who gets musket volley perk, so clearly he is in charge of it. And grappling should logically determine how well he lines up and manages the boarding action to take advantage of the musket volley and deliver maximum effect.

EDIT: correcting where I quoted a half edited version to replace luck with leadership when I was trying to implement grey roger's leadership suggestion before realizing leadership would then be too strong, now quoting the orignal ;)
 
Last edited:
Ok, here is an edited version.

I did nothing but sub in a new skillname for an old skillname in three places, and rename the fLuck to fGrap reflecting new role. Mainly, because this guarantees I can't mess up balance by accidentally changing too much or doing something wrong. ;)

If someone wants to introduce random effects or something more complicated, I have no opposition to random effects at all, I'm just limiting myself to things that can't mess things up as the simplest initial solution. I would find it cleaner if we kept luck out of it, and made it random--luck has enough effects elsewhere, and it make it easier if we want to long-term move away from magical luck later, we won't have to edit the same file.

I doubled effect of grappling by counting it twice, once in place of luck. I think that grappling SHOULD have twice the effect of other skills in determining the ability to effectivelly board enemy vessels and force surrender, no? Presumably you plan your attacks better by deck and organize things better to force surrenders. Twice the influence seems right, and presuming luck and grappling roughly equal (grappling from bosun, luck from doctor), it should work out similar in balance. If we think that grappling gets much higher than luck regularly, we could change it to 5/3 times grappling and no luck influence, but I'll leave that to others to decide if needed.

Code:
    defeat = makeint((rand(makeint(GetShipSkill(mchr,SKILL_GRAPPLING)+GetShipSkill(mchr,SKILL_GRAPPLING)))+rand(9)+1)*((GetShipSkill(mchr,SKILL_LEADERSHIP)+CalcCharacterSkill(mchr,SKILL_FENCING))/2)); // NK TY edited to make grappling have principal role, luck removed

fLuck to fGrap, skill changed to grappling, comment added to explain. Basically, leadership and accuracy already have a pretty good effect, and grappling should have some influence in terms of positioning the ships and timing the musket volley, after all Bosun is the one that gets musket volley perk
Code:
float fGrap = 0.5 * GetShipSkill(chr1, SKILL_GRAPPLING) / SKILL_MAX;           //TY subbing in grapplng for luck, influence of better managing the boarding and ship position to ensure maximum effect musket volley, after all bosun is in charge of this perk
        float fShipDefense = 0.0;
        if (GetOfficersPerkUsing(chr2, "BasicBattleState"))        fShipDefense = 0.15;
        if (GetOfficersPerkUsing(chr2, "AdvancedBattleState"))     fShipDefense = 0.25;
        if (GetOfficersPerkUsing(chr2, "ShipDefenceProfessional")) fShipDefense = 0.40;
        float fCharDefence = makefloat(GetShipSkill(chr2, SKILL_DEFENCE)) / SKILL_MAX;

        int musketkills = makeint(0.25*ecrew * (1.0+delta+fGrap-fShipDefense-fCharDefence)+0.5);
        if (musketkills < 0) musketkills = 0;    // just in case

        // SDLogIt("Musket Fire - delta=" + f2s2(delta) + " sneak=" + fGrap + " ShipDef=" + fShipDefense + " CharDef= " + fCharDefence);

I then subbed grappling with luck for this check

Code:
        if (losing < GetShipSkill(&mchr,SKILL_GRAPPLING)) losing = GetShipSkill(&mchr,SKILL_GRAPPLING); // NK skill // Defence against weird negative value TY change to grappling

I then used winmerge to confirm these are the only changes to the file, otherwise perfectly in sync with the just uploaded commenting out of soldier weapons and grappling reduction for surrender.

How does this look? It removes luck and restores grappling to a more prominent role in these mechanics than other skills, and ensures the officer in charge of musket volleys, the bosun, actually contributes some skill to their success.

File attached, for either considering as is or for someone to program a random effect if they think it needs it, or whatever else is desired. Or maybe the simple solution would work.
 
Last edited:
As a final note, just want to reiterate that luck should NOT effect musket volleys, if for no other reason than that part of the code is used by AI Captains as well and our current AI captain officer types skill importances are set up in the officertypes file such that many captains (like Pirate captain) have 0 luck importance. In effect retaining a role for luck here (just speaking about the musket volley part for a moment) would be the same as weakening the pirate captain ability to shoot muskets upon boarding. Which isn't what we want, so luck especially needs to be replaced here.

EDIT: The navy captain has 0 importance in both grappling and boarding, but he can't currently get musket volley in the base mod anyway. Presumably though, once Levis implements AI officers, navy captains will get good bosuns with musket volley at high levels, but they might not have a great luck score always with limited officer slots, so changing this to grappling will work best for both navy and pirate captains long term.
 
Last edited:
Updated by merging with Levis's latest patch changes. Merged version attached, Submitting to new content.

Although someone might want to consider improving the code further in the future (possibly with more random effects, as discussed), the current changes detailed above are a good improvement for now, and should allow the AI captains like the pirate captain to function better in their intended roles without having to mess with their skill importances, while restoring grappling to its rightful prominence in regard to boarding.
 
Last edited:
@Levis uploading a new version that I think is merged with some recent fixes you put out, should make it easier for you to merge this version.
 

Attachments

  • LAi_boarding.c
    93.3 KB · Views: 113
Back
Top