How does Keshik gold generation ability work? (An attempt to explore it)

How does Keshik gold generation ability work? (An attempt to explore it)

After a recent Spirit of the Law video on Keshik, another trivia question that almost makes no real sense dawned upon me: how does Keshik gold generation ability actually work? How can gold generation be calculated?

There’s already gold generation rate mentioned by Spirit of the Law and in AoE Wikia): 0.363 ('~21.8 gold / min') or 0.367 gold / sec, respectively. SotL even mentioned 1 gold is generated roughly every 2 attack animations of Keshik, or once every 2.8 seconds (~0.357 gold / sec). Case closed, no more info is needed for any practical purpose. I have big problems with practicality, though.

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯

In Advanced Genie Editor (AGE; available in ‘Tools_Builds’ folder of your root AoE 2: DE folder), section ‘Units’, line ‘1228 - Keshik’ you can find ‘Tasks’ section. There you can see ‘HD 151: Feitoria Ability’ for every unit class in the game (see the screenshot below; I wish I knew how to resize images here).

https://preview.redd.it/pagf9glkpt051.png?width=960&format=png&auto=webp&s=08e975eddfc661229b26d133b35d776f283d0b4d

Here, work rate is 0.01; resource 213 is mentioned as well. In ‘Civilizations’ section, every civ (not only the Tatars) has its value set to 50 (see another screenshot below). (This could be the reason of a 'bug' where Keshiks did not generate gold if converted.)

https://preview.redd.it/35gyx0mlpt051.png?width=960&format=png&auto=webp&s=44543f8a1f316ce39f27eb07b609f63c03505471

Additionally, we can obtain Keshik’s attack speed (which is 1.9 sec; section ‘Units’) and Keshik’s attack animation duration (1.4 sec; section ‘Graphics’, line ‘10399 - Keshik (Attack)’). This is everything I can think of that could affect the generation rate. Well, from coded values department at least.

Then, I observed the rate with which Keshik generates gold while fighting both stationary and fleeing unit with modified (amplified) gold generation rate. (I changed resource 213 value from 50 to 5000.) It appeared to be close to 70 gold per hit, or, if we downscale it using genuine coded value, 0.7 gold per hit. That led me to a thought that Keshik actually ‘works’ its target (as if it were a resource) with the work rate of 0.01 gold / sec (see the first screenshot, field work value 1) multiplied by resource 213 value (by analogy with how Mayans/Tatars resource gathering civ bonuses work, with their nerfed work rates being multiplied by buffed resource productivity) and further multiplied by attack animation length of 1.4 sec; or: 0.01 (work rate, resource per second) × 50 (productivity multiplier) × 1.4 (attack animation, sec) = 0.7 (gold / sec). Or, if you prefer a formula style:

Gold generation per hit = Work Rate × Resource Productivity (Resource 213) × t(attack animation). 

Using attack reload speed of Keshik (1.9 sec), we receive a rate of 0.7 / 1.9 = ~0.368 gold / sec.

If no final hit is inflicted (e. g. Keshik dies in a fight), looting value (total gold collected by Keshik while 'farming' a target) is roughly 0.7 times number of hits inflicted. For fleeing targets, their looting value is 0.7 × (x–0.5), with x being hits-to-kill and 0.5 subtracted to take final hit into account (damage is inflicted at 50% of every hit attack animation duration for an initial hit for a stationary target and every hit for a fleeing target; gold generation immediatly stops when the victim dies).

The calculations are still theoretical at this point; in reality, a deviation between this predicted 0.7 gold per hit and actually observed gold generation exists. This was already called out in an ‘old’ SotL video to be caused by existing mismatch between attack speed and attack animation duration of the unit.

Watching through a single recording of a Keshik ‘farming’ a stationary target (×1.0 game speed, ~270 FPS, 60 FPS recording) reveals that the start of gold generating cycle always corresponds to 1.9 sec time frames starting from the beggining of the first attack animation, i. e. ignoring initial attack delay of 0.7 sec. (These 1.9 sec time frames experience a slight build-up of residuals with increasing number of hits, up to 0.15 sec after 10 hits.) Although periodicity of these cycles matches the attack speed of the unit, these time frames do not correspond to actual hits (when the damage is inflicted) due to two reasons:

  • first, initial hit is inflicted using melee attack delay of 0.7 sec in any case, stationary or fleeing;
  • second, observed attack speed (time frames between each hit inflicts damage) against a stationary target is a combination of 1.4 and 2.1 second time frames which average on ~1.866… sec (or even 1.75 sec if the first hit is taken into account) vs 1.9 sec coded value.
    I tested some other attack animation durations (namely 1.2, 1.25, 1.3 and 1.55 and 1.6 sec) while not modifying attack speed: in all scenarios, game was trying to match attack speed with attack animation duration, although using different techniques (1 and 1.5× time frames for 1.2, 1.3, 1.55 and 1.6 sec and a single repetitive time frame of 1.875 sec for 1.25 sec animation duration). If just resampling of attack speed to match attack animation durations is actually occurring in any/most of the cases in game, then it reveals how important attack animation duration actually is.

The second factor does impact Keshik’s gold generation as well. The end of the gold generating cycle precedes the start of a new attack animation by one frame (at least in 60 FPS recording), unless current attack speed time frame is 1.4 sec (in that case, gold generation does not stop).

(I wish I could graphically present all the info above to make things clear, but sadly, I’m even worse in drawing than in maths or explaining.)

Observed rates are further a subject to minor discrepancies caused by game speed and internal framerate. I believe these factors to be a prime reason of a mentioned build-up of 0.15 seconds and resulting attack speed being 1.86… sec instead of 1.9 sec (though the latter can originate from the game forecasting attack speeds in a far away future).

I ran a simple test for a stationary and a fleeing target where Keshik was able to kill the victim in 10 hits. For the former, five samples of different framerates (20, 30, 47, 60 and ‘unrestricted’ (~270 in my case) FPS) for ×1.0 and ×1.7 game speeds were gathered. (47 FPS was chosen as a random prime figure; Bandicam was used as a framecap tool.) For the fleeing target, only a single run result was recorded as I previously observed them to be more stable in nature (they are not affected by attack speed at all). These are the values I received (sorry for an image, not an actual table):

Game speed and framerate impact on Keshik's gold generation ability

I also tried to play around with attack animation duration and attack speeds a little. Indeed it resulted into modified gold collection rates and total looting value if 1.4 sec / 1.9 sec rate was broken. (E. g.: attack animation set to 1.8 sec, attack speed not modified, total looting increased from 620 to 689 (×1.0 game speed, ‘unrestricted’ framerate); setting attack animation duration to 1 sec resulted in 512 gold instead.) But not to tread on dangerous ground, I gave up on these efforts.

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯

So, to recap:

  • There is no fault in stating that Keshik generates ~0.36–0.37 gold / sec, although that’s not how this mechanic seems to have been coded to work;
  • Actually, Keshik generates 0.7 gold per hit, with 0.35 gold generated on the final blow. (At least if it is chasing a target.) The gold generation itself is tied to attack animation duration of the unit which is 1.4 sec and is determined by two variables: work rate of Keshik’s ‘feitoria ability’ and resource pool value set for every civilization. The product of the last two is 0.5 (gold / sec) that is further multiplied by attack animation duration;
  • Previous statement is what it should have looked like using the coded values only. However, the nature of AoE II attack speed mechanic is–supposedly in general, observed practically in a few cases–that it tries to match the attack animation cycles to the coded attack speed (possibly forecasting into the future to even things out in a long run). For Keshik, matters are further complicated due to the gold generation counter being tied to both attack speed and attack animation (it runs for 1.4 sec and restarts every 1.9 sec if not running already) which results in ‘stuttered’ gold generation;
  • To obscure things even further, game speed and internal framerate have their own, although somewhat negligible, impact on the resulting gold generation. At default (‘×1.7’) DE game speed, I observed Keshik generating 6% more gold at 20 FPS compared with 60 FPS. At ×1.0 game speed, Keshik tends to generate slightly less gold at any tested framerate;
  • Keshik tends to generate slightly (~5%) more gold while chasing a fleeing target than while fighting a stationary one. Gold generation while chasing a unit is less dependent on game speed and framerate in general and seems to be more stable in general (probably due to the fact that attack speed has no impact in this case).

Though this is way too wordy for a small mechanic that almost makes no real impact on the game, it still touches upon an important mechanic of attack speed, as well as an impact of game speed and framerate.

submitted by /u/akimbofmg9
[link] [comments]


from newest submissions : aoe2 https://ift.tt/3d2gaTP
No comments

No comments :

Post a Comment