Home | Planet Ludum | Rules Wiki | Mailing List| Sign In/Create Account | Write a Post| #ludumdare on irc.afternet.org

Ludum Dare 16 :: December 2009 :: Theme: Exploration

LD16 Results: Top 20 | Categories | View All 121

Theme Voting: Round 1 | Round 2 | Round 3 | Round 4

's Trophies

Posts Tagged ‘algorithms’

Re: Distractions Deluxe

Posted by LunarCrisis
Saturday, April 19th, 2008 1:14 pm

My solution:

So the problem is to figure out the direction a player (moving in 3-d) has to shoot to hit an enemy (also moving in 3-d) given their positions, velocities, and the speed of the bullet.

The approach I used was to solve the equation

time it takes the enemy to reach a position = time it takes the bullet to reach the position

for the time.

First, redefine the vectors so that they are all relative to the player. This
leaves you with only bullet speed, enemy velocity, and enemy position. The
points in question are the points along the enemy’s trajectory, so express the
above equation in terms of t:

b1.png

This can be solved with the quadratic equation:

b21.png

Note that there may be zero, one, or two solutions. Negative solutions reflect hits in the past. If there are no positive solutions it is not possible for the player to hit the enemy.

Once you have t, it is simple to calculate the position.

Edit: forgot the exponent on the bottom of the final answer.

Distractions Deluxe

Posted by DrPetter
Saturday, April 19th, 2008 12:45 pm

Someone (partly me) derailed the IRC into wild discussion of a math problem. I think some 5-6 people were involved at some points, and we still haven’t arrived at a conclusion as far as I can tell.

Here’s an image I cooked up to help visualize the problem:

salvation.jpg

The problem is deceptively simple: Determine what angle to fire a bullet in, if it is to hit a target that’s moving past you at a constant velocity. In other words, both objects are moving at a fixed speed, and you just have to figure out in what direction to launch the bullet so that it’ll hit the target perfectly. Iterative solutions need not apply. Good luck with interpreting the image, it’s pretty confus(ed/ing).

  • Recent Comments

  • Recent Tweets (Tag: #LD48)

  • Categories

  • Meta

  • Recent Trophies

    The LD to "Chart Topping" Kongregate Award
    Awarded by PoV on March 17, 2010
    The "Ludum Dare Entry on iPhone" Award
    Awarded by PoV on March 17, 2010
    The "Ludum Dare Entry on iPhone" Award
    Awarded by PoV on March 17, 2010
    The "Ludum Dare Entry on Steam" Award
    Awarded by PoV on March 17, 2010
    The Lonely Clapper Award
    Awarded by PoV on March 16, 2010
    The "Ludum Dare Entry in SOWN" Award
    Awarded by PoV on January 26, 2010
    The "Ludum Dare Entry in the IGF" Award
    Awarded by PoV on January 26, 2010
    The "Ludum Dare Entry in the IGF" Award
    Awarded by PoV on January 26, 2010
    The "Funnest Looking Animated GIF Ever" Award
    Awarded by PoV on January 26, 2010
    The "Breakfast With Awesome Thing" Award
    Awarded by PoV on January 26, 2010
    The Official SonnyBone 'RAD GAME' Award
    Awarded by SonnyBone on January 3, 2010
    The Madk Award for Excellence in Graphic Art
    Awarded by madk on January 2, 2010

  • All posts, images, and comments are owned by their creators.