project-navigation
Personal tools

Author Topic: Soldier Stat Increase System: ABILITY_SPEED  (Read 6261 times)

Offline Zearro

  • Cannon Fodder
  • **
  • Posts: 3
    • View Profile
Soldier Stat Increase System: ABILITY_SPEED
« on: December 22, 2011, 02:34:54 pm »
this is sort of an informal bug report as it doesn't have a solid test case, but i have done an experiment to validate my statements. Please allow me to try and reason it out with a logical argument.

From my incomplete readings of the forum, and the current source code,
I've found that TUs spent firing weapons don't /actually/ increase experience towards ABILITY_SPEED, when it is supposed to.

I've read on the forum,
http://ufoai.ninex.info/forum/index.php/topic,2254.msg13542.html#msg13542
Quote
Speed: 1 point for every space moved. 2 points for every space moved while crouched. 1 point for every 10 TUs spent using weapons.
I've noticed the TUs are stored by skill, and thus the aforementioned calculation must include a loop to sum the TUs spent over the array of skills. The current code does have such a loop statement.
The current source code under src/game/g_match.c in the method static int G_GetEarnedExperience (abilityskills_t skill, character_t *chr)
https://github.com/ufoai/ufoai/blob/master/src/game/g_match.c
Code: [Select]
case ABILITY_SPEED:
experience = chr->scoreMission->movedNormal / 2 + chr->scoreMission->movedCrouched + (chr->scoreMission->firedTUs[skill] + chr->scoreMission->firedSplashTUs[skill]) / 10;
break;
the variable being switched upon is skill, and its value is implicitly ABILITY_SPEED, so it only adds values from firedTUs and firedSplashTUs at the index ABILITY_SPEED, which in my source greping and readings, is never actually written to.

the fix is to add a loop to iterate over the array, summing over each index, in a similar fashion as the next case, ABILITY_ACCURACY.
this should provide the functionality of adding a tenth of all TUs spent firing weapons to the experience for ABILITY_SPEED.

(at first i thought firedTUs[ABILITY_SPEED] was used (or could be) to track TUs spent on reaction fire, but it doesn't seem the case from what i've read.)

I'd be willing to do the work, after this is verified and whatnot. I'm new to contributing to open source projects, and would like the opportunity to help. I still have a lot of reading to do, and observations to make. I have some other ideas to present at a later time related to the concepts and code, but one topic per topic seems a good start.

By the way, not that it should matter, but for completeness sake...
I first noticed this in the 2.4-dev debug version for Mac OS X. I just built the source from the git repo today, and that is when I did my last validation experiment.

If anyone could verify this for me, that would be outstanding. I don't think i'm crazy, but i could be...

Offline Zearro

  • Cannon Fodder
  • **
  • Posts: 3
    • View Profile
Re: Soldier Stat Increase System: ABILITY_SPEED
« Reply #1 on: December 22, 2011, 02:57:34 pm »
Oh, I guess I better mention how i verified the existence of this.

I got into the battlescape, and had one of my characters move (not crouched) ten TU and use the remaining TUs for reaction fire behind an alien.
Ended my turn, got my reaction fire, and killed the alien.
(you can pull up the console and issue the command debug_listscore to look at the data)
My turn starts, pull up the console, issue the command debug_killteam 7,
Ended the mission, pulled up the console to view the experience gained by skill, and saw 20 xp () instead of the expected 20 + 1 = ( 20 + (int) 12 / 10 ).

I'd suppose you have to spend more than a total 10 TU in reaction fire, or simply firing a weapon for that matter to not get the contribution in question rounded down to zero, and thus undetectable.

I didn't record the numbers exactly, they're from memory, so I'll do it again soon and substitute the real numbers, but this should be close enough to give the idea.

Offline MCR

  • PHALANX veteran
  • ******
  • Posts: 1244
    • View Profile
Re: Soldier Stat Increase System: ABILITY_SPEED
« Reply #2 on: December 23, 2011, 10:57:25 am »
Patches are "very wellkommen", as you already know ;)

 8) to see someone work on this, because soldier advancement is a big part of the player's motivation in the campaign.

Offline Zearro

  • Cannon Fodder
  • **
  • Posts: 3
    • View Profile
Re: Soldier Stat Increase System: ABILITY_SPEED
« Reply #3 on: December 28, 2011, 09:41:03 am »
Alright! I think this should be the patch that fixes it. It at least brings the code up to design specification.

Next problem. If a soldier gets Max Speed experience (~6 rounds of full running, only ~4 for crouching), in 100 mission, they get 3 TU. (assuming no changed in armor penalty, which is unlikely.)

Offline shag

  • Cannon Fodder
  • **
  • Posts: 8
    • View Profile
Re: Soldier Stat Increase System: ABILITY_SPEED
« Reply #4 on: February 05, 2012, 10:41:30 pm »
I haven't checked to see if the numbers match, but in my playing I noticed that the Speed ability is not increasing (or very very slowly). It's as if it's just a given when hiring a soldier, with no chance of improving.

I actually search for 'speed bug' first before arriving on this thread :)

So from this thread and from the code I see speed experience _IS_ gained, only very slowly (or, more accurate, it translates into very slow increase of speed ability). What would be a good rate of speed ability growth is when you start to be able to use Nanocomposite Armour your most experienced soldiers (those from the start of the game), should have about the same TU's (with nano armour) as they had at the start of the game (without nano armour), with average speed experience growth (so not taking the max gain every mission, but more near 60-75%).




Offline DarthLuca

  • Rookie
  • ***
  • Posts: 18
    • View Profile
Re: Soldier Stat Increase System: ABILITY_SPEED
« Reply #5 on: April 16, 2012, 10:48:53 am »
Hi, Just finished playing through a complete game (to end of first alien base anyway) on 2.5 dev 1A-32 Mar 18 (Windows 7). TU's on one char increased from 31 early on to 32 after about 50 missions (speed went from 20 to 28 over this period). With Nanocomp armour he has 30 TU.
It would therefore appear that TU ARE increasing (albeit slowly) and ARE penalised for Nanocomp.
What I would say though, is that I feel there should be a more significant TU increase over the course of 50 missions. Perhaps decreasing the start TU's by a few and increasing the effect of speed increase (even 1 to 1) would be better?