Skip to main content
Motion Mechanics #2 (Recoil and Recoil Speed) : r/Diepio
Log In
r/Diepio icon
Go to Diepio
r/Diepio
•
6 yr. ago
Aznatf
Motion Mechanics #2 (Recoil and Recoil Speed)
Guide
Before you start reading this post, I highly recommend first reading Motion Mechanics #1 if you aren't familiar with the basic motion mechanics of the game. There you will find the definitions of the units, I'll be using in this post which are gonna be important for the understanding!
Definition and Introduction
The recoil of a bullet/drone/trap is defined to be the distance that a tank covers with 1 shot while being stationary. A fundamental property of recoil is that it's constant for each bullet/drone/trap of the same barrel it comes out from, meaning it's a hard coded value and no stat in the game affects or changes it by any means. Recoil is always applied in the opposite direction of the where the projectile is heading at.
Recoil Table
To get a better perspective of things I list you all recoil values in the game. Not included are recoils from tanks which recoils cancels each others out and those whichs projectiles can't be desynchronized for recoil measurement i.e Quad Tank and Triple Twin
Tank Recoil in Gridunits (gu) Recoil in Diepunits (du)
Sprayer (Small Bullet), Destroyer-Dominator, Gunner-Dominator, Trapper-Dominator 0 gu 0 du
Spread Shot (Large Bullet) 0.04 gu 2 du
Streamliner, Gunner, Auto Gunner (Manual Bullet), Tri-Angle (Front Bullet), Fighter (Front Bullet), Booster (Front Bullet), Booster (Outer Rare Bullet) 0.08 gu 4 du
Auto 3, Auto 5, Auto Smasher (Auto Bullet), Auto Gunner (Auto Bullet), Auto Trapper (Auto Bullet), Hunter, Predator 0.12 gu 6 du
Triplet 0.2 gu 10 du
Penta Shot 0.28 gu 14 du
Twin 0.3 gu 15 du
Basic, Machine Gun, Triple Shot, Gunner Trapper (Trap/Bullet), Sprayer (Large Bullet), Manager, Overlord, Overseer, Factory (Drone), Overtrapper, Hybrid (Drone), Tri-Trapper, Mega Trapper, Auto Trapper (Trap), Factory (Drone Bullet) 0.4 gu 20 du
Fighter (Rear Bullet), Booster (Inner Rear Bullet), Tri-Angle (Rear Bullet) 1 gu 50 du
Sniper, Assasin, Ranger, Stalker, Skimmer (Large Bullet), Rocketeer (Large Bullet) 1.2 gu 60 du
Destroyer, Hybrid (Bullet) 6 gu 300 du
Annihilator 6.8 gu 340 du
Note : Despite not knowing what the recoil per bullet of a barrel of (for example) Flank Guard might be, it can still be assumed it's 0.4 gu since tanks inherit abilities and properties of their predecessors. Same goes for other "recoil-symmetrical" tanks like Tri-trapper, Octo Tank or Battleship.
Recoil Speed
Recoil speed is the terminal speed a tank achieves only by constantly firing bullets into one direction.
Generally speaking the recoil speed (V_RC) is equal to the recoil divided by the reload time : V_RC = RC / RT
An example : The recoil speed of a 7 bullet reload Basic Tank is : 0.4 gu / 0.32 s = 1.25 gu/s
If you wanna know why this is the case you're either happy with the explanation that a distance divided by a time gives a speed or you can look at the frame to frame analysis of recoil to decude the same fact.
Assistant
User
Level 1 tank's body is 40px in diameter, diep.io grid is 20px.
Level 1 tank is moving with pressing WASD is 10.2 px/frame (Scratch.mit.edu).
Give recoil (px/frame) for level 1 tank fires bullet with clicking.
Assistant
Let's break down the problem step-by-step to find the recoil speed in for a level 1 tank firing bullets in Diep.io:
User
Bullet Durability = Bullet Power Value * (0.7 + BulletDamage STAT * 0.3) * ( 1 + BulletPenetrate STAT * 0.75) * squares
Assistant
Thanks for sharing the formula! Here's a breakdown and explanation of the bullet durability formula you provided in the context of Diep.io:
Recoil behaves on a frame to frame basis exactly like an unaccelerated entity. It starts out with a fixed initial speed and it decreases by 10% at each frame due to friction. The Initial speed is determined by 1/10 of the recoil a projectile will provide. You can also call the inital speed the boost the bullets gives you and that accelerates you forwards.
An example : Let's pick a Sniper which gives us a recoil of 60 du meaning the corresponding inital speed would be 6 du/x. The following table shows what happens to the tank after only one bullet is shot.
Frame / Tick Speed / Veloctiy Conversion
1 6 du/x V(1)
2 5.4 du/x V(2) = 0.9 * V(1)
3 4.86 du/x V(3) = 0.9 * V(2)
4 4.375 du/x V(4) = 0.9 * V(3)
5 3.9366 du/x V(5) = 0.9 * V(4)
6 3.54294 du/x V(6) = 0.9 * V(5)
7 3.188646 du/x V(7) = 0.9 * V(6)
8 2.8697814 du/x V(8) = 0.9 * V(7)
9 2.58280326 du/x V(9) = 0.9 * V(8)
10 2.324522934 du/x V(10) = 0.9 * V(9)
Note : The speed will decrease until it reaches 0.01 du/x. After that the game sets it to 0 du/x and the tank doesn't move at all.
If you take all the sum over all speeds up to infinity in the list it will result in 60 du which is the recoil we started out with. So in a sense you can say that acceleration is to an accelerated entity what the intial speed is to an unaccelerated one.
Seperation Principle
Since a tank can shoot multiple bullets at sets intervalls, we have to question what happens on the frame where the second bullet is being shot. In this case the seperation principle takes over. It states that the total speed gained from recoil at each frame is the sum of each bullets contribution to it on this exact frame.
An example : A 7 reload basic tank has 8x as a reload time, meaning after 9 frames it shoots the next bullet. The first bullet would contribute on this frame 2 * 0.9^8 du/x and the second one 2 du/x flat since it just spawned. Meaning the total speed on frame 9 is 2 + 2 * 0.9^8 du/x = 2.9565938 du/x
Note : 2.9565938 du/x * 0.9 = 2.66093442 du/x and 2.66093442 du/x + 0.9 * 2.39480978 du/x. This means you can instead of using the seperation principle just taking the total speed on a given frame and multiply it by 0.9 to get to the next. Just be aware of the critical points at the 9th, 17th, 25th and so on frame, where you gotta add plus 2 in this case.
This principle holds true with any amount of bullets as long as they are shot all along the same direction. If bullets are instead shot at an angle it's wiser to use sine and cosine and seperate it further into the speed in the direction of the x-axis and y-axis and use the seperation principle for both x and y independently to get the correct speed!
Besides that the recoil speed doesn't instantly set in. The tank just approaches this speed will firing more and more bullets. This can be also seen in the graph above. If you take the average speed of the first 8 frames you will get an average speed of 1.42383198 du/x which isn't not the recoil speed. The recoil speed is what we get after infinite iterations. For the next 8 frames (frame 9 to 16) we get : 2.03674495 du/x. The speed will steadily grow until we hit our recoil speed of 2.5 du/x.
Coorelation with Movement Speed
If we now add movement speed to the mix then it then it would be the same as if we would just have more bullets. In this case the total speed at each frame is calculated by taking the movement speed at a given frame plus the sum of all other bullets shot up to that point on that same frame.
An example : A lvl 1 basic tank with 7 reload. I know it's impossible but it's just a hypothetical example!
As a tank shoots more and more bullets, while accelerating, its total end speed (the speed with which it'll move after infinite frames) will approach its top movement speed plus its recoil speed.
In this case top movement speed = 10 * 2.55 du/x = 25.5 du/x and recoil speed 20 du / 8x = 2.5 du/x→ Total End speed = 25.5 du/x + 2.5 du/x = 28 du/x or 14 gu/s.
If it were to only shoot bullets then the end speed is just its recoil speed.
Consequence of the Principle
A consequence of the principle is that it tells us that we can calculate the speed of a tank on the next frame by taking the speed a tank had on the previous frame and treating it like it's accelerating. For the derivation we use the general expressions for movement speed and recoil speed on a frame to frame basis.
VM (n+1) : movement speed on the next frame ; VM (n) : movement speed on the previous frame
V_RC (n+1) : recoil speed on the next frame ; V_RC (n) : recoil speed on the previous frame
V_total (n+1) : total speed on the next frame ; V_total (n) : total speed on the previous frame
A(0) : acceleration of the tank
VM (n+1) = VM (n) * 0.9 + A(0) and V_RC (n+1) = V_RC (n) * 0.9
V_total (n+1) = VM (n) * 0.9 + A(0) + V_RC (n) * 0.9 = (VM (n) + V_RC (n)) * 0.9 + A(0)
→ V_total (n+1) = V_total (n) * 0.9 + A(0)
In the end we get that the total speed after is just the same as the total speed before modified via the acceleration process. You just have to not forget to add the intial speed on every frame a new bullet spawns, otherwise the speed won't sink up with the real speed. For a deceleration process you can just set A(0) to 0 and you'll get the same relationship.
Another calculation example
If you don't care about calculating the speed at each given frame and you only wanna know how fast a given tank will be after a reasonable amount of time then here is what you do.
Let's pick Triplet with 0 reload and on lvl 45 with 7 movement speed.
The recoil per bullet is 0.2 gu and with 0 reload it has a reload time of 0.6s.Its recoil speed is therefore 3 * 0.2 gu / 0.6s = 1 gu/s (times 3 cause Triplet has 3 barrels)(Generally we have to take the angle into account but in this case it's 0° and cos(0°) = 1 so we can ignore it)
For the movement speed we use the top speed eqation from part 1 : Top Speed = 5 * 2.58825 * 1.07^(movement speed points) / 1.015^(level) = 5 * 2.58825 * 1.07^(7) / 1.015^(45) = 10.63385587 gu/s
The Total End Speed = Top Speed + Recoil Speed = 10.63385587 gu/s + 1 gu/s = 11.63385587 gu /s
Here is another example where you have to take the angles into accounts cause otherwise it won't give you the right speed.
A lvl 15 Sniper or Machine Gun with maxed out reload and movement is the fastest tank that can be played outside of Sandbox with a speed of 19.1215698 gu/s
The second fastest tank that can be played outside of Sandbox is a lvl 8 tank with maxed out movement, clocking at 19.1140313 gu/s
With every tank on lvl 45 and with maxed out reload and movement speed the fastest among them would be Booster (~16.15 gu/s) followed by Annihilator (~15.95 gu/s) followed by Fighter/Tri-Angle (~15.80 gu/s) (This funfact is demonstrated in the second example)
TL;DR Recoil is a constant and provides a speed boost depending on reload!
Sort by:
u/TheSamuel17 avatar
TheSamuel17
•
6y ago
Another interesting property of recoil worth mentioning is that recoil direction is not aimed towards the opposite side of the cannon, but the opposite side of the bullet. This is made obvious by simply firing the Machine Gun, or better yet, firing a Rocketeer bullet and observing its swaying trajectory.
For that reason, it is safe to assume that Sniper will be on average marginally faster than Machine Gun. Since I don't have bullet spread values and I'm not seasoned enough in math, you'll have to take my word for it.
Actually, try firing a Flank Guard or any tank with seemingly no recoil (due to canceling out each other) and observe how it moves just a little bit. Once again, bullet spread is probably to blame here.
u/Aznatf avatar
Aznatf
•
6y ago
Completely true! One interesting fact for Flank Guard is also that if you align your barrels horizontally, it'll primarely move vertically and just a really tiny bit horizontally. It does move horizontally yes but it's really unbelievably tiny that it doesn't really matter... It's about 0.001 to 0.0001 du or so. The DPMA script only has an accuracy of 0.0001 du and it's not accurate at low speeds so i'm not sure here. But it's tiny enough to not change the position futher than the third dezimal place.
I have some bullet spread values but i don't know how accurate they are. Needs further testing, but I can share some of them with you here (could be all of them since I think all other tanks fall into one in those 3 categories).
Sniper Ranger, Stalker : 0.03333333 radians
Basic Tank, all Tanks related to it : 0.1 radians
Machine Gun, Spreayer : 0.3 radians
Also I'm pretty sure Destroyer has the same spread accuracy as basic tank. And I'm not sure if it could be periodical so we can use it to always get bullets with a 0° angle.
u/MOUTARDE_ avatar
MOUTARDE_
•
6y ago
Nice work !!
Educational-Force776
•
2mo ago
so recoil doesn't get worse at lv45. now I'm thinking 0/5/7/0/7/7/7/0 booster since movement speed stat (especially the first point) does not synergize with that from recoil (just adding a drop in the bucket won't reduce already short ETA by much. just travel around looking for shapes to mine, moving in opposite direction to stay still) and as for using movement speed, there's smasher (lv30 0/5/6/10) and octo(lv45 0/2/3/0/7/7/7/7 and turn on auto spin) to not hafta use mouse at all
New to Reddit?
Create your account and connect with a world of communities.
By continuing, you agree to our User Agreement and acknowledge that you understand the Privacy Policy.
More posts you may like
Recoil more than manageable.
r/deadline_roblox icon
r/deadline_roblox
•
25 days ago
Recoil more than manageable.
10 upvotes · 30 comments
Cool Mechanics
r/savageworlds icon
r/savageworlds
•
4 mo. ago
Cool Mechanics
r/savageworlds - Cool Mechanics
24 upvotes · 13 comments
I just don't get Recon mechanics...
r/BrokenArrowTheGame icon
r/BrokenArrowTheGame
•
6 mo. ago
I just don't get Recon mechanics...
77 upvotes · 35 comments
Just a bit of recoil
r/battlefield_4 icon
r/battlefield_4
•
14 days ago
Just a bit of recoil
r/battlefield_4 - Just a bit of recoil
0:13
604 upvotes · 13 comments
currently working on a reloading explosive shooter. this is the first version that actually works decently.
r/ScrapMechanic icon
r/ScrapMechanic
•
3 mo. ago
currently working on a reloading explosive shooter. this is the first version that actually works decently.
r/ScrapMechanic - currently working on a reloading explosive shooter. this is the first version that actually works decently.
0:57
26 upvotes · 7 comments
Cool Side Effect of Smart physics
r/ScrapMechanic icon
r/ScrapMechanic
•
3 mo. ago
Cool Side Effect of Smart physics
r/ScrapMechanic - Cool Side Effect of Smart physics
25 upvotes · 8 comments
Movement Diff
r/Rivenmains icon
r/Rivenmains
•
3 mo. ago
Movement Diff
r/Rivenmains - Movement Diff
0:18
73 upvotes · 16 comments
Does my games movement mechanics actually look fun? (Yes I added cuts in the video for brevity)
r/UnrealEngine5 icon
r/UnrealEngine5
•
3 mo. ago
Does my games movement mechanics actually look fun? (Yes I added cuts in the video for brevity)
r/UnrealEngine5 - Does my games movement mechanics actually look fun? (Yes I added cuts in the video for brevity)
1:33
334 upvotes · 98 comments
This has got to be the most complicated ability ever, right?
r/JurassicWorldAlive icon
r/JurassicWorldAlive
•
15 days ago
This has got to be the most complicated ability ever, right?
r/JurassicWorldAlive - This has got to be the most complicated ability ever, right?
59 upvotes · 24 comments
Why are my bombs range so short?
r/vtolvr icon
r/vtolvr
•
19 days ago
Why are my bombs range so short?
49 upvotes · 35 comments
Now I understand why projectiles speed especially rockets/missiles are so slow by default
r/FarCry5 icon
r/FarCry5
•
1 mo. ago
Now I understand why projectiles speed especially rockets/missiles are so slow by default
r/FarCry5 - Now I understand why projectiles speed especially rockets/missiles are so slow by default
0:13
36 upvotes · 7 comments
A Noobies Perspective on Squad’s Shooting Mechanics
r/PlaySquad icon
r/PlaySquad
•
6 days ago
A Noobies Perspective on Squad’s Shooting Mechanics
45 upvotes · 35 comments
Recoil-Powered Swimmers?
r/SpeculativeEvolution icon
r/SpeculativeEvolution
•
1 mo. ago
Recoil-Powered Swimmers?
r/SpeculativeEvolution - Recoil-Powered Swimmers?
334 upvotes · 32 comments
Physics?...
r/ScrapMechanic icon
r/ScrapMechanic
•
3 mo. ago
Physics?...
r/ScrapMechanic - Physics?...
30 upvotes · 7 comments
Projectile Interception system!
r/pygame icon
r/pygame
•
4 mo. ago
Projectile Interception system!
r/pygame - Projectile Interception system!
1:16
42 upvotes · 12 comments
Avoid VRS
r/NuclearOption icon
r/NuclearOption
•
3 mo. ago
Avoid VRS
r/NuclearOption - Avoid VRS
youtu
59 upvotes · 6 comments
Players should look one step further
r/beyondallreason icon
r/beyondallreason
•
12 days ago
Players should look one step further
50 upvotes · 49 comments
You can use in-game mechanics/systems in real life.
r/godtiersuperpowers icon
r/godtiersuperpowers
•
1 mo. ago
You can use in-game mechanics/systems in real life.
195 upvotes · 45 comments
Speed?
r/SliceAndDice icon
r/SliceAndDice
•
18 days ago
Speed?
r/SliceAndDice - Speed?
0:10
81 upvotes · 15 comments
Like Something Reset
r/Glitch_in_the_Matrix icon
r/Glitch_in_the_Matrix
•
21 days ago
Like Something Reset
36 upvotes · 8 comments
Making combat better.
r/savageworlds icon
r/savageworlds
•
8 days ago
Making combat better.
32 upvotes · 22 comments
Assault auto-reload is clutch
r/ApexConsole icon
r/ApexConsole
•
15 days ago
Assault auto-reload is clutch
r/ApexConsole - Assault auto-reload is clutch
0:23
23 upvotes · 12 comments
As a player, would you prefer a combat system that is proactive or reactive?
r/RPGdesign icon
r/RPGdesign
•
25 days ago
As a player, would you prefer a combat system that is proactive or reactive?
36 upvotes · 49 comments
Manual reload.
r/ArmoredCoreVI icon
r/ArmoredCoreVI
•
7 mo. ago
Manual reload.
6 upvotes · 8 comments
Battlefield VI Destruction System – Too Much or Just Right?
r/ItsAllAboutGames icon
r/ItsAllAboutGames
•
13 days ago
Battlefield VI Destruction System – Too Much or Just Right?
r/ItsAllAboutGames - Battlefield VI Destruction System – Too Much or Just Right?
A level 1 Basic tank firing bullets once per click gains a recoil speed of roughly:
[
\boxed{0.42 \text{ px/frame}}
]
in the opposite direction of the bullet.
Additional Notes:
This recoil speed is small compared to movement speed (10.2 px/frame).
Recoil speed accumulates only if you keep firing continuously.
This value assumes the tank is stationary and firing; when combined with WASD movement, recoil adds to or subtracts from the total velocity.
If tank has different reload stats or fires multiple barrels, recoil speed changes accordingly.
If you want me to calculate recoil speed for other tanks, reload stats, or frame rates, just ask!
Variables:
Bullet Power Value: Base durability or base HP of the bullet, probably linked to the tank/bullet type.
BulletDamage Stat: The tank's bullet damage stat level (likely 0 to 7 in Diep.io).
BulletPenetrate Stat: The tank's bullet penetration stat (likely 0 to 7).
Squares: Number of squares the bullet passes through or hits (used to calculate durability consumed or bullet lifespan).
Intuition
Bullet durability depends on the power of the bullet and is increased by higher bullet damage and penetration stats.
Bullet damage stat increases durability by a factor scaled from 0.7 baseline to 1.0 when maxed (if 7 is max, the stat multiplier increases durability by 0.3 * stat).
Bullet penetration stat further boosts durability by 75% per penetration stat point.
Multiplying by squares likely accounts for the length or number of objects the bullet interacts with — e.g., bullet can survive more hits or pierce more obstacles.