FAForever Forums
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Login

    About the veterancy system

    Scheduled Pinned Locked Moved Balance Discussion
    88 Posts 35 Posters 9.0k Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • JipJ Offline
      Jip
      last edited by Jip

      The veterancy system as we know it was introduced in 2017. It replaced the vanilla system that only took into account the final blow on a unit. There are some issues with the implementation however and I'd like to discuss that.

      The system operates by adding logic when damage is applied to a unit. It performs the following operations:

      • Compute the damage, excluding overkill if present.
      • Keep track of the damage and the instigator at the receivers end, involving tables.

      And when the unit is destroyed it performs the following operations:

      • Disperse the damage dealt on a per-instigator basis.

      The only logic applied when a unit was damaged pre 2017 was just subtracting the damage and checking whether it should die or not.

      There are two problems with this approach:

      • When damage is received it involves a table allocation. Tables need memory on the heap. Heap memory is expensive to allocate.
      • When a unit dies it disperses the damage, essentially updating random pieces of memory. When performing random calls the item you're looking for is not in the cache. When it isn't in the cache it is expensive.

      To provide more rational:

      • With the veterancy system applied, a 200 on 200 ASF fight will slow down the game from +10 (when the asf are doing nothing) to +5 at the start.
      • Without the veterancy system applied, a 200 on 200 ASF fight will slow down the game from +10 (when the asf are doing nothing) to +8 at the start.

      After discussing it the impact is a lot smaller than I originally tested. See also this, this and this post. It is roughly at most 1 sim speed.

      Imagine units fighting all over the board in general and don't forget about damage over time (DOT). All of these calculations have a massive impact on the sim - which is exactly why a lot of games at some point run at -1, instead of 0 or 1 and that is the golden threshold of 'this game is slow' and 'nice'.

      My question to everyone reading this: is it really worth it?

      These are the solutions I propose, but feel free to suggest your own:

      • (0) We keep it as is and take the sim loss for granted.
      • (1) We keep the system but limit it to only a select few units that get to have veterancy.
      • (2) We keep the system but we provide the veterancy when the damage is applied, instead of when the unit dies. This prevents table allocations.
      • (3) We go back to the 'on-kill' notion, where the killer takes the mass value of the killee. This prevents table allocations.
      • (4) We go back to the original system: one point per kill. This prevents table allocations.
      • (5) We remove the system as a whole. No system is no allocations.

      Note that option (1) is not a solution, it is a hack. The burden to track who gets veterancy is on the unit that takes damage, not the damage dealer. Therefore all units would still need to check on every damage instance whether they should track the damage dealt and disperse it accordingly when they die. They just 'skip' some units that we think don't matter.

      In my opinion (2) is not far off from what we have at the moment. Especially when we tune it down slightly to take into account that a unit can be repaired / regenerated.

      A work of art is never finished, merely abandoned

      Anachronism_A E 2 Replies Last reply Reply Quote 2
      • UvesoU Offline
        Uveso
        last edited by

        option 2.

        using the amount of damage says way more then just the killing hit.

        1 Reply Last reply Reply Quote 0
        • S Offline
          Sheikah
          last edited by

          I also think option 2 seems like the best option

          1 Reply Last reply Reply Quote 0
          • Anachronism_A Offline
            Anachronism_ @Jip
            last edited by

            @jip said in About the veterancy system:

            (2) We provide the veterancy when the damage is applied, instead of when the unit dies. This prevents keeping track of units.

            Keeping it as-is or doing option #2 seem like the best choices amongst the six listed above. Perhaps we should consider having both of them available as rated lobby options that people can choose from (such as they can choose between fullshare and share until death).

            pfp credit to gieb

            JipJ T 2 Replies Last reply Reply Quote 0
            • JipJ Offline
              Jip @Anachronism_
              last edited by Jip

              @emperor_penguin That would involve checking what option is set every time a unit takes damage.

              A work of art is never finished, merely abandoned

              1 Reply Last reply Reply Quote 1
              • MarcSpectorM Offline
                MarcSpector
                last edited by

                @Jip I think option 2 is good. But this option should not affect ACU and SACU. It seems that they will have some advantages under the new veterancy system.

                JipJ 1 Reply Last reply Reply Quote 0
                • JipJ Offline
                  Jip @MarcSpector
                  last edited by

                  @marcspector Could you elaborate?

                  To note: there won't be any direct change. I'll leave this topic open for a week or so to allow people to think about it. I'd like to hear from the ladder and the balance team before any action is taken anyhow.

                  A work of art is never finished, merely abandoned

                  1 Reply Last reply Reply Quote 0
                  • T Offline
                    Tagada Balance Team @Anachronism_
                    last edited by Tagada

                    If the sim speed decrease is that significant I think option 2 is the best way to go.

                    @emperor_penguin said in About the veterancy system:

                    @jip said in About the veterancy system:

                    (2) We provide the veterancy when the damage is applied, instead of when the unit dies. This prevents keeping track of units.

                    Keeping it as-is or doing option #2 seem like the best choices amongst the six listed above. Perhaps we should consider having both of them available as rated lobby options that people can choose from (such as they can choose between fullshare and share until death).

                    I don't think it's a good idea, it's gonna be a part of game patch. We don't allow people to change which balance they would like to use.

                    However this would probably be a bigger rework. Keyser was already changing the ACU veterancy and we wanted to take a look at different regen rates for different techs and types of units and adjust it so It will probably happen after SACU Rework, not sooner then 6 months probably.

                    1 Reply Last reply Reply Quote 0
                    • maudlin27M Online
                      maudlin27
                      last edited by

                      I'd prefer option 2 or option 3.
                      I'd also see this as having a benefit from a gameplay perspective (not just a performance perspective) because it always seemed counter-intuitive to me that an ACU which kills an experimental by itself gets only 1 rank of vet, whereas an ACU that kills some T2 tanks that are a fraction of the mass value can get multiple vet ranks easily. That said though, it's also slightly more intuitive that you gain veterancy when a unit dies rather than when you damage it, though I've seen RTS's that take either approach.

                      However, it would generally make veterancy more powerful, so might need some sort of slight tweak to compensate. E.g. any unit with moderate or better health that would benefit from an earlier vet would get a benefit when attacking a high health unit with a higher mass cost, such that the veterancy bonus or mass requirement might need adjusting.

                      M27AI and M28AI developer; Devlogs and more general AI development guide:
                      https://forum.faforever.com/topic/2373/ai-development-guide-and-m27ai-v71-devlog
                      https://forum.faforever.com/topic/5331/m28ai-devlog-v150

                      1 Reply Last reply Reply Quote 0
                      • arma473A Offline
                        arma473
                        last edited by

                        Separate from the question of efficiency/game speed, is the impact on gameplay of veterancy bonuses

                        A - get rid of veterancy bonuses for everything except ACUs. ACUs getting veterancy is an important part of how FAF is balanced, taking that way could cause problems

                        B - for ACUs, veterancy bonuses shouldn't restore HP equal to the amount of max HP gained. It should only restore a percentage of the health increase (equal to the ACU's % of health). E.g. if your ACU goes from 10k max HP to 11k max hp, you would gain 1k max HP of course, but you would only gain 10% of your current HP. If the ACU is at 2000 health, it would bump up to 2200. Veterancy would still be very useful for ACUs, but it wouldn't be nearly as helpful to survive a kill attempt. (in that situation, you would only get 200 hp instead of 1000)

                        That would make the game better.

                        Then after that change is implemented we could decide how much slowdown we want to accept in exchange for having veterancy tracked. Veterancy would still be useful, for example if you are watching a replay you can get a sense of how effective your units are based on how much vet they have. But we could decide if certain things need to be tweaked, like changing the way ASFs get vet to avoid that particular slowdown. We could have ASFs only get vet from delivering the killing blow on another ASF (and maybe all ASF in the vicinity get credit when an enemy T4 air unit dies for any reason).

                        Also it would be nice if SMDs and TMDs gained "vet" by shooting things down. E.g. SMDs get a vet level every time they kill a nuke and TMDs get a vet level every time they kill 100 missiles. Again the point is really just sentimental not to change gameplay.

                        And separately, it would be nice if there was a little window showing the "total mass killed" (the veterancy figure) summed up for all selected units. So if you selected 100 tanks, and you have unit selection cost UI, you can see that they cost 20k mass, and you could see that the surviving tanks had 5k mass killed, that would be pretty cool.

                        1 Reply Last reply Reply Quote 1
                        • JipJ Offline
                          Jip
                          last edited by

                          Note that having a combination of the options (e.g., an exception for the commander) will still introduce additional logic each time a unit receives damage or dies.

                          A work of art is never finished, merely abandoned

                          Dragun101D ValkiV 2 Replies Last reply Reply Quote 1
                          • S Offline
                            Softles
                            last edited by

                            I did a quick couple of tests using my custom profiler that I developed originally for testing my AI, and found that in normal conditions the % of time spend in the two veterancy functions in question did not exceed ~0.2% of total sim compute time. This test was done in a 4v4 between my AIs, which are currently very land focussed.

                            In ASF vs ASF tests I was able to get it up to at most ~2% of total sim compute time, but during the periods of negative sim speed it was at most ~0.7%.

                            ==

                            Overall my conclusion is that the rest of the sim scales worse than these veterancy functions, and they have a negligible effect most of the time. By all means feel free to change the vet system, but it probably doesn't need to be for performance reasons.

                            ==

                            Cautionary note: this method for profiling may not give completely accurate results for many calls of a low cost function due to the error associated with getting system time and the precision of system time provided. If anyone wants to jump in and check how these errors might have affected it go right ahead 🙂

                            For completeness, a link to my profiling code and my hook of the Unit class for testing:

                            YeOldeUnitThingy = Unit
                            
                            local PROFILER = import('/mods/DilliDalli/lua/AI/DilliDalli/Profiler.lua').GetProfiler()
                            
                            Unit = Class(YeOldeUnitThingy) {
                                VeterancyDispersal = function(self, suicide)
                                    local start = PROFILER:Now()
                                    YeOldeUnitThingy.VeterancyDispersal(self, suicide)
                                    PROFILER:Add("VeterancyDispersal",PROFILER:Now()-start)
                                end,
                                
                                DoTakeDamage = function(self, instigator, amount, vector, damageType)
                                    local start = PROFILER:Now()
                                    YeOldeUnitThingy.DoTakeDamage(self, instigator, amount, vector, damageType)
                                    PROFILER:Add("DoTakeDamage",PROFILER:Now()-start)
                                end,
                            }
                            

                            Some output from tests:

                            4v4 AI match, ~15 mins ~1k units on the map:
                            info: Time per game second:0.32s, Top Costs: DoTakeDamage-0.16%, VeterancyDispersal-0.01%, 
                            info: Time per game second:0.34s, Top Costs: DoTakeDamage-0.14%, VeterancyDispersal-0.02%,
                            info: Time per game second:0.31s, Top Costs: DoTakeDamage-0.15%, VeterancyDispersal-0.01%, 
                            
                            100 vs 100 ASF:
                            INFO: Time per game second:0.17s, Top Costs: DoTakeDamage-0.65%, VeterancyDispersal-0.09%, 
                            INFO: Time per game second:0.17s, Top Costs: DoTakeDamage-0.97%, VeterancyDispersal-0.11%, 
                            INFO: Time per game second:0.17s, Top Costs: DoTakeDamage-0.75%, VeterancyDispersal-0.11%, 
                            INFO: Time per game second:0.17s, Top Costs: DoTakeDamage-0.58%, VeterancyDispersal-0.11%,
                            
                            1000 vs 1000 ASF:
                            INFO: Time per game second:17.49s, Top Costs: DoTakeDamage-0.14%, VeterancyDispersal-0.00%, 
                            INFO: Time per game second:4.23s, Top Costs: DoTakeDamage-0.24%, VeterancyDispersal-0.02%, 
                            INFO: Time per game second:2.60s, Top Costs: DoTakeDamage-0.47%, VeterancyDispersal-0.06%, 
                            INFO: Time per game second:1.98s, Top Costs: DoTakeDamage-0.71%, VeterancyDispersal-0.09%, 
                            INFO: Time per game second:1.26s, Top Costs: DoTakeDamage-1.17%, VeterancyDispersal-0.14%, 
                            INFO: Time per game second:0.92s, Top Costs: DoTakeDamage-1.07%, VeterancyDispersal-0.16%, 
                            INFO: Time per game second:0.59s, Top Costs: DoTakeDamage-2.25%, VeterancyDispersal-0.15%, 
                            INFO: Time per game second:0.44s, Top Costs: DoTakeDamage-1.25%, VeterancyDispersal-0.18%,
                            
                            1 Reply Last reply Reply Quote 7
                            • Dragun101D Offline
                              Dragun101 @Jip
                              last edited by

                              @jip

                              Veterancy is last I checked defined in Unit BP

                              I’m a shitty 1k Global. Any balance or gameplay suggestions should be understood or taken as such.

                              Project Head and current Owner/Manager of SCTA Project

                              1 Reply Last reply Reply Quote 0
                              • FtXCommandoF Offline
                                FtXCommando
                                last edited by

                                As Softles posted, this topic was looked into a year ago or so and it was found that the vet system has some relevant impact in essentially massive 400 v 400 asf fights and likely resulted in an additional 1 or 2 decrease in sim speed there. The rest of the game didn’t really see much impact from it at all.

                                1 Reply Last reply Reply Quote 0
                                • ValkiV Offline
                                  Valki @Jip
                                  last edited by

                                  @jip said in About the veterancy system:

                                  Note that having a combination of the options (e.g., an exception for the commander) will still introduce additional logic each time a unit receives damage or dies.

                                  Can't you put it on the attacking unit? When you have few units that participate in veterancy. Could it be a weapon property that a weapon increases the attacking units veterancy mass score if it scores a kill?

                                  1 Reply Last reply Reply Quote 0
                                  • C Offline
                                    cablefast
                                    last edited by cablefast

                                    I like option 2 the most.

                                    Didn't see it listed so figured I'd throw out an alternative idea. Unit age = veterancy. As in a unit that lives 2:00 minutes gets it's first vet, and maybe 5:00 minutes is the second vet, and so on.... Seems computational simple and would encourage players to keep units alive.

                                    1 Reply Last reply Reply Quote 0
                                    • KaletheQuickK Offline
                                      KaletheQuick
                                      last edited by

                                      Option 2 seems workable.

                                      Though as FtXCommando mentioned, the impact of veterancy on gameplay in general is so small. A whole force of veterans will beat an equal force of recruits, but TBH that feels like it. That is outside the topic here though.

                                      You must deceive the enemy, sometimes your allies, but you must always deceive yourself!

                                      T 1 Reply Last reply Reply Quote 0
                                      • T Offline
                                        Tagada Balance Team @KaletheQuick
                                        last edited by

                                        @kalethequick said in About the veterancy system:

                                        Option 2 seems workable.

                                        Though as FtXCommando mentioned, the impact of veterancy on gameplay in general is so small. A whole force of veterans will beat an equal force of recruits, but TBH that feels like it. That is outside the topic here though.

                                        Ftx was referring to vet system's impact on sim speed, not gameplay.

                                        1 Reply Last reply Reply Quote 1
                                        • JipJ Offline
                                          Jip
                                          last edited by

                                          After some further testing with 200 on 200, 300 on 300 and 400 on 400 ASFs fighting each other I can not reproduce my original results. Currently I have a reliable sim difference of at most 1 with 300 on 300 ASFs and beyond.

                                          I've also tried to experiment with damage over time using T1 UEF bombers. In the test I had 100 bombers firing at a Megalith. that resulted in a sim computation difference of ~10.2ms at peak (without) to ~10.4ms at peak (with). Three runs for each. It isn't significant, quite minor. In both cases it aligns with what Ftx and Softles stated.

                                          I'm updating the original post as I consider it misleading at this point. Not sure what happened when I tested before, maybe a background program (World Machine, hurr) interfered with it.

                                          A work of art is never finished, merely abandoned

                                          1 Reply Last reply Reply Quote 4
                                          • I Offline
                                            IceDreamer Banned
                                            last edited by

                                            I designed the current system, and gotta say I like the sound of option 2. Wish I'd thought of that. It's not quite the same, as it means the distribution of damage from units which regen or get repaired shifts, but tbh that is so ridiculously uncommon I was wrong to take it into account. The cost of the table lookups probably isn't worth it.

                                            xp = (damageDealt / MaxHP) * massCost should do the trick. Probably doable in about 20 minutes by anyone familiar with unit.lua.

                                            JipJ 1 Reply Last reply Reply Quote 1
                                            • First post
                                              Last post