Talk:Experience

From UFOpaedia
Jump to: navigation, search

Just some thoughts I want to jot down before I forget them, based off a discussion I read on one of the forums:

  • Kills. Just to be clear, it needs to be emphasised that kills do not count towards stat increases. Was this mentioned or has it been mentioned elsewhere?
  • Similarly, kill attribution. When do you get the kill counter incremented. Grenades (thrown and unthrown), volatile battlescape element (i.e. gas tank), secondary explosion from cyberdisc, or volatile battlescape element set off by cyberdisc explosion. Probably by reactions and active attacks too. Don't remember if we ever quantified all the methods that'll increment the kill counter.

- NKF

Tested the secondary explosion from oil drums, found within my X-COM base hanger. Waited til that last snakeman soldier roamed around weaponlessly, and then smacked the barrel infront of him him. Boom, and Tatsuo Iwahara graduates to a squaddie after this base defense with 1 kills in 3 missions, via a unarmed snakeman using a barrel for cover. Can someone confirm my test?
Hmm, but is only just off one barrel exploding. I don't know if things change, if you say, line up barrels across the screen and fry the poor sectoid at the other end. --Vagabond 01:53, 15 March 2007 (PDT)
I'm not positive, but I think the rule is "whoever takes the action gets the kill", i.e., the last soldier to take any sort of action which results in an enemy death gets credited. I infer this from how Proximity Grenades work: credit for the kill goes to whoever sets off the grenade. I suspect this'll be borne out for "chain reaction" kills and the like. Alien-on-alien kills probably don't apply (Cyberdisc explosions probably do), and grenade kills are already known to go to the last soldier who threw it.--Ethereal Cereal 02:54, 15 March 2007 (PDT)


Might also want to double check that the guy credited with the kill is not the first soldier in the list just to make sure it's not like dropping a grenade. --Pi Masta 14:42, 15 March 2007 (PDT)

Hi folks, I've been off playing other games a long time (even caused a new wiki to be made for a game, plus of course contributed to many), but still love X-COM - and the many great folks on this wiki.

NKF, the fact that kills don't matter to Experience per se has been long cited at Firing_Accuracy#Improvement. The Experience page says to see each skill page, to see exactly how to trigger it. Apologies if you asked before I revised the pages - correlating History timestamps takes time. And also, apologies if it's now well understood. But if you or others would like to repeat it on Experience or elsewhere to hammer the point home, please do.

I, for one, don't remember too much being posted about attribution of secondary kills. It sounds like something to be explored. The exact same could be said for the Kill counter. I can't recall anything at all being said about any nuances of it. But then my memory is famously retarded. One interesting thing is that both UNITREF.DAT and SOLDIER.DAT have a two-byte field for it, so the programmers really pulled out the stops - they thought players might deliberately / well have a favorite soldier get hundreds of kills (>255).

Ethereal, don't forget the Prox Mine is an exception to the rule for every other weapon. In a sense, if you die from it, you get experience from dying, laugh. FWIW it was a real surprise, discovering how it worked. I wonder if the programmers screwed it up.

- MikeTheRed 20:57, 5 October 2007 (PDT)

I can confirm the programmers did screw up. The proxmines are treated as a special case, and contrary to grenades, the programmers forgot to set the current unit (i.e. the one that gets the credits) before generating the explosion. The fix I made in my patcher just sets the current unit (quantity2 field from obpos) and voila. Seb76 12:45, 7 August 2008 (PDT)

P.S. The details that some of us wikians are getting into these days, can sometimes can really benefit from savegame postings where the first person took the time and care to set everything up, and then test it. Please folks, don't hesitate to post zipped savegames you used for testing!


NKF, am I missing something, or where did Brunpal's comments finally wind up? I can't seem to find them not removed on any of the three pages. I am posting this here so he'll see it if he's tracking pages he posted to.

Brunpal, I made a start on your good question as the third part of Talk:Incendiary. I would have emailed you, but you aren't allowing email.

Good Xcomming, and thanks for your good question. As NKF said, no need to post in multiple places. It can be helpful to have a contact listed. :) - MikeTheRed 20:08, 1 August 2008 (PDT)

Brunpal's comments remain on Talk:Experience Training, MRT. Arrow Quivershaft 20:35, 1 August 2008 (PDT)
The discussion ended up on Talk:Experience_Training#Fire_and_Gaining_Experience. That page is the only spot my questions remain. Ya sorry about the multiple posts. All the pages had 8+ months since an update. I expected it would be months before someone would stumble onto one of the pages for a reply.--Brunpal 20:41, 1 August 2008 (PDT)



I dont see it mentioned but the cap for TU's was different in UFO 1.0. According to the 1.2 readme that patch set the 80 limit. --BladeFireLight 21:49, 13 January 2010 (EST)

It didn't have any caps as far as I remember. That's why a lot of players who were on 1.0 had soldiers crippled when their stats went past 255 and wrapped back around thanks to the high bits vanishing into the ether. -NKF 04:32, 14 January 2010 (EST)

Experience Code

This how stats improvements updated after mission end:

 function randmod(int a)
 {
   return Rand() % (a+1);
 }
 function StatImprove4(int exp_score)
 {
   if (exp_score<=0) return 0;
   if (exp_score<=2) return 1;
   if (exp_score<=5) return 2;
   if (exp_score<=10) return 3;
   return 4;
 }
 function StatImproveRND(int exp_score)
 {
   int v=StatImprove4(exp_score);
   return v/2 + randmod(v);
 }

main calculations done after battle:

 if (UnitRef->PsiSkill_experience>0 ||
     UnitRef->Bravery_experience>0 ||
     UnitRef->FireAccuracy_experience>0 ||
     UnitRef->MeleeAccuracy_experience>0 ||
     UnitRef->Reactions_experience>0)
 {
   if (!Soldier->Rank) Soldier->Rank = 1;
   int v;
   v = 80 - Soldier->BaseTUs - Soldier->ImproveTUs;
   if (v > 0) Soldier->ImproveTUs += randmod(v/10 + 2);
   v = 60 - Soldier->BaseHPs - Soldier->ImproveHPs;
   if (v > 0) Soldier->ImproveHPs += randmod(v/10 + 2);
   v = 70 - Soldier->BaseStrength - Soldier->ImproveStrength;
   if (v > 0) Soldier->ImproveStrength += randmod(v/10 + 2);
   v = 100 - Soldier->BaseEnergy - Soldier->ImproveEnergy;
   if (v > 0) Soldier->ImproveEnergy += randmod(v/10 + 2);
 } 
 if ( Soldier->ImproveReactions + Soldier->BaseReactions < 100 )
   Soldier->ImproveReactions += StatImproveRND(UnitRef->Reactions_experience);
 if ( Soldier->ImproveFireAccuracy + Soldier->BaseFireAccuracy < 120 )
   Soldier->ImproveFireAccuracy += StatImproveRND(UnitRef->FireAccuracy_experience);
 if ( Soldier->ImproveMeleeAccuracy + Soldier->BaseMeleeAccuracy < 120 )
   Soldier->ImproveMeleeAccuracy += StatImproveRND(UnitRef->MeleeAccuracy_experience);
 if ( Soldier->ImproveThrowAccuracy + Soldier->BaseThrowAccuracy < 120 )
   Soldier->ImproveThrowAccuracy += StatImproveRND(UnitRef->ThrowAccuracy_experience);
 if ( Soldier->ImprovePsiSkill + Soldier->BasePsiSkill < 100 )
   Soldier->ImprovePsiSkill += StatImproveRND(UnitRef->PsiSkill_experience);
 if ( Soldier->BaseBravery - Soldier->ImproveBravery > 1 )
   if ( UnitRef->Bravery_experience>randmod(10) ) ++Soldier->ImproveBravery;
 if ( UnitRef->CurHPs < UnitRef->BaseHPs ) //wounded
 {
   int v = UnitRef->BaseHPs - UnitRef->CurHPs;
   Soldier->Wound_Recovery_Days = v / 2 + randmod(v);
 }

--Volutar 11:17, 13 March 2011 (EDT)

Each solder being in psi-training received some skill progress each month. The formula is:

 if (Soldier->InPsiLab)
 {
   if (Soldier->PsiSkill > 50)
     Soldier->PsiSkill_Monthly_Improve = randmod(2) + 1;
   else if (Soldier->PsiSkill > 16)
     Soldier->PsiSkill_Monthly_Improve = randmod(7) + 5;
   else
     Soldier->PsiSkill_Monthly_Improve = randmod(8) + 16;
   Soldier->PsiSkill += Soldier->PsiSkill_MonthImprove;
 }
 else
   Soldier->PsiSkill_Monthly_Improve = 0;

As we clearly see there is no cap for montly PsiSkill improvement. After reaching level of 100 (with missions or montly) this skill will continue to grow 1..3 each month. And it doesn't matter if soldier started training at month start or 1 minute before month end :).

--Volutar 11:23, 14 March 2011 (EDT)

Hi Volutar, I have been away. I did the testing on the page, and definitely found you needed 11 actions for max improvement, across hundreds of tests. Please say more: What version were you using? (CE, DOS, etc.) I tested in DOS 1.4. Where is the code, and what tool did you use to decode? Have you actually tested? It's ok to say No - your code is still greatly appreciated. I wish I had it back then! But X-COM has many instances of rounding affecting results.
(Does anyone else know where the code is and how to decode?)
Thanks -MikeTheRed 18:26, 5 August 2012 (EDT)
K, here's a savegame that has 14 soldiers, all with 50 for Firing, Reactions, Throwing, and Psy in SOLDIER.DAT. (You will have to quit the combat to see this.) Also, the first 7 have 10 for their number of Kills and for all four Experience Counters (ECs), the second 7 have 11 for the same values in UNITREF.DAT. You can tell if you're seeing the max primary actions if there are increases of 5 and 6s, but no 1s, for the soldiers. But if you see 1s and no 5s and 6s, you're not seeing the max experience roll. Quit the combat and see what you get with the first 7 versus the second 7.
So, in DOS X-COM, it still takes 11 ECs. (Should I add, oh ye of little faith? heh) Can someone check CE so we can know whether it's different, or there's something more than the code shown here?
Thanks -MikeTheRed 00:09, 1 September 2012 (EDT)
First of all - sorry for late response. Originally I was inspecting CE version, bought in "steam". I was thinking these formulas in DOS/CE are the same. I haven't tested them, I just have not time for these trials, but I have strong knowledge about this code (I also re-checked it few times). Code was decoded with IDA - in the function at .text:004471B0 named "Updates_After_Mission_End". And I don't know what in the world can prevent them from working the way I've described :).(.--Volutar 23:16, 2 September 2012 (EDT)
A fencepost problem perhaps? NKF
I've revised StatImprove4 function.. I've shown slightly incorrect border values.

Code snippet:

 exp = cur_unitref->MeleeAccuracy_exp_cnt;
 if ( exp )
  {
   if ( exp <= 10u )
    {
     if ( exp <= 5u )
       val = ( exp > 2u) + 1;
     else
       val = 3;
    }
   else
    {
     val = 4;
    }
   soldier_addr->ImproveMeleeAcc += val / 2 + xc_RandMod(val);
  }

So 10 EC is level 3 and 11 EC is level 4 of improvement.

lvl  EC     improve range
1:  1..2   0..1
2:  3..5   1..3
3:  6..10  1..4
4:  11..   2..6

--Volutar 02:25, 3 September 2012 (EDT)

Great, thanks Volutar... I knew I'd seen 11 be the value tons of times. Testing is good and de-coding is great, but what's really best, is both. :)
Are you just using IDA 5.0 Freeware or does it need any other plugin or whatever? FWIW we really should have some entries on the Game_editors page concerning decoders to get, and maybe a little primer on using them (on its own separate page).
Thanks again! -MikeTheRed 11:23, 12 September 2012 (EDT)
P.S. The number 11 may seem an odd value to use, but it was also chosen for the Bravery experience counter, which works differently. (See the top and bottom of that talk page.) So I think it was deliberate (but don't ask me why). I vaguely recall that 11 was singled out somewhere else in the game, too.

"Putting it all together"

It says that in the endgame where money is not an issue and you just want supersoldiers, then it's mostly important to pick recruits who are not anomalously low in any stat. I don't think this is very accurate; your first two priorities would be the two stats that can't be improved - Psi-Strength and the lesser-known Energy Recharge (which is based on a rookie's initial TU). So you'd select for soldiers without anomalously low stats only after selecting for high Psi-Strength and high TU (because Psi-Strength can't be improved at all, and while TU can be improved the derived Energy Recharge cannot).

Am I missing something or should I edit this? Magic9mushroom (talk) 05:21, 13 August 2014 (EDT)

Edit away. I think the only reason to look for reasonably good stats, or more specifically good primary stats, is to save time with the stat grinding. Apart from TUs for the energy recharge, it shouldn't matter too much for some of the secondary stats thanks to the range adjustments. NKF (talk) 05:42, 13 August 2014 (EDT)