Author Topic: [STAT TRACKING] Soldier Diaries 1.0  (Read 616549 times)

Offline BetterBite

  • Squaddie
  • *
  • Posts: 9
    • View Profile
Re: [STAT TRACKING] Soldier Diaries 1.0
« Reply #1110 on: March 26, 2016, 11:30:05 pm »
I did a reset on my PC due to another problem.
Meaning everything is fresh and new.
Theres 1 thing I dont quite understand.
Since the Mod comes with the looks of being a diffirent OpenXcom
What I did
Move All .dll's and .exe of Open Xcom folder into a backup.
Move the Latest 1.0 legacy into the empty OpenXcom Folder.
Thats basicly how I did it and how it crashed

Offline ivandogovich

  • Commander
  • *****
  • Posts: 2381
  • X-Com Afficionado
    • View Profile
    • Ivan Dogovich Youtube
Re: [STAT TRACKING] Soldier Diaries 1.0
« Reply #1111 on: March 26, 2016, 11:51:34 pm »
You will need to install a Nightly Version for this to work.  I'm not sure, but it sounds a bit like you just have the 1.0 Milestone version from 2014.

https://openxcom.org/git-builds/
https://www.ufopaedia.org/index.php?title=Installation_FAQ_(OpenXcom)

Offline Countdown

  • Colonel
  • ****
  • Posts: 246
    • View Profile
Re: [STAT TRACKING] Soldier Diaries 1.0
« Reply #1112 on: March 27, 2016, 11:47:41 am »
@Shoes: Thank you for the detailed response to my post(s). I've been having a TON of fun using the commendations mod, so I hope my posts didn't come across as complaining, just trying to help fix the issues I came across.

As others have said (thanks guys!), "Improvisation" is the logic not knowing what happened. You can modify the string in your files to read something more appropriate; I was being a little cheeky when I decided on that term!
Personally I think "improvisation" is the perfect word for it. If blowing up a cyberdisc to kill the two sectoids standing nearby isn't "improvisation" I don't know what is! ;D

Regarding cause of death: I think that's only used in the 'fallen soldiers' screen after missions. Come to think of it, it should probably show up in the memorial screen too.
This would be a cool addition to the memorial screen.

I have an old running list of bugs and things I want to look at here : https://gist.github.com/Shoes01/3af40f402d287ae9c229. I have myself the note "MAJOR BUG: The last entry in a the kill "and" criteria is the only one being looked at." pinned as the bug responsible for commendations like Mercy Cross and Taking Names being awarded incorrectly. It's a public gist, so feel free to add comments below about other things I need to look at; it's much cleaner than skimming through discussions in this thread :)
Very good, if I come across something you don't have I'll add a comment. Looks like you are already aware of most of what I've found and you also have some cool ideas in there. I'd be happy to help if you need any, but my C++ knowledge is next to nil (I only know PHP). I'm getting pretty good at tinkering with the rulesets and save files though. ::)

Mind Control commendations were some of the last ones added, so they got the least amount of testing. The main profile screen uses vanilla XCOM code to track kills, I decided not to touch that in an effort to minimize code impact; vanilla XCOM did not give you kills for MC kills, it seems. I do though; they are tracked as slaveKills or something. Killing an MC with an MC is untested; I didn't think of that. When you say "mission screen", do you mean the little popup that reads time of day, alien race, etc; or do you mean the debriefing screen at the end of a mission? If it's the latter, that's vanilla code. If it's the former, then I am surprised that it's in one part but not another. I will add it to my list of things todo!

** edit: I reread what you were saying, and the mission popup only lists the total kills for that mission; it won't list the total kills over the soldier's career. I will still look into it to see if it's somehow overlooking certain kill types.
Yes, I meant the "little popup that reads time of day, etc". The little mission popup will count a kill if you MCed an alien to kill another MCed alien. But those kills will NOT count on the overall career kills at the bottom in the "combat" section. In the save file I attached the only soldier with kills has "1 kill" in the combat section, even though his mission pop-up has 5 kills and it shows he neutralized (in this case killed) several with a plasma rifle.

Hope that made sense.

By design, it's only the profile screen that has vanilla code, and will be different from the rest of the diary. However, come to think of it, since the stat tracking is now 'official', I suppose the three place should indeed be consistent. I am going to add myself a note to fix that too. **
This is understandable since the profile screen is vanilla code. I agree though that since stat tracking is now "official" they should be consistent.

You're covering a lot of corner cases with MC kills, so I am not sure how my "last to hit an alien gets the kill credit" and "I am an MC slave and I killed myself" interact with eachother. Does the MCer get the kill, the last soldier that happened to hit the MCd? This also seems related to your bug. The two systems might be conflicting with eachother.
Yeah it's confusing. In my case it was weird that the bug only happened with one soldier where as the rest got proper credit. If it was a "last to hit an alien" issue, you'd think it'd affect all soldiers. Now that I've started to become familiar with how this data is tracked in the save files, I'll play around with it and see if I can determine exactly where it's going wrong. You are right that these are pretty rare cases, so not worth losing a lot of sleep over.


Thanks again for all your work.

Offline Shoes

  • Commander
  • *****
  • Posts: 502
    • View Profile
Re: [STAT TRACKING] Soldier Diaries 1.0
« Reply #1113 on: March 28, 2016, 02:34:21 am »
I am happy you're enjoying it! I always like talking about it :3

I chatted up the devs and they're fine with the kill counts being different in the soldier info screen and in the diary. You could think of it as "direct kills" in the info screen, and "in/direct kills" in the diary. I'll have to make sure the mini mission info screen and the diary kill count talk to each other though.

edit: I've taken a closer look at how kills are awarded regarding mind controls. The way I figured out who MC'd who had a fault: I looked at who "shot" the alien last. If you MC an alien, and then he gets shot, I no longer know who controlled the alien. I am going to fix that! Regarding the mission info screen being different: they shouldn't really be... I don't directly save how many kills were done on a mission, so the mission info screen has to recount it. It looks at how many aliens are STATUS_DEAD, however, that's also how the soldier kill total at the bottom of the diary screen is calculated too. So if they're not the same, that's gonna be tricky!

edit2: I took a look at the weird bug you saw, and have found the probable cause. I don't "care" if units MC or stun an alien repeatedly, I count the first one and I am done. So if A mcs X, then B mcs X, then A mcs again again, B is still the mcer because I stopped caring about A. If that makes sense ;p I will have to delete the entries and add the 'latest' ones instead.

edit3: PR has been sent. https://github.com/SupSuper/OpenXcom/pull/1089
« Last Edit: March 28, 2016, 05:05:37 am by Shoes »

Offline Countdown

  • Colonel
  • ****
  • Posts: 246
    • View Profile
Re: [STAT TRACKING] Soldier Diaries 1.0
« Reply #1114 on: March 31, 2016, 06:13:03 pm »
I chatted up the devs and they're fine with the kill counts being different in the soldier info screen and in the diary. You could think of it as "direct kills" in the info screen, and "in/direct kills" in the diary. I'll have to make sure the mini mission info screen and the diary kill count talk to each other though.
Sounds good and yeah, that makes sense. I was thinking about it after posting and thought changing the soldier info screen kills to include MC kills might be getting too far away from vanilla since the original never counted MC kills. I like the "direct" vs "indirect" thought process.

edit: I've taken a closer look at how kills are awarded regarding mind controls. The way I figured out who MC'd who had a fault: I looked at who "shot" the alien last. If you MC an alien, and then he gets shot, I no longer know who controlled the alien. I am going to fix that!

edit2: I took a look at the weird bug you saw, and have found the probable cause. I don't "care" if units MC or stun an alien repeatedly, I count the first one and I am done. So if A mcs X, then B mcs X, then A mcs again again, B is still the mcer because I stopped caring about A. If that makes sense ;p I will have to delete the entries and add the 'latest' ones instead.

edit3: PR has been sent. https://github.com/SupSuper/OpenXcom/pull/1089
Thanks for figuring all that out. When I did my original playing with it I wasn't using the commendations mod, but once I started using commendations the MC issue became more apparent/easier to understand as soldiers who had never even used a psi amp were getting "master of puppets" because they would kill an alien who was under XCOM control (and that alien had just thrown a grenade at a non-MCed alien). So they would essentially get credit for another soldier's MC kill. I've actually enjoyed going through the save files and figuring out how all this was calculated.

Regarding the mission info screen being different: they shouldn't really be... I don't directly save how many kills were done on a mission, so the mission info screen has to recount it. It looks at how many aliens are STATUS_DEAD, however, that's also how the soldier kill total at the bottom of the diary screen is calculated too. So if they're not the same, that's gonna be tricky!
I'm not sure based on the above, but are you saying you did or didn't figure this part out?

Looking at the save files, I'm pretty sure actually the kill total in the diary on the bottom is directly saved as "killTotal" in the save files, while the mission pop ups are recounted live as you describe above. So the problem is occurring in-mission when the kill isn't assigned to the soldier who say, had their MCed alien commit suicide with a grenade. Normally when a soldier gets a kill, the in-mission save file counts it as one "kill" and then adds it to their diary total at mission's end. But when you kill an MCed alien (or have one commit suicide) the kill is listed (weapon, alien race, etc) but it isn't added to their in-mission kill count. That causes the discrepancy. If you're PR above fixes that then, the discrepancy issue will be solved.

Offline Xeno Wiper

  • Sergeant
  • **
  • Posts: 45
    • View Profile
Re: [STAT TRACKING] Soldier Diaries 1.0
« Reply #1115 on: April 02, 2016, 01:12:16 am »

edit2: I took a look at the weird bug you saw, and have found the probable cause. I don't "care" if units MC or stun an alien repeatedly, I count the first one and I am done. So if A mcs X, then B mcs X, then A mcs again again, B is still the mcer because I stopped caring about A. If that makes sense ;p I will have to delete the entries and add the 'latest' ones instead.


Sry, but that didn't make sense at all. Idk why haven't you gone with the latest ones from the beginning.

Last time I saw, you can't MC again an already MCed alien on the same turn with different people. So why not go with the latest?

Offline Shoes

  • Commander
  • *****
  • Posts: 502
    • View Profile
Re: [STAT TRACKING] Soldier Diaries 1.0
« Reply #1116 on: April 02, 2016, 03:00:19 pm »
Sry, but that didn't make sense at all. Idk why haven't you gone with the latest ones from the beginning.

Last time I saw, you can't MC again an already MCed alien on the same turn with different people. So why not go with the latest?

I meant after the MC wears off. So that's why I've fixed; the last person to MC gets credit (regardless if they've MCd them before, which was the bug).

I'm not sure based on the above, but are you saying you did or didn't figure this part out?

Looking at the save files, I'm pretty sure actually the kill total in the diary on the bottom is directly saved as "killTotal" in the save files, while the mission pop ups are recounted live as you describe above. So the problem is occurring in-mission when the kill isn't assigned to the soldier who say, had their MCed alien commit suicide with a grenade. Normally when a soldier gets a kill, the in-mission save file counts it as one "kill" and then adds it to their diary total at mission's end. But when you kill an MCed alien (or have one commit suicide) the kill is listed (weapon, alien race, etc) but it isn't added to their in-mission kill count. That causes the discrepancy. If you're PR above fixes that then, the discrepancy issue will be solved.

If it's not added to the list, then it shouldn't be showing up in either total. I am starting to reorganize how I save stuff to reduce save bloat, so that might touch on this bug.

If it's really not being added to the list, then that's a bug too.

Offline Countdown

  • Colonel
  • ****
  • Posts: 246
    • View Profile
Re: [STAT TRACKING] Soldier Diaries 1.0
« Reply #1117 on: April 03, 2016, 09:21:35 am »
Shoes,

Kudos on fixing that MC bug. I re-loaded my bug test saves and everything seems to work correctly. No misappropriated MC kills or MC medals. Well done.

I also really like the addition of the arrow buttons to go from mission to mission in a soldier’s diary. Very convenient. And the accuracy stat should be a fun thing to track as well.

If it's not added to the list, then it shouldn't be showing up in either total. I am starting to reorganize how I save stuff to reduce save bloat, so that might touch on this bug.

If it's really not being added to the list, then that's a bug too.

As you said, this was a separate bug not corrected by your latest fix. The mission lists are fine, it’s simply a numerical error. Since I don’t think I’ve done a good job explaining what happens, I think it’s easier just to show you. See the save file code and screen shots below. I had two soldiers get a kill demonstrating the bug and then a standard kill to show the difference.

Soldier 3 MCed a Floater and had it kill itself with a grenade.

Post-Mission Save File (my comments in #RED):
Spoiler:
     
      - type: STR_SOLDIER
        name: 3
        diary:
          killList:
            - weapon: STR_PSI_AMP #MC
              rank: STR_LIVE_SOLDIER
              type: STR_FLOATER_SOLDIER
              race: STR_FLOATER
              weaponAmmo: STR_PSI_AMP
              bodypart: 0
              mission: 9
              id: 1000000
              faction: 1
              status: 3
              turn: 2703
              side: 0
            - race: STR_FLOATER #MC SUICIDE
              weapon: STR_ALIEN_GRENADE
              type: STR_FLOATER_SOLDIER
              rank: STR_LIVE_SOLDIER
              weaponAmmo: STR_ALIEN_GRENADE
              mission: 9
              id: 1000000
              status: 6
              faction: 0 #FRIENDLY FACTION
              turn: 2703
              side: 4
              bodypart: 1
            - type: STR_FLOATER_SOLDIER #REGULAR NON-MC KILL
              rank: STR_LIVE_SOLDIER
              race: STR_FLOATER
              weapon: STR_RIFLE
              bodypart: 1
              mission: 9
              side: 0
              turn: 2706
              id: 1000002
              weaponAmmo: STR_RIFLE_CLIP
              status: 6
              faction: 1 #HOSTILE FACTION
          killTotal: 1 #SHOULD BE 2
         
Diary Screen Shots (image also attached in case not clear):


Soldier 6 killed a Floater who was MCed by another soldier.

Post-Mission Save File (my comments in #RED):
Spoiler:
     
      - type: STR_SOLDIER
        name: 6   
        diary:
          killList:
            - weaponAmmo: STR_RIFLE_CLIP #KILLED ALIEN WHO WAS UNDER MC BY ANOTHER SOLDIER
              rank: STR_LIVE_SOLDIER
              type: STR_FLOATER_SOLDIER
              weapon: STR_RIFLE
              status: 6
              race: STR_FLOATER
              turn: 2703
              mission: 9
              faction: 0 #FRIENDLY FACTION
              id: 1000004
              side: 3
              bodypart: 1
            - type: STR_FLOATER_MEDIC #STANDARD NON-MC KILL
              race: STR_FLOATER
              weapon: STR_RIFLE
              weaponAmmo: STR_RIFLE_CLIP
              rank: STR_LIVE_MEDIC
              side: 1
              mission: 9
              turn: 2706
              bodypart: 3
              id: 1000007
              status: 6
              faction: 1 #HOSTILE FACTION
          killTotal: 1 #SHOULD BE 2
Diary Screen Shots:


I don’t know how exactly everything is tracked, but if I had to guess I would assume it is an issue with the “faction” number since the alien is in the “friendly” faction rather than “hostile” at the time of its death. This also leads to soldiers getting a kill or stun count in their diary for killing or stunning a fellow soldier who is under alien control (not sure if that part was intended or not).

A possible solution could be to use the "originalFaction" property rather than "currentFaction" as Warboy explained to me once here:

we store a byte for "originalFaction" and another for "currentFaction", and treat any difference between the two as our "mind controlled" flag.

Again, great work with the latest update.
« Last Edit: April 03, 2016, 09:34:06 am by Countdown3 »

Offline Shoes

  • Commander
  • *****
  • Posts: 502
    • View Profile
Re: [STAT TRACKING] Soldier Diaries 1.0
« Reply #1118 on: April 03, 2016, 03:53:25 pm »
Yeah, you're definitely right that it has to do with the faction. In the Mission window, I am only checking to see if the unit is dead, whereas in the kill total I look to see if the unit is dead and was an enemy.

So, given the OriginalFaction and CurrentFaction, there are four possibilities: OF = 0 && CF == 0 (is and always was a friendly), OF == 0 && CF == 1 (aliens MCed your guy), OF == 1 && CF == 0 (you MCed an alien) and OF == 1 && CF == 1 (is and always was the enemy).

What I will do is this: only OF == 1 will count in kill totals. The XCOM reason will be because 0/1 (MCed soldier) kills are never celebrated. 0/0s are obviously accidents. The real reason is because I am only tracking one faction in the kills, so I will make it the OF and not the CF ;p

In the Mission window, I will continue to list all kills, but I will only increment the kill counter for OF == 1 kills. It will be weird, but likely obvious too. "This guy killed 2 aliens and 5 civilians, but only has two kills to his credit???"; should be easy to figure out why ;p The Diary already uses Faction == 1 kills, so I will now make sure it is OF and not CF.

Thanks again! It's much easier to fix when I'm clearly given the bug!

Offline Countdown

  • Colonel
  • ****
  • Posts: 246
    • View Profile
Re: [STAT TRACKING] Soldier Diaries 1.0
« Reply #1119 on: April 03, 2016, 05:05:44 pm »
That all sounds great! Sorry it took so many posts for me to explain the bug clearly. If there is a next time I'll just skip to the pictures, haha.

And I agree with the XCOM reasoning anyway that killing an MCed soldier shouldn't be counted (celebrated). Sounds like that should be a relatively simple fix.

As far as the Mission Window, yeah I never thought it mattered much either way whether you counted the "friendly/neutral" kills there or not. If I saw 2 alien kills and 5 civilians and 7 total, it was always clear to me that those 5 weren't counting towards my total in the bottom of the diary. As you say, if you change it and we see the same thing and only 2 kills in the Mission Window, it's obvious why. Both seem like reasonable options to me since you have the list right in front of you.


Fun Fact: The original vanilla kill counter (on the soldier stat screen) DOES count friendly kills (regardless if they were MCed or not) and civilian kills. Guess the original game designers didn't care if you were a raving mad man shooting your squadmates and innocent bystanders. A kill is a kill in their book code.  ;)
« Last Edit: April 03, 2016, 05:08:26 pm by Countdown3 »

Offline Xeno Wiper

  • Sergeant
  • **
  • Posts: 45
    • View Profile
Re: [STAT TRACKING] Soldier Diaries 1.0
« Reply #1120 on: April 06, 2016, 02:03:48 am »
Sry, but that didn't make sense at all. Idk why haven't you gone with the latest ones from the beginning.

Last time I saw, you can't MC again an already MCed alien on the same turn with different people. So why not go with the latest?


I meant after the MC wears off. So that's why I've fixed; the last person to MC gets credit (regardless if they've MCd them before, which was the bug).



I was trying to imagine a scenario where your old logic could work.... but couldn't... It was just too messy.


I wonder if it was an oversight or a concept fail. But, whatever, at least it's fixed now.

Offline Shoes

  • Commander
  • *****
  • Posts: 502
    • View Profile
Re: [STAT TRACKING] Soldier Diaries 1.0
« Reply #1121 on: April 06, 2016, 05:27:25 pm »


I was trying to imagine a scenario where your old logic could work.... but couldn't... It was just too messy.


I wonder if it was an oversight or a concept fail. But, whatever, at least it's fixed now.

Oversight ;) I was trying to prevent a play from being able to "farm" MC stats, but then for some reason grouped the "I was the last person to MC this alien" piece of code in with the anti-duplication code.

Offline Countdown

  • Colonel
  • ****
  • Posts: 246
    • View Profile
Re: [STAT TRACKING] Soldier Diaries 1.0
« Reply #1122 on: April 07, 2016, 04:51:02 am »
So if you're using the Commendations mod, I noticed the "Sapper Medal" and "Metal Menace Citation" weren't working. Easy fix in the ruleset to make it work. Delete the "_TERRORIST" part off of "CYBERDISC TERRORIST" and "SECTOPOD_TERRORIST". See the code below.

Code: [Select]
  - type: STR_MEDAL_SAPPER_NAME
    description: STR_MEDAL_SAPPER_DESCRIPTION
    sprite: 33
    criteria:
      killsWithCriteriaCareer: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
    killCriteria:
      -
        1: ["STR_SECTOPOD", "STR_LIVE_TERRORIST", "STATUS_DEAD", "BT_GRENADE"]
      -
        1: ["STR_CYBERDISC", "STR_LIVE_TERRORIST", "STATUS_DEAD", "BT_GRENADE"]
       
        #took "TERRORIST" off of "SECTOPOD" and "CYBERDISC"

  - type: STR_MEDAL_SECTOPOD_KILL_MEDAL_NAME
    description: STR_MEDAL_SECTOPOD_KILL_MEDAL_DESCRIPTION
    sprite: 34
    criteria:
      killsWithCriteriaCareer: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
    killCriteria:
      -
        1: ["STR_SECTOPOD", "FACTION_HOSTILE", "STATUS_DEAD"]
           
       #changed "STR_SECTOPOD_TERRORIST" to "STR_SECTOPOD"

UPDATED: Also, for the description on the sectopod medal you need to make it say: "STR_MEDAL_SECTOPOD_KILL_MEDAL_DESCRIPTION". In the current ruleset it only says "STR_SECTOPOD_KILL_MEDAL_DESCRIPTION" which leads to there being no description on the award section of a soldier's diary.
« Last Edit: April 07, 2016, 06:52:53 am by Countdown »

Offline g5-freemen

  • Captain
  • ***
  • Posts: 75
    • View Profile
Re: [STAT TRACKING] Soldier Diaries 1.0
« Reply #1123 on: April 11, 2016, 01:51:36 pm »
maybe i download old version, but there is a bug in Commendations.rul

    section: STR_HEAVY_5WEAPONS_PLATFORMS
__>>
    section: STR_HEAVY_WEAPONS_PLATFORMS



And why some medals translated to russian, but only 10-20% ?

Offline Shoes

  • Commander
  • *****
  • Posts: 502
    • View Profile
Re: [STAT TRACKING] Soldier Diaries 1.0
« Reply #1124 on: April 11, 2016, 05:27:23 pm »
Thanks for these two finds, I'll try to find time to get those fixed. Busy week ahead of me!