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

Making land encounters more difficult

LarryHookins

Buccaneer
Staff member
Storm Modder
I've finally found out why encounters in towns are so easy. There's some code that generates the enemy character level at <b>one half</b> the player character level, and later this is cut by another third. In towns, the enemies you encounter will average 1/3 of your character level. Then there's the problem with those enemies having way too few hit points, maybe 2 points per level instead of the 10 you'd expect. No wonder the lowlifes you encounter in town are wimps.

I'm going to collect my posts and fixes for the problem in this thread so they'll be easier to find and discuss.

Hook
 
First off, here's my post copied verbatim about how to generate the right amount of hit points for enemy characters.

---------------

Here's a suggestion for making land fights a bit more balanced. Look in LAi_CreateOfficer.c near the bottom of the function LAi_Create_Officer for the line:

<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->mhp += intRet(officer, nRank * makeint(11-GetDifficulty()), nRank * makeint(pow(GetDifficulty()+1,1.35)));<!--c2--></div><!--ec2-->
and change it to
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->mhp += intRet(officer, nRank * makeint(11-GetDifficulty()), (nRank - 1) * PLAYER_HITPOINTS_PER_LEVEL);    // LDH 05Dec06<!--c2--></div><!--ec2-->

This will generate the character's hit points the same way it does the player's. My thoughts are to generate the ranks based on difficulty, but generate the hit points the same way everywhere. This is only a start. Notice the officer hit points are still generated slightly differently.

There's a line above in the same function that generates ranks based on difficulty:

<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->nRank = makeint((pRank/2.0 + Rand(pRank) - (pLuck / 3.0)) * (2.0/3.0 + ((makefloat(GetDifficulty())-1.0)/5.0)) + 0.5);<!--c2--></div><!--ec2-->

You might change "2.0/3.0" to "1.0" in that calculation to get slightly higher ranks all around.

---------------

I mentioned in that post about changing the "2.0/3.0" to "1.0". This will give all enemy characters a 50% boost in their character level. This won't make much difference when you're a starting player, but for a high level player the enemies can be considerably stronger. It's up to you if you want to do this, and it should be made a constant in the InternalSettings.h file. I'll get around to that eventually. But it's not really necessary because of addtional changes I'll describe below. For now, if you haven't changed it already, leave it at "2.0/3.0".

Hook
 
And here's the major change. Find the code in LAi_monsters.c around line 335 that says:

<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->switch(LAi_MonsterInfo.type)
{
    case "town":
        offset = intRet(pclevel > 10, makeint(pclevel /2), -TOWN_OFFSET); // TIH must be ints Nov17'06
        if(offset > 4) offset -= GetOfficersQuantity(GetMainCharacter());
        break;
    case "house": offset = intRet(pclevel > 10, makeint(pclevel /2), -TOWN_OFFSET); break; // TIH must be ints Nov17'06
}
//trace("Gauging: Create Fantom now:");<!--c2--></div><!--ec2-->

... and replace it with:

<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->switch(LAi_MonsterInfo.type)
{
    case "town":
        // LDH --> 08Dec06 -- make the town monsters stronger
        //offset = intRet(pclevel > 10, makeint(pclevel /2), -TOWN_OFFSET); // TIH must be ints Nov17'06
        //if(offset > 4) offset -= GetOfficersQuantity(GetMainCharacter());
        offset = -TOWN_OFFSET;
        offset -= GetOfficersQuantity(GetMainCharacter());
        break;
    case "house":
        //offset = intRet(pclevel > 10, makeint(pclevel /2), -TOWN_OFFSET); // TIH must be ints Nov17'06
        offset = -TOWN_OFFSET;
        break;
        // LDH <--
}
//trace("Gauging: Create Fantom now:");<!--c2--></div><!--ec2-->

This is where the town lowlifes were being generated at half your player character rank. The above change will make the townies generate at a rank closer to the player's. This still won't have much effect for a low level player, but at high levels you will encounter much more worthy opponents.

Note that this ONLY affects the guys who attack you in towns, and the guys you find in houses. The bad guys you find in dungeons or outside the town gates will still be generated at higher ranks the same as before these changes. They will have more hit points, however, so take care.

Please note the variable TOWN_OFFSET which you will find in the InternalSettings.h file. This defaults to -5.0, which will make the townies average 5 character levels below the player. If you want stronger town enemies, make this number higher. For example, instead of -5, change it to -3. If you want the town enemies to be the same strength as the dungeon enemies, change it to zero. Note that the number is modified by the number of officers you have with you, so if you have 3 officers accompanying you that -5 will be changed to -2 anyway. But only for town encounters, not encounters in houses, and not for encounters in dungeons or outside of town.

I haven't investigated how these changes will affect enemy captains you encounter, but it appears they will be a bit stronger as well. Enemy boarding crews' hit points are generated a different way, and are adjusted closer to the player. This code does not affect that in any significant way.

This code has not gone through the rigorous testing the boarding code did, so the balance may still need to be tweaked. But I've been playing it and it seems to be balanced.

Comments, questions and suggestions are all welcome.

Hook
 
Is there any way to randomize those numbers? You know, make some encounters easier, and some harder? This would keep the players on his toes <img src="style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" />
 
Great work Hook <img src="style_emoticons/<#EMO_DIR#>/par-ty.gif" style="vertical-align:middle" emoid=":cheers" border="0" alt="par-ty.gif" />

Once this has finaly been sorted in the build i might start to use the "toughness" perk again! This is important to get right - at the momment we have a huge discrepency over the level of challange when at sea vs on land. Glad the ball is rolling <img src="style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" />
 
There's already a lot of randomness in the encounters. An enemy character will be between half your character level and 1.5 times your character level. Then it's adjusted by game difficulty.

For example, with a level 20 character and luck 10, at difficulty level 2 the numbers range from 8 to 32. And all the characters I've encountered at that level have the toughness perk. This is in dungeons or outside of town. In town the numbers range from 5 to 23 with the same character. This is the effect of TOWN_OFFSET.

A level 4 character with 0 luck at difficulty 1 will see enemies from 2 to 6 in dungeons and mostly level 1 enemies in town, occasionally seeing a level 2. These guys don't have the toughness perk. The same character with 4 luck will see enemies at level 1 to 5 in dungeons.

The above numbers all have the "2.0/3.0" changed to "1.0".

Toughness definitely starts getting useful again, but it's not as important as it is in boardings. Most of the town characters will still be pretty easy to take on, unless you modify TOWN_OFFSET.

Hook
 
Thanks a lot for uncovering that, Hook <img src="style_emoticons/<#EMO_DIR#>/me.gif" style="vertical-align:middle" emoid=":onya" border="0" alt="me.gif" /> So this forgotten setting actually determines how hard the townpart of the game is, right? Maybe we should move it out of obscurity into BS.h then?
 
The way it was originally written, TOWN_OFFSET depended on other numbers hard coded in the calculations to give reasonable results. The way I've changed it, it will have a more direct effect and shouldn't give any surprises.

It does seem like it's important enough to go in BuildSettings.h instead of being in the InternalSettings.h file. It's up to y'all how you want to handle that.

Hook
 
BTW, I think I can imagine why Nathan once added that TOWN_OFFSET. When we introduced those town muggers into PotC many people were shocked by suddenly being attacked in the formerly peaceful and boring towns. Probably weakening the town enemies was meant to reduce that shock.
 
Back
Top