ldesgoui / tf2-comp-fixes

Various TF2 tweaks catered towards competitive play
GNU General Public License v3.0
46 stars 7 forks source link

Remove pipes spread #84

Open bodolaz146 opened 2 years ago

bodolaz146 commented 2 years ago

So, pipes have a random spread for two reasons:

  1. velocity is random
  2. angular velocity is also random (except when we have Loch-n-Load)

Fixing the velocity is pretty easy. We just need to recalculate it, knowing the speed of the projectile and the eyes angles. Now, to the second part (the part that sucks).

Formula for angular velocity is (600, y, 0), where y is a random int from the closed interval [-1200; 1200]. The simplest solution would be to use a vector (600, 0, 0) for each pipe. Unfortunately, the angular velocity affects the trajectory quite a lot due to the simulation of air drag. Here are some examples: y is from [-1200; 0] with step 200 20220112222418_1 y is from [-200; 0] with step 20 20220112222625_1 I have added the sm_cf_show_projectiles_traces command to illustrate the trajectories, i hope you don't mind.

It turns out that the closer y is to 0, the farther the pipes will fly, which makes this approach pretty bad. So, I decided to try another method - calculate the average horizontal distance that the pipes travel from 45 degree angle, and then find the y value that gives the average result (or close to it).

I made a small plugin to calculate that: link It basically spams tons of pipes and calculates the average distance (for int values). And this is how I got the value of ANGULAR_VELOCITY_Y. My full results are here: L20220121 (copy).log

Have fun.

ldesgoui commented 2 years ago

Thanks for the PR, I don't really have time to check it out right now, I'll try to before the end of the ongoing competitive seasons

The reasoning/data for ANGULAR_VELOCITY_Y seems sound to me.