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

Fixed Leveling: Sudden Huge Amounts of XP Gained

Odd that the first time the visibility is logged for the Diana, Tribune and Cyclop, a stupidly high number was returned.
This seems to have fixed itself later though. Could it be that some skill-related stuff isn't initialized until after entering 3D sailing mode?
No, that's not it. Sometimes I get stupidly high visibilities and sometimes normal values throughout the game:
Code:
FLAGS: The HMS 'Majestic' has visibility 1737.5
FLAGS: The HMS 'Majestic' has visibility 1737.5
FLAGS: The HMS 'Majestic' has visibility 1737.5
FLAGS: The HMS 'Majestic' has visibility 1737.5
FLAGS: The HMS 'Majestic' has visibility 1737.5
FLAGS: The HMS 'Majestic' has visibility 1737.5
FLAGS: The HMS 'Majestic' has visibility 1737.5
FLAGS: The HMS 'Majestic' has visibility 1737.5
FLAGS: The HMS 'Majestic' has visibility 1737.5
FLAGS: The HMS 'Majestic' has visibility 293.75
FLAGS: The HMS 'Majestic' has visibility 293.75
FLAGS: The HMS 'Majestic' has visibility 293.75
FLAGS: The HMS 'Majestic' has visibility 293.75
FLAGS: The HMS 'Majestic' has visibility 293.75
FLAGS: The HMS 'Majestic' has visibility 293.75
FLAGS: The HMS 'Majestic' has visibility 293.75
FLAGS: The HMS 'Majestic' has visibility 293.75
FLAGS: The HMS 'Majestic' has visibility 293.75
FLAGS: The HMS 'Majestic' has visibility 293.75
FLAGS: The HMS 'Majestic' has visibility 293.75
FLAGS: The HMS 'Majestic' has visibility 293.75
FLAGS: The HMS 'Majestic' has visibility 293.75
FLAGS: The HMS 'Majestic' has visibility 293.75
FLAGS: The HMS 'Majestic' has visibility 293.75
FLAGS: The HMS 'Majestic' has visibility 293.75
FLAGS: The HMS 'Majestic' has visibility 293.75
FLAGS: The HMS 'Majestic' has visibility 293.75
This is BAD and may kill the false flag recognition because ships might be able to see far, far beyond what they should! :shock
 
I used console switch(3) on a new game and took my fleet into a storm.
The amount of level-ups on a continuous basis was quite amazing. :shock
 
Code:
CalcCharacterSkill: Leadership = 6, Sailing = 1
GetCharacterSkill: Leadership = 6, Sailing = 1
GetSummonSkillFromName: Leadership = 1, Sailing = 1
CalcSummOnSkillFromName: Leadership = 0, Sailing = 0
Looks like the two list-based functions do return the correct values, but when is that list updated?
And the other ones that recalculate everything seem to return pretty wrong values. Skills of 0? Wha???

So for now, I'll use CalcCharacterSkill as that is probably the best one to use. But I do think those other two need looking at.
If indeed the list of character skill modifiers is correctly updated also for NPCs when needed, why don't we get rid of those other functions altogether?
If that is not the case, then CalcSummOnSkillFromName will need fixing because it should be returning the same numbers as GetCharacterSkill, shouldn't it?
From what I can see the summonskill functions are for contributions etc. If the modifiers are set right this shouldn't be a problem indeed.... But please check if it works okay when you got an officer with higher skill which contributes.


Code:
void LevelUp_Cheat(ref rCharacter, bool real)
{
   if (real)
   {
     int xp = CalculateExperienceFromRank(sti(rCharacter.rank)+1)-CalculateExperienceFromRank(sti(rCharacter.rank));
     float mult = 2.0 - (1.0-((GetDifficulty()-1.0) / 4.0));
     AddCharacterExpNS(&rCharacter, makeint(xp*mult)); // NK do it via actual call 05-07-10
   }
How come difficulty is factored in there now? Just curious.
Because there is a multiplier for the difficulty in the function to make the XP progression harder. So if we want to level up we should take this multiplier in account.

YIKES! I am doing some more false flag testing and got this:
View attachment 22092
Gained a huge amount of levels from ONE hit by cannon. I didn't get any skills to match by the Auto Skill System though.

EDIT: Doesn't happen anymore now that I've started a new game. That's some improvement at least. :wp

This is because you still had an old Experience value while these values now changed but it did take your XP you already had and checked with it. Thats why you don't get new skill points that much cause they only look at whats added, but for leveling up it also checks what you have already gathers for xp.
running this code should fix it on a old savegame (the second line is not needed that much but will give better results with the cheat level up).
Code:
pchar.experience = CalculateExperienceFromRank(sti(pchar.rank));
SetCharSkillImportance(pchar,1);

An error in character_init.c:
Code:
SetCharSkillImportance(pchar,1); //Levis make sure all skill importances are set right.
Should be:
Code:
SetCharSkillImportance(ch,1); //Levis make sure all skill importances are set right.

Changed, see included file.


That seems to be serving its purpose for now to give different characters different ranges:
Code:
FLAGS: The 'Diana' has visibility 1737.5 // UH????
FLAGS: The HMS 'Tribune' has visibility 1737.5 // Too high????
FLAGS: The HMS 'Cyclop' has visibility 1737.5 // Same again!
FLAGS: The HMS 'Charlestown Fort' has visibility 318.75  // <-------- LOL!!! -----------
FLAGS: The 'Diana' has visibility 293.75 // Now to normal, very strange
FLAGS: The 'Protector' has visibility 293.75
FLAGS: The HMS 'Tribune' has visibility 293.75
FLAGS: The HMS 'Tigress' has visibility 293.75
FLAGS: The HMS 'Cyclop' has visibility 293.75
FLAGS: The HMS 'Crocodile' has visibility 293.75
Odd that the first time the visibility is logged for the Diana, Tribune and Cyclop, a stupidly high number was returned.
This seems to have fixed itself later though. Could it be that some skill-related stuff isn't initialized until after entering 3D sailing mode?
I want to make sure this cannot break the flag detection, because suddenly high visibilities might trigger recognizing when that is not intended.

All ships have the same visibility though, which at first glance appears to be correct because their captains have Sailing = 1 and Leadership = 1.
However, some do have higher ranks:
Code:
skill =
  fencing = 2
  leadership = 1
  sailing = 1
  accuracy = 1
  cannons = 1
  grappling = 1
  repair = 1
  defence = 1
  commerce = 1
  sneak = 1
rank = 3
And:
Code:
skill =
  fencing = 1
  leadership = 1
  sailing = 1
  accuracy = 1
  cannons = 1
  grappling = 1
  repair = 1
  defence = 1
  commerce = 1
  sneak = 1
rank = 2
Note that they do not have the skills to match their rank. Only the rank 3 one has one extra skill point, but of course should have 4 assigned to something.

The fort does correctly show a somewhat higher range.

It could very well be skill related stuff isn't done right yet on sea. Need to look into that. They do use the officergeneration function so in theory nothing should go wrong there. But it could use some updating I see, The auto update function for character isn't called on sea. I think I will add this function for load to sea. Do you know which function it used for loading to sea? This way I'm sure all characters on sea are set up right.

No, that's not it. Sometimes I get stupidly high visibilities and sometimes normal values throughout the game:
Code:
FLAGS: The HMS 'Majestic' has visibility 1737.5
FLAGS: The HMS 'Majestic' has visibility 1737.5
FLAGS: The HMS 'Majestic' has visibility 1737.5
FLAGS: The HMS 'Majestic' has visibility 1737.5
FLAGS: The HMS 'Majestic' has visibility 1737.5
FLAGS: The HMS 'Majestic' has visibility 1737.5
FLAGS: The HMS 'Majestic' has visibility 1737.5
FLAGS: The HMS 'Majestic' has visibility 1737.5
FLAGS: The HMS 'Majestic' has visibility 1737.5
FLAGS: The HMS 'Majestic' has visibility 293.75
FLAGS: The HMS 'Majestic' has visibility 293.75
FLAGS: The HMS 'Majestic' has visibility 293.75
FLAGS: The HMS 'Majestic' has visibility 293.75
FLAGS: The HMS 'Majestic' has visibility 293.75
FLAGS: The HMS 'Majestic' has visibility 293.75
FLAGS: The HMS 'Majestic' has visibility 293.75
FLAGS: The HMS 'Majestic' has visibility 293.75
FLAGS: The HMS 'Majestic' has visibility 293.75
FLAGS: The HMS 'Majestic' has visibility 293.75
FLAGS: The HMS 'Majestic' has visibility 293.75
FLAGS: The HMS 'Majestic' has visibility 293.75
FLAGS: The HMS 'Majestic' has visibility 293.75
FLAGS: The HMS 'Majestic' has visibility 293.75
FLAGS: The HMS 'Majestic' has visibility 293.75
FLAGS: The HMS 'Majestic' has visibility 293.75
FLAGS: The HMS 'Majestic' has visibility 293.75
FLAGS: The HMS 'Majestic' has visibility 293.75
This is BAD and may kill the false flag recognition because ships might be able to see far, far beyond what they should! :shock

How does the code look that calculates it? Could you maybe add something to the trace to show the skill level? What change is occuring?

I used console switch(3) on a new game and took my fleet into a storm.
The amount of level-ups on a continuous basis was quite amazing. :shock

Still need to do some balancing maybe :p.

file included in here:
http://www.piratesahoy.net/threads/sudden-huge-amounts-of-xp-gained.24829/page-5#post-513685
 
Last edited:
What exactly is new with that attachment? Or just the change I already suggested?

It could very well be skill related stuff isn't done right yet on sea. Need to look into that. They do use the officergeneration function so in theory nothing should go wrong there. But it could use some updating I see, The auto update function for character isn't called on sea. I think I will add this function for load to sea. Do you know which function it used for loading to sea? This way I'm sure all characters on sea are set up right.
Look in PROGRAM\SEA_AI\sea.c ; function something something SeaLogin or so?

How does the code look that calculates it? Could you maybe add something to the trace to show the skill level? What change is occuring?
Search in PROGRAM\SEA_AI\AIShip.c and/or PROGRAM\Screwface_functions.c for "visibility" to see the old function.
At the moment I have no access to my game files until later tonight, so can't post my current version.
It is very similar though; only difference is that I split it into two separate functions: One that gets the visibility and a second one that modifies the range based on character skills.
Simply put, it should do: visibility = visibility * skill_leadership * skill_sailing * 5, if I recall.
 
Has anything to be tested of this feature right now? I don't mind trying and experience the new fixes. What is the new archive I have to download?
 
Has anything to be tested of this feature right now? I don't mind trying and experience the new fixes. What is the new archive I have to download?
Hopefully tomorrow I'll be able to make a new release with ALL the new stuff included. That'll be a good version for testing (though probably not so much for playing. :wp )
 
Hopefully tomorrow I'll be able to make a new release with ALL the new stuff included. That'll be a good version for testing (though probably not so much for playing. :wp )
Well, it is better than what we have now. I'm waiting for a new version in order to try and comment my experience. If it is not good yet enough to play properly, well... step by step.
 
Please just download the zip I have posted here and extract it to your program folder.
Use the console to execute this command if you want to continue on a previous savegame:
Code:
pchar.experience = CalculateExperienceFromRank(sti(pchar.rank));
SetCharSkillImportance(pchar,1);

And play and let me know if your level increases to fast or to slow doing different tasks.
 
I have made a short try on a BBF storyline, training with Robert Fletcher (a.k.a. other Malcom) in fencing, and now there isn't the bug which accumulate experience to the skill without improving it. However, I found that now raising levels is A LOT more easier... in comparison with how it was before these fixes.

EDIT: I also noticed that you gain more easy, experience with accuracy than with fencing. For me, I don't like it too much. I would rebalance it if posible.
 
Last edited:
I have made a short try on a BBF storyline, training with Robert Fletcher (a.k.a. other Malcom) in fencing, and now there isn't the bug which accumulate experience to the skill without improving it. However, I found that now raising levels is A LOT more easier... in comparison with how it was before these fixes.
Leveling up going too fast? That would match with what I noticed when gaining XP with my fleet in a storm too. :yes
 
Curious about that fact, I looked onto my character profile and then I discovered something; the amount of level you ned to pass from one level to the next is shorter, and also they start with low experience required. Here's a screenshot that can explain it better.

Level decreased.jpg

As you can see, starting at that amount of exp is inconsistent (With the amount of exp showed there, you should be starting at level 3). I have also tried with TSH campaign, which the character starts at level 1, and there was also some inconsistency: the amount of exp which you start is 500 (It should be o) and the amount of exp you need in order to pass the next level was something around 1285 exp or so (Which should be 1000). So... that's why levels are so easy to progress.
 
Why should it be 1000 for level 2?
The amount of xp you need to gain is modified because a lot of modifiers disapaired I had to rebalence this.
The 500 is a know thing, this will be fixed later when I do some more of the balancing. For now I just need to know if its to hard to to easy for different skill.
Run this code in the console
Code:
int old = 0;
    int new = 0;
    for(int n = 1; n <= 100; n++)
    {
        new = CalculateExperienceFromRank(n);
        trace("Rank "+n+" exp: "+new+" difference: "+(new-old));
        old = new;
    }
    trace("SKILLS");
    for(n = 1; n <= 10; n++)
    {
        new = CalculateSkillExperienceFromRank(n);
        trace("Rank "+n+" exp: "+new);
    }

It will output the required xp for the different levels and skilllevels in the compile.log
 
Here is an updated zip again with some bugfixes etc.
@Pieter Boelen please check if the problem with the distance calculation is solved now.

Also should give some performance increase again. Also included the interface fixes from the other topic.
 

Attachments

  • PROGRAM_v6.zip
    403.8 KB · Views: 121
This is the code that finds the visibility range, by the way:
Code:
float GetVisibilityRange(int iRange)
{
   float visibility_range;
   switch (iRange)
   {
     case 1:
       visibility_range = 1000.0;
     break;
     case 2:
       visibility_range = 500.0;
     break;
     case 3:
       visibility_range = 300.0;
     break;
     // default:
       visibility_range = 3000.0;
       
   }
   visibility_range -= (stf(Weathers.Fog.SeaDensity) * 130 * visibility_range);
   if (Whr_IsNight()) visibility_range /= 2.0;
   return visibility_range;
}

float GetCharVisibilityRange(ref chr, int iRange)
{
   // higher leadership and sailing skills result in better vision
   float visibility_range = GetVisibilityRange(iRange);
   visibility_range += makefloat(CalcCharacterSkill(chr, SKILL_LEADERSHIP) * CalcCharacterSkill(chr, SKILL_SAILING) * 5); // KK
   TraceAndLog("FLAGS: The " + GetMyShipNameShow(chr) + " has visibility " + visibility_range);
   return visibility_range;
}
I'll test your changes in a bit.
 
@Pieter Boelen please check if the problem with the distance calculation is solved now.
Come to think of it, that is probably not actually a bug.
The game calls that function with a different reason for AI purposes, so it is probably quite normal.
It finally dawned on me. :facepalm
 
Well... another half an hour of testing with new patch from Levis... basically, nothing has been changed from the previous one: the amount of exp you need to pass from one level to the next is very short (About 2500 exp needed, and with each new level, the amount of exp needed increases... for just 100 or so).

Also, I found that hiring officers is not worthwile... I was on level 14 when I went to the tavern, looking for a quartermaster... and that officer was on level 10 but the skill commerce was at level 3. And I had 5 myself. :rumgone Even when hiring another type of officer, there is the same problem; they don't focus on the skills of their type.

Just to be sure: It is needed to press F11? Or F12 if I create a new game?
 
Back
Top