Raptor Attack Simulation
I read XKCD, a brilliant web comic, regularly. Recently I decided to write a simple simulation based on one of his older comics. Here is an excerpt showing exactly what I simulated:
I threw the simulation together in JavaScript rather quickly, so it isn’t at all elegant and nice looking. However, it is still a lot of fun to play with. Your character runs towards the mouse, and the simulation stops when you are caught. Refresh with F5 to start again.
Version 1 has momentum, and feels strange to control. It is possible to get the raptors to constantly circle around you, since they can’t turn fast enough to get you once they are up to speed.
Version 2 has much more agile raptors. They can turn and stop instantly, but still need to accelerate to get to speed in a new direction. This one proves for certain that RAPTORS ARE SCARY! My best time so far is 2.8 seconds.
Eventually, I would love to implement a version with floorplans using the rules from the last problem in the linked comic, but I doubt I’ll get around to playing with that for a long time.

Sammie Says :
haha. Yes! Thank you for the quick entertainment.
sammie
2008-02-22 13:44 PermalinkDanny Says :
15.5 seconds on the second one… Whew… Raptors are scary…
Nice man! Good work!
2008-07-23 15:44 PermalinkS7evyn Says :
Second one:
Survived so far: 85.29999999999943 seconds Ran: 448.6871266136949 meters
I could’ve kept going, but I got bored. Go straight down and slightly to the right, then make a hard right and you can move in circles indefinitely.
2008-09-26 10:08 Permalinkfringefr Says :
Raptors? You mean those 0.5m tall non-flying birds that you could kick out of your way?
2008-09-26 10:13 PermalinkShawn Sanders Says :
45 seconds in the first one! w00t!
2008-09-26 11:09 PermalinkAlistair Says :
Go up-right for 2.1 seconds, then 90 degrees right, facing dwn-right:
Survived so far: 3.900000000000002 seconds
2008-09-26 14:08 PermalinkRan: 18.569800522903538 meters
Naiden Says :
6.89 on version 2
2008-09-26 15:49 Permalinkasdf Says :
seems i can evade the first version forever.
version 2: 23.3secs
nice simulation.
2008-09-26 16:41 Permalinkreminds me of dogfight sims, and evading homing missiles.
chad hamby Says :
18.9 on ver.2 head down and then circle only works if raptors trip over each other
2008-09-29 14:59 PermalinkRaptor Advocate Says :
The raptor on top does not appear to have its speed limited as mentioned in the strip
2008-09-29 15:38 PermalinkJon Says :
Raptor Advocate,
The speed is definitely limited, you just don’t see it much. The strip doesn’t mention a slower acceleration, and most of the time the top raptor hasn’t had a chance to reach top speed by the time you’re caught.
2008-09-29 15:41 PermalinkDustin Says :
42.6 sec.
2008-09-29 16:53 Permalink202.485 m
Straight down then doing 90 degree turns
Dustin Says :
Version 2 ^^^
2008-09-29 16:54 PermalinkWar_Hero Says :
I got infinite time on the first one. go up right until you are out of the triangle of death, then make a sudden turn down. Just keep circling after that and they will never get you.
2008-09-30 00:11 Permalinkeric Says :
64 seconds on the second one!
2008-09-30 16:33 PermalinkRun down, then turn as soon as the one on the bottom right passes to dodge the top. after that its essentially running in a square or circle since they have to stop to turn. straight lines = death.
Nick Says :
Second one I got 63.90000000000064 seconds, Ran for 189.20081264441484 meters. Once you break away from their initial charge it is easy to just keep them moving in a circle behind you and keep evading them indefinitly.
2008-10-03 07:51 PermalinkNathan Says :
How long you can survive the simulation isn’t really important..realistically, you would eventually get tired and even if you didn’t it doesn’t matter how long you run in circles, you’re just stuck in that area and will never make to cover. Not that many places that would save you from a raptor right on you’re tail…plus you should take into account the fact that they can jump and catch you before you got to that crucial turning point. Also, they’re a pack. A smart one at that. While you’re running in circles one of them would just pull back a wait to cut you off from another angle….point being, you can’t survive. Raptors are the greatest predators in this planet’s history. Great simulation though.
2009-02-12 20:09 PermalinkMatt Corey Says :
Yeah he’s right, you can go infinitely if you hit one of the windows JUST right. The bottom followed by a right jink worked best. The 2 o clock is more interesting but only got me 4 seconds once. I think it’s cuz it’s easier for our brains to recognize straight down than slightly to the right
2009-03-01 21:01 Permalink