Diep Loop Duration Measurement

This post will heavily rely on nearly every formula I already used once so in order to fully understand why this works you should also check out my other posts on this subreddit. Nevertheless I'll try to explain it to you as good and understandable as I can.

What is a loop?

Every impact in diep is build up of hits or so called loops. At every loop a certain number of events happen. For example if a bullet hits a tank the tank receives damage.This damage is distributate across those hits/loops and therefore isn't dealt all at once. Other events that can occur during loops are regeneration and knockabck. It's important to know that they alway follow the same pattern or even build loops of their own with the same loop duration. This means that those 3 events circle every loop, hence the name loop. We ignore for this post the effects of knockback on this collision since it doesn't alternate the outcome of it.

To recap:

If an object touches an other object damage is gonna be dealt in loops. Like this

Damage------some time goes by------Damage------some time goes by------Damage---...

Events happen (for the most part and probably) in the beginning of each loop. If no events need to happen for the rest of the loop nothing happens until the next loop occurs. In this example if one damage is dealt the game waits until the loop is finished and then starts dealing damage again if the bullet is still inside the tank.

What is the loop duration?

The loop duration is, as the name implies, the duration of a single loop . In the graph above it goes from the beginning of the first damage to the beginning of the second one. Generally speaking the loop duration is the time between 2 events. It has always a constant duration.

Now that the terminology is clear let's start with the actual calculation.

How to measure the loop duration

All you need to measure it are 2 tanks and 1 shape that is more durable than a square.

Some theory first:

We know that all collisions are build up of loops. There exist 1-loop-collisions, 2-loop-collision, 3-loop-collisions, and so on.What would now happen if I fire a bullet towards a tank and the resulting collision is a 1-loop-collision? How long will it take to deal all the damage? The first damage of a collision is a bit special. It can occur at the very beginning of a collision itself or 1 loop duration later since the game universally updates collisions. So when I fire a bullet towards a tank the first damage is dealt within 1 loop duration of the collision.

A 2-loop-collision with a tank regeneration looks like this

Damage, Regeneration------some time goes by ------Damage, Regeneration,.....

You'll notice 2 loops. Regenregation works in the same matter as damage within one loop. It gives the player a set amount of health back during loops. We can't be sure whether the regeneration comes before or after the damage part within one loop, but in the end we get the same result. It also doesn't depend on the position of damage and regeneration within one loop. The collision will be 2 loops long but the tank will die when the second damage happens. Even tho the collision would be 2 loops long the tank only survives for the time period of just 1 loop since the timely distance between 2 damages is just the duration of 1 loop. This makes it also receive only one time the regeneration since there is always a regeneration part somewhere inbetween the 2 damages.

What we need is a 2-loop-collision and the difference in the durability of the tank and the bullet has to be very small, cause we need the bullet to have as little durability as possible after the collision with the tank as possible.

After some experiments I came up with those 2 builds for the 2 tanks. 1 tank is an destroyer the other one a basic tank.

In order to create a 2-loop-collision the damage per loop of the destroyer bullet has to be at least half of the health of the tank. In this case over 138/2 = 69 HP and 6 damage points is the minimum amount you need for that with this type of bullet. 2 penetration points were choosen to give the destroyer bullet a bit more durability than the tank so it's able to kill it and continue to live afterwards.

The idea behind the experiment

The destroyer bullet will go through the basic tank and kill it in the process. Afterwards it'll collide with the triangle where it'll die to the triangle revealing to us exactly how much durability it has left after the collision. With increasing regeneration the tank regenerates more health during one loop time and the destroyer bullet will have less durability after the collision. By varying therefore the regeneration stat we also vary the remaining health of the triangle.

The small durability difference becomes only essential when the results are not accurate enough.

Since we got 2 loops and 1 loop time we need to adjust the regeneration equation for this case to include the loop time.

Adjusted regeneration equation :

Regenration per loop : 1/30 * loop duration * 34.5 * (0.03 + 0.12 * regeneration stat points) S/LD

After we adjusted the regeneration we also need to adjust the durability of the tank. Because the regeneration adds durability during the collision we need to add this to the old durability.

Adjusted tank durability :

Durability (Tank) : 34.5 S + 1/30 * loop duration * 34.5 S * (0.03 + 0.12 * regeneration stat points)

The destroyer bullet durability after the collision is the destroyer bullet durability minus the adjusted durability for the tank.

Bullet durability after the collision : 37.5 S - (34.5 S + 1/30 * loop duration * 34.5 S * (0.03 + 0.12 * regeneration stat points))

Last thing we need to calculate is the damage done to the triangle.

Health loss of the triangle = 4 / body strength of the triangle * bullet durability after the collision

The body strength of the triangle is 0.4

Health loss of the triangle = 4 / 0.4 * (37.5 S - (34.5 S + 1/30 * loop duration * 34.5 S * (0.03 + 0.12 * regeneration stat points) ) )

And finally we wanna know the displayed health we would see on the health of the triangle. An undamaged triangle has a health pool of 30HP.

Displayed health = 30 - 4 / 0.4 * (37.5 S - (34.5 S + 1/30 * loop duration * 34.5 S * (0.03 + 0.12 * regeneration stat points))) (1)

Now to some observations we made while testing with different regeneration points :

In order to get the loop duration now we have to rearrange the equation (1):

Loop duration = 30 * 4 / 138 / (0.03 + 0.12 * regeneration stat points) * (37.5 - 34.5 - (30 - displayed health) * 0.4/4) (2)

Finally measuring the loop duration

Note first : The games displays all health values from 0.05 to 0.15 as the same number due to the limitation of the health bar. All of this numbers would be displayed as 0.1 on the health bar. So if the health bar shows you the number 0.3 it can in reality be any value between 0.25 and 0.35. Keep this in mind.

We strategically determine all upper and lower limits the displayed health can be.

Plugging all of those values into our loop duration (2) equation gives us upper and lower limits for the length of the the loop.

The loop duration now has to be lower than all upper limits to it and higher than all lower limits. We simply select the lowest upper limit and the highest lower limit.

0.03953 s < loop duration < 0.04058 s

This results in the loop duration being 0.04 s long. The time between 2 events in a collision is 1/25 s. This is also the rate in which the game updates collisions.

Small funfact : With it we're now able to accurately calculate changes in durability in the mikro HP range. The smallest change in durability that can occur is the regeneration of a lvl 1 0/0/0/0/0/0/0/0/0/0 tank within one loop time. The change in durability would be 1/2000 S also 0.0005 S.

Checking our results

Of course we also have to make sure our results match with the displayed health we observed in the game. To get the results we again use the displayed health (1) equation to get our theorical values for the remaining health.

With the rounding rule that we established earlier we see that all theoretical calculated values match up the real displayed ones.

An Example

A 0/0/0/0/7/7/0/0 sniper bullet would last 120ms inside a lvl 1 tank.

And there you have it. The smallest conceivable time span in the game. Hope you liked it and thanks for reading it until the end.

TL;DR the time between each damage hit is 40ms

Huge Thanks to /u/La_Faucheuse for helping and supporting.