The Ultimate Site of Worms Armageddon

All About TUS => TUS Discussion => Topic started by: Woshee on May 22, 2017, 11:20 PM

Title: Is Worms Related to Math.
Post by: Woshee on May 22, 2017, 11:20 PM
It's for a math final.
Title: Re: Is Worms Related to Math.
Post by: TheWalrus on May 22, 2017, 11:23 PM
It's for a math final.
yes

http://worms2d.info/User:Etho/Physics_Engine
Title: Re: Is Worms Related to Math.
Post by: Woshee on May 23, 2017, 12:05 AM
Thx Btw here's my youtube
my treat.
Title: Re: Is Worms Related to Math.
Post by: Sbaffo on May 23, 2017, 04:53 AM
This is what i've always related bng to: https://en.m.wikipedia.org/wiki/Projectile_motion (https://en.m.wikipedia.org/wiki/Projectile_motion)


Physics is cool! :)
Title: Re: Is Worms Related to Math.
Post by: Dr Abegod on May 23, 2017, 09:12 AM
Yeah the curve of a thrown grenade would be an obvious thing to describe using maths. This is fairly simple because the nade is only accelerated by the vertical force of gravity.
If you're familiar with vector functions you can describe the path of a bazooka projectile which is also accelerated horizontally by the wind.

A zook function would look something like this

f(t):
x(t) = v0x * t + 0.5 * w * t^2
y(t) = v0y * t - 0.5 * g * t^2

( v0x , v0y ) is the initial velocity vector. This vector describes the angle and power of the shot.
w is the wind acceleration value, g is the gravitation.

Graphs of a zook shot with the same angle and power
0 wind:
(http://graphsketch.com/render.php?mode=para&eqn1_color=1&eqn1_x=2t%20%2B%200.5%20*%200%20*%20t%5E2&eqn1_y=10t%20-%200.5%20*%204%20*%20t%5E2&eqn2_color=2&eqn2_x=&eqn2_y=&eqn3_color=3&eqn3_x=&eqn3_y=&x_min=-8&x_max=20&y_min=0&y_max=17&t_min=-10&t_max=10&x_tick=1&y_tick=1&x_label_freq=5&y_label_freq=5&do_grid=0&do_grid=1&bold_labeled_lines=0&bold_labeled_lines=1&line_width=4&image_w=500&image_h=300)

Positive wind:
(http://graphsketch.com/render.php?mode=para&eqn1_color=1&eqn1_x=2t%20%2B%200.5%20*%201%20*%20t%5E2&eqn1_y=10t%20-%200.5%20*%204%20*%20t%5E2&eqn2_color=2&eqn2_x=&eqn2_y=&eqn3_color=3&eqn3_x=&eqn3_y=&x_min=-8&x_max=20&y_min=0&y_max=17&t_min=-10&t_max=10&x_tick=1&y_tick=1&x_label_freq=5&y_label_freq=5&do_grid=0&do_grid=1&bold_labeled_lines=0&bold_labeled_lines=1&line_width=4&image_w=500&image_h=300)

Negative wind:
(http://graphsketch.com/render.php?mode=para&eqn1_color=1&eqn1_x=2t%20%2B%200.5%20*%20-1%20*%20t%5E2&eqn1_y=10t%20-%200.5%20*%204%20*%20t%5E2&eqn2_color=2&eqn2_x=&eqn2_y=&eqn3_color=3&eqn3_x=&eqn3_y=&x_min=-8&x_max=20&y_min=0&y_max=17&t_min=-10&t_max=10&x_tick=1&y_tick=1&x_label_freq=5&y_label_freq=5&do_grid=0&do_grid=1&bold_labeled_lines=0&bold_labeled_lines=1&line_width=4&image_w=500&image_h=300)

More negative wind:
(http://graphsketch.com/render.php?mode=para&eqn1_color=1&eqn1_x=2t%20%2B%200.5%20*%20-2%20*%20t%5E2&eqn1_y=10t%20-%200.5%20*%204%20*%20t%5E2&eqn2_color=2&eqn2_x=&eqn2_y=&eqn3_color=3&eqn3_x=&eqn3_y=&x_min=-8&x_max=20&y_min=0&y_max=17&t_min=-10&t_max=10&x_tick=1&y_tick=1&x_label_freq=5&y_label_freq=5&do_grid=0&do_grid=1&bold_labeled_lines=0&bold_labeled_lines=1&line_width=4&image_w=500&image_h=300)

Play around here:
http://graphsketch.com/parametric?mode=para&eqn1_color=1&eqn1_x=2t%20%2B%200.5%20*%200%20*%20t%5E2&eqn1_y=10t%20-%200.5%20*%204%20*%20t%5E2&eqn2_color=2&eqn2_x=&eqn2_y=&eqn3_color=3&eqn3_x=&eqn3_y=&x_min=-8&x_max=20&y_min=0&y_max=17&t_min=-10&t_max=10&x_tick=1&y_tick=1&x_label_freq=5&y_label_freq=5&do_grid=0&do_grid=1&bold_labeled_lines=0&bold_labeled_lines=1&line_width=4&image_w=850&image_h=525 (http://graphsketch.com/parametric?mode=para&eqn1_color=1&eqn1_x=2t%20%2B%200.5%20*%200%20*%20t%5E2&eqn1_y=10t%20-%200.5%20*%204%20*%20t%5E2&eqn2_color=2&eqn2_x=&eqn2_y=&eqn3_color=3&eqn3_x=&eqn3_y=&x_min=-8&x_max=20&y_min=0&y_max=17&t_min=-10&t_max=10&x_tick=1&y_tick=1&x_label_freq=5&y_label_freq=5&do_grid=0&do_grid=1&bold_labeled_lines=0&bold_labeled_lines=1&line_width=4&image_w=850&image_h=525)

How this relates to the exact pixel movement in game i have no idea about..
Title: Re: Is Worms Related to Math.
Post by: Sbaffo on May 23, 2017, 09:40 AM
That's a nice analysis there abe, gj
Title: Re: Is Worms Related to Math.
Post by: h3oCharles on May 23, 2017, 04:09 PM
Yea, I think either WTF-8 or StepS could explain this a bit better... maybe DC/CS even?
Title: Re: Is Worms Related to Math.
Post by: Dr Abegod on May 23, 2017, 06:41 PM
Thanks, Sbaffo.
@TheMadCharles, there isnt really more to say on this matter. I'm sure the game doesnt calculate these curves in advance when you shoot - the projectile moves on a frame to frame basis. Maybe the AI worms use similar math to work out the zooking, dunno
Title: Re: Is Worms Related to Math.
Post by: Woshee on May 24, 2017, 11:40 PM
Thanks to You I Passed my 8th Grade Math Final.  :D :) ;D :o
Title: Re: Is Worms Related to Math.
Post by: TheKomodo on May 25, 2017, 02:58 AM
Everything is related to math.
Title: Re: Is Worms Related to Math.
Post by: nino on May 25, 2017, 07:50 PM
Worms came b4 math, same as god came b4 everything!

Title: Re: Is Worms Related to Math.
Post by: Free on May 25, 2017, 08:29 PM
Worms came b4 math, same as god came b4 everything!



That's why if you ain't worming, you ain't true to god.

#AG nino
Title: Re: Is Worms Related to Math.
Post by: Ytrojan on June 26, 2017, 12:48 AM
In case you're lazy, here's the formula.


 x = x0 + vx0*t + w*t*(t+1)/2 y = y0 + vy0*t + g*t*(t+1)/2 vx = vx0 + w*t vy = vy0 + g*t