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

Solved Rebalancing the Fighting System

Well now, here is an idea.

I was suggesting that you play a game long enough to get to the higher levels where it is fun. I just grind through the first 15 levels as quickly as possible.

So from what Hylie writes in the other thread I understand that melee combat works much better at higher levels and with better equip.
This fits perfectly to my impression, that at least in the early 15-20 levels, defencive abilities of player characters are not equal to the offense of the enemies.
So, what would be about a factor - sort of multiplier - that boosts up player characters defebsive abilities.
I am thinking of something that starts at level 1 with *2 and slowly decreases to *1 (which would not change a bit) at about level 20.
Effectively giving low level characters a buff to survival, that wears off as they close to the levels where melee works fine.
 
That would go in the right direction, though I don't know if defence is the best way to do so.
Basically, I'd like to change the ratio between "damage done and received" and "hitpoints available".
We could experiment with just increasing the HP per level values then?

I think hitpoint hace not been much changed since the original game, and damage of weapons too.
Now look - 65 hp early, a simple weapon dealing about 10-15 damage. That would mean 4-5 hits to cut one down.
Now we have shoot - slash - dead.
Actually, both were completely redone.

About possible solutions instead of just venting............Do we all agree that combat was ruined in patch 6? That is my opinion.
Build 14 Beta 1 Patch 6, you mean? I wouldn't know; I hardly ever play and when I do, it is for testing purposes, usually with the Godmode on.
Most relevant files:
PROGRAM\Loc_ai\LAi_fightparams.c for the actual damage being applied and experience gained
PROGRAM\Loc_ai\LAi_CreateOfficer.c for HP calculation. Defines in PROGRAM\InternalSettings.h:
Code:
#define CHAR_HITPOINTS_PER_LEVEL        10        // INT - The amount of hitpoints which is added to a character's maximum hitpoints on each level up
#define CHAR_START_HITPOINTS            40        // INT - The amount of hitpoints any character starts with at level 1
PROGRAM\ITEMS\initItems.c for weapon stats
PROGRAM\MAXIMUS_Functions.c for additional Auto Skill System modifiers

I don't see anything in the changelog directly relating to any of the above. However, these would require changes to LAi_fightpararms.c:
Code:
  . Fists piercing value decreased to prevent them from being too strong by Baste
  . Fists damage calculation redone to prevent them from being too strong by Baste
There are also:
Code:
Build 14 Alpha 9.5:
- Improvements to Auto Skill System by Hook
- Improvements to pierce/block calculations by Hook
 
Build 14 Alpha 9 Patch 3:
- Rewritten and improved system for blockdamage, now taking into account pierce and block values properly by Hook
So, what would be about a factor - sort of multiplier - that boosts up player characters defebsive abilities.
I am thinking of something that starts at level 1 with *2 and slowly decreases to *1 (which would not change a bit) at about level 20.
Effectively giving low level characters a buff to survival, that wears off as they close to the levels where melee works fine.
That might work. Sounds like a bit of an inverted Auto Skill Mod though, doesn't it?
Other idea: What if the effect of Defence is not a linear progression, but has a square root in there?
squareroot.gif

That way, the effect increases more in the early game? But I think such an effect is in place somewhere already?
 
Cheers,

We could experiment with just increasing the HP per level values then?
I think the increase is not so bad, since both Hylie and Lasagnettie tell that melee is balanced at higher levels. We do have a problem at the start. Thus, a bigger bonus at start might have more effect.
I still think about the pure ratio of "damage inflicted" to "maximum hitpoints". It is about the same size, and this results in this one- and two-hitting.
Another approach would be to make the whole system less dependant on randoms. Actually it looks like this:
- will the target block in time (player skill based)
But then, with the player doing the right thing, still he can die by random effects:
- block can be ineffective because it is pierced
- armor can be surpassed because it is not meant for complete protection
So you only have a small impact of player skill, and a huge impact of random effects.
I guess, later in the game, with high values of defence, much more hitpoints, and much better armor these random effects become smaller in relation to character skills and characters equipment.
But early on, they are deadly.

Oh, and I don't thin is basic weapon damage that is the problem. That duelist in the french fry game uses a common rapier,w hich is not an impressive weapon at all, but even he managed to cut me down with two blows. It's not in the weapon stats, but in the calculation itself.


That might work. Sounds like a bit of an inverted Auto Skill Mod though, doesn't it?
Errm ... yes. My idea was to give an initial boost at the beginning, that wears off later, to not spoil the game experience for those who often play in the high levels.

Other idea: What if the effect of Defence is not a linear progression, but has a square root in there?
squareroot.gif

That way, the effect increases more in the early game? But I think such an effect is in place somewhere already?

You still would need a way to quickly increase defence to take any profit from it.
And defence increases not so fast, only 1% per hit, in melee.
 
The first thought I had this morning was about armor. The base armor doesn't do much and gives -1 to melee. The battle armor does a little more and gives -1 to melee. The Golden Cuirass does not give -1 to melee.
I got into a 1 on 1 fight at level 14 last night with a surrendered Captain. I was wearing the battle curiass. Four times we fought and four times he was faster than me and killed me. My HP was 189 methinks and his was 257 after my first strike, so he probably started out at 270 or so. I finally killed him by using the poisoned throwing knife and running like hell for a while. When I finally stopped and fought him he still almost killed me in a weakened condition.
My point? Speed kills. He killed me because he was faster. How about making the battle curiass neutral?

I will get those files together later and look at them, but that stuff is Chinese to me.
 
It used to be that only the base armor was -1 Fencing. We can easily reinstate that, yes.
 
It used to be that only the base armor was -1 Fencing. We can easily reinstate that, yes.
Hm, after catching up a bit on this thread, maybe it would actually be better to not reduce the -1 to melee, but rather put an additional +1 defense onto armor?

I think the increase is not so bad, since both Hylie and Lasagnettie tell that melee is balanced at higher levels. We do have a problem at the start. Thus, a bigger bonus at start might have more effect.
I still think about the pure ratio of "damage inflicted" to "maximum hitpoints". It is about the same size, and this results in this one- and two-hitting.
Errm ... yes. My idea was to give an initial boost at the beginning, that wears off later, to not spoil the game experience for those who often play in the high levels.
I actually like the idea of having a boost to melee/defense in early levels while at the same time making swordfighting at higher levels (15-20) a bit harder, your suggestion I think could do that. I find the game very, very easy once you've hit 20, and I'm always on hardest difficulty. And that's not restricted to swordfight, so maybe this curve could be a good option for all skills?
 
With my new gane started, I noticed something interesting.

I went early into the Jamaica dungeon to grab some melee and defence skills.
- journeyman, lv 3, excellent cutlass and no armor
I did suprisingly well against the bad guys. This time, other than in Speightstown dungeon, it was almost always only one at a time. Perhaps I just get more used to it.
Some guys seem to be a lot tougher than others, they attack much faster. How does this quickness come from? Is this from superior melee skill? These were the ones that usually killed me. Though, there is a solution after reloading the game ... I shot them :guns:
 
I dumped that useless armor with the -1 melee. All it does is slow me down and speed is more important than the small protection it provides.
 
Just did the same dungeon at adventurer level, without dying. May it just be a matter of practice?
:duel:
 
In fact, I'm just getting used to it. Blocking is much faster if all is done with one hand, so to say. I just miss running around with mose buttons pressed, I am very used to that (do that in almost any other game I am watching my character from behind).
But fencing is better.
But before I'm getting too enthusiastic, the Jamaica dungeon is very easy. Exept 4 guys at the very beginning, it's always one bad guy at the time.
 
Very well. I just finished that Jamaica dungeon in swashbuckler mode. There were 2 guys who killed me, and whom I was unable to defeat without god mode. These two passed through my block twice in a row, killing me with the 2nd hit.

But besides that, I am greatly surprised that I did it.
 
I agree it makes sense. But it does murder on my hand; and the heavy modding I've been doing is already taking care of that.
We're still doing it as Default for the next release though. I can change it back to where it came from afterwards. :cheeky

BTW: I'll not be very active tomorrow. Hopefully you'll be able to come up with some things we can test out for this issue.
If possible, I'd like to sort it out before Beta 2.5. But as far as I can tell, I've run out of other things to do before the release.
Other things that quite need doing, I mean. :facepalm
 
Very well. I just finished that Jamaica dungeon in swashbuckler mode. There were 2 guys who killed me, and whom I was unable to defeat without god mode. These two passed through my block twice in a row, killing me with the 2nd hit.

But besides that, I am greatly surprised that I did it.


You inspired me to go down there too, except that I took along 3 officers with good skills and all equipped with French Admiralty rapiers and the golden cuirass. I had the golden cuirass and the Knights Templar sword. All excellent of course.
The 1st time down I lost an officer on the ramp and then the others refused to go further, so I continued on alone but didn't last long. The 2nd time went much better as I was able to muscle to the front and help out. Didn't lose one and cleaned the place out using 2 different pistols, grenades, stinkpot, and poisoned throwing knife. It was closer than it sounds as I almost lost an officer twice and I almost died twice.

This is the same layout as the Maltese Abbey in Bridgetown.
 
It's quite peculiar that you find that the Defense skill lowers damage taken in melee combat, because the Defense skill is not used in any melee damage calculation. :shrug

The only skills used in melee damage calculations are Melee and Luck.

From LAi_fightparams:
Code:
float LAi_BladeApplySkills(aref attack, aref enemy, float dmg)
{
    //Ó÷èòûâàåì ñêèëû
    float aSkill = LAi_GetCharacterFightLevel(attack);
    float eSkill = LAi_GetCharacterFightLevel(enemy);
    if(aSkill >= eSkill)
    {
        dmg = dmg*(1.0 + 2.0*(aSkill - eSkill));
    }else{
        dmg = dmg*(1.0 + 0.5*(aSkill - eSkill));
    }
    // NK -->
    dmg *= (0.75 + fRand(GetSummonSkill(attack, SKILL_SNEAK))/(40.0/3.0));
    dmg *= (1.5 - fRand(GetSummonSkill(enemy, SKILL_SNEAK))/(40.0/3.0));
    float piercing = 0.05;
    float block = 0.01;
    if(CheckAttribute(attack, "chr_ai.piercing"))
    {
        piercing = stf(attack.chr_ai.piercing);
    }
    if(CheckAttribute(enemy, "chr_ai.block"))
    {
        block = stf(enemy.chr_ai.block);
    }
    if(piercing > block*2 && piercing > 0.1) dmg *= (1.0 + fRand(piercing)/2.0);
    if(sti(attack.index) == GetMainCharacterIndex()) dmg *= (1.45 - 0.15*GetDifficulty()); // NK Diff Mod
    else { if(sti(enemy.index) == GetMainCharacterIndex()) { dmg *= (0.85 + 0.15*GetDifficulty()); } } // NK Diff Mod
    // NK <--
    return dmg;
}
Here we see that "FightLevel" and Luck ("Sneak" is Luck in the code) are used. FightLevel is defined in LAi_utils:
Code:
float LAi_GetCharacterFightLevel(aref character)
{
    //Fencing skill
    float fgtlevel = 0.0;
    if(isBoardingLoading == false)
    {
        if(CheckAttribute(character, "skill.Fencing") != 0)
        {
            fgtlevel = makefloat(GetCharacterSkill(character,SKILL_FENCING)); // NK
        }
    }else{
        fgtlevel = GetSummonSkillFromName(character, SKILL_FENCING);
    }
    //Level
    if(fgtlevel < 0.0) fgtlevel = 0.0;
    if(fgtlevel > SKILL_MAX) fgtlevel = SKILL_MAX;
    fgtlevel = fgtlevel/SKILL_MAX;
    return fgtlevel;
}
Here we see that FightLevel is the character's Melee skill divided by the maximum skill value, which is 10.
Probability for piercing and blocking, again from LAi_fightparams:
Code:
float LAi_BladeFindPiercingProbability(aref attack, aref enemy, float hitDmg)
{
    float piercing = 0.05;
    float block = 0.01;
    if(CheckAttribute(attack, "chr_ai.piercing"))
    {
        piercing = stf(attack.chr_ai.piercing);            // 0..1 from blade stats
    }
    if(CheckAttribute(enemy, "chr_ai.block"))
    {
        block = stf(enemy.chr_ai.block);                // 0..1 from blade stats
    }
    float aSkill = LAi_GetCharacterFightLevel(attack);    // fencing skill / 10
    float eSkill = LAi_GetCharacterFightLevel(enemy);
 
    // LDH change to ratios - 11Apr09
//    if(aSkill < eSkill) aSkill = eSkill;                // NK had removed this and set p to minimum of 0
//    float p = piercing - block + (aSkill - eSkill)*0.5;    // original calculation
    float origP = piercing - block + (floatret(aSkill<eSkill, eSkill, aSkill) - eSkill)*0.5;    // LDH for testing 12Apr09
    if (origP < 0.0) origP = 0.0;
 
//    if (block == 0) block = 0.01;
//    if (eSkill == 0) eSkill = 0.1;
//    float p = sqrt(piercing/block * sqrt(aSkill/eSkill));            // pierce to block ratio * half skill ratio
 
    // LDH - 01May09
    float p = (1.0 + piercing - block)^10 * (1 + askill - eskill);
 
    float k = 1.0;
    if (p > 0)                                            // LDH added test 06Apr09
    {
        if(IsCharacterPerkOn(enemy, "BasicDefense")) k = 0.75;
        if(IsCharacterPerkOn(enemy, "AdvancedDefense")) k = 0.5;
    }
    hitDmg = hitDmg*0.5 + 0.5;                            // hitDmg is a small number, so this is 0.5 to 0.52 typically, can be higher
 
//float retVal = p*k*hitDmg*hitDmg*100;  if (retVal > 100.0) retVal = 100.0;
//float retValOrig = origP*k*hitDmg*hitDmg*100;
//TraceAndLog("p=" + makeint(piercing*100) + ", " + stringRet(piercing<0.1," ","") +
//    "b=" + makeint(block*100) + ", " + stringRet(block<0.1," ","") +
//    "aSkill=" + makeint(aSkill*10) + ", " + stringRet(aSkill<1," ","") +
//    "eSkill=" + makeint(eSkill*10) + ", " + stringRet(eSkill<1," ","") +
//    "p=" + strLeft(f2s2(p*100),6) + ", " +
//    "k=" + k + ", " + stringRet(k==1.0,"  ","") + stringRet(k==0.5," ","") +
//    "hitDmg=" + strLeft(f2s2(hitDmg*hitDmg),6) + ", " +
//    "return=" + strLeft(stringRet(retVal<10," ","") + f2s2(retVal),5) + ", " +
//    "orig=" + stringRet(retValOrig==0,"",strLeft(f2s2(retValOrig),6)));
 
    p = p*k*hitDmg*hitDmg;
    if (p>1.0) p = 1.0;
    return p;
}
The only thing referring to skills here is FightLevel, which we saw that the only skill it uses is the Melee skill.
The Defense skill is only used in ship damage calculations. From AIShip:
Code:
void Ship_ApplyCrewHitpoints(ref rOurCharacter, float fCrewHP)
{
    // KK if(!CheckAttribute(rOurCharacter,"seatime.basecrewquantity")) rOurCharacter.ship.crew.quantity; // NK need to check 05-04-09
    rOurCharacter.seatime.lasthit = GetSeaTime(); // NK 04-09-16, to set time when last hit
    if(!CheckAttribute(rOurCharacter,"seatime.lastcrew")) rOurCharacter.seatime.lastcrew = rOurCharacter.ship.crew.quantity; // ditto, to set what crew was before loss
    //ref rBaseShip = GetShipByType(GetCharacterShipType(&rOurCharacter));
    float fMultiply;
    float fskillDefence = stf(rOurCharacter.TmpSkill.Defence); // KK
    int iskillDefence = GetCharacterSkill(rOurCharacter, "Defence"); // PB
    if (USE_REAL_CANNONS)
        fMultiply = Bring2Range(1.0, 0.5, 0.0, 1.0, fskillDefence); // KNB was from 1.0x to 0.2x damage
    else
        fMultiply = Bring2Range(1.0, 0.2, 0.0, 1.0, fskillDefence);
//NK -->
    //aref arship; makearef(arship, rOurCharacter.ship); // PRS3
    fMultiply *= (0.25 * (stf(rOurCharacter.Ship.Crew.Quantity) / makefloat(GetMinCrewQuantity(rOurCharacter)))); // PRS3
// NK <--
    int casualties = makeint(fCrewHP * fMultiply); // PB
    float fNewCrewQuantity = stf(rOurCharacter.Ship.Crew.Quantity) - casualties;
    float f5Percent = makefloat(GetMinCrewQuantity(rOurCharacter)) * 0.05; // PRS3
    if (fNewCrewQuantity < f5Percent) fNewCrewQuantity = f5Percent;
    if (fNewCrewQuantity < 1.0) fNewCrewQuantity = 1.0;
// KK & PB -->
    if (IsMainCharacter(rOurCharacter) || IsCompanion(rOurCharacter)) {
        int wounded = casualties - randnorm(casualties, iskillDefence);
        if (wounded > casualties) wounded = casualties;
        if (wounded > 0) AddCharacterWoundedCrew(rOurCharacter, wounded);
        else wounded = 0;
        int killed_wounded;
        if (rand( 3*iskillDefence ) == 1)
        {
            killed_wounded = 1;
            RemoveCharacterWoundedCrew(rOurCharacter, 1);
        }
        else killed_wounded = 0;
trace("Ship_ApplyCrewHitpoints: casualties="+casualties+", iskillDefence="+iskillDefence +", wounded="+wounded +", killed_wounded="+killed_wounded);
    }
    SetCrewQuantity(rOurCharacter, fNewCrewQuantity);
// <-- KK & PB
}
So, as we can see, the Defense skill really isn't used in any melee damage calculation, only the Melee and Luck skills. :shrug

I searched for "ch.skill.Defence" and "SKILL_DEFENCE" but couldn't find any instance where the Defense skill is used for melee calculations. If I did indeed miss anything, please show me where the Defense skill is used for melee.

But! Note this part in the first code snippet:
Code:
if(sti(attack.index) == GetMainCharacterIndex()) dmg *= (1.45 - 0.15*GetDifficulty()); // NK Diff Mod
    else { if(sti(enemy.index) == GetMainCharacterIndex()) { dmg *= (0.85 + 0.15*GetDifficulty()); } } // NK Diff Mod
Not only are Melee and Luck used for melee damage calculations, but difficulty as well. The higher the difficulty, you do less damage to enemies and they do more damage to you. This could be part of the reason why combat is hard.

Difficulty also affects the level, skills, and HP of enemies so with higher difficulty the enemies will be stronger than you with higher level, higher skills, higher HP, and so on. This could also contribute to combat being hard. As far as I understand, this is handled in LAi_CreateOfficer. Too much to quote from that file, but it's in there.

About some enemies attacking faster than other enemies, I believe this is handled under "NPC parameters" in LAi_fightparams. It also seems to handle how much they block and fire. Again FightLevel (and thus the Melee skill) and difficulty are used.

About blocking being changed so that it is not always working, what does that mean? Blocking does not always work as it is in the stock game. It is possible for blocks to be pierced depending on weapons used, the contenders' Melee skill, and which abilities they have.
 
So Defence isn't included in fencing at all? I thought it was. But since you studied the matter much more thoroughly than me, you are probably right. :cheeky

I'm thinking perhaps playing on lower difficulties isn't such a bad idea. Up the challenge by enabling all realism settings and salary modifiers and such instead. :wp
 
When you block with your sword you get a defense skill increase. This is an observed fact. While I was in the Jamaica Dungeon my defense skill picked up 19% while melee did not pick up a single point.
The block was changed. Before you were safe as long as you held your block so you could take health medicines. Now it only works for a short time and only in front of you and it can be pierced as you say.
 
When you block with your sword you get a defense skill increase. This is an observed fact. While I was in the Jamaica Dungeon my defense skill picked up 19% while melee did not pick up a single point.
That is correct, and as Pieter said this seems to be handled in LAi_fightparams. However, the Defense skill doesn't lower damage taken in melee.

The reason for why blocking increases the Defense skill might be because there might not be any other appropriate way to increase it. Since it is only used for ship damage the only other way I can think of is to get hit in ship combat, but that might not be an appropriate way to increase it.

If I understand everything correctly, I have a little idea that might help with the Melee skill increasing faster. Please try this file and see if Melee increases faster. If I'm right, Melee should increase faster while Defense should increase not as fast. The file goes in the PROGRAM folder. I'm not sure if a new game is required, but it might be best to test it with a new game to be sure the file is initialized properly.

The block was changed. Before you were safe as long as you held your block so you could take health medicines. Now it only works for a short time and only in front of you and it can be pierced as you say.
Then I understand. In the stock game you aren't really safe as your blocks can still be pierced, but you can indeed get hit from behind while blocking without taking damage.
 

Attachments

  • MAXIMUS_Functions.c
    209.8 KB · Views: 121
Back
Top