View RSS Feed

DiscMurderer

More PHP Fun : Star Fox 64 Route Randomizer

Rate this Entry
by , 08-19-2014 at 05:41 PM (123 Views)
Hello everyone ! Over this past Summer I had a huge N64 kick, and played a ton of Star Fox 64, and just for the heck of it I wrote a small web application using PHP that spits out a random route for you to take. When you load/refresh the page, you will get a new route. All the visuals in this are taken from the actual game, doubled in size to make it easier to see.

Example Image



As for how this all works, I randomly generate a number between 2 and 102, and then check whether that number is even or odd, that determines which area is next on the route.

Code:
$pathVal = mt_rand(2,102);
  
  if ($pathVal % 2 == 0)
  {
    $missionTwo = "Sector Y Combat Zone";

    // Huge branch of nested if/else statements following the same process, setting the $missionThree - $missionSix variables
  }
  else
  {
    $missionTwo = "Meteo";

    // Same as above, nested if/else statements    
  }
This is the entire source, for those who are interested. I'm fairly certain that there was a better way to do this than to generate a new random number per statement.

Spoiler



If you want the entire thing for download, which includes the images and the source, you can get it here

Submit "More PHP Fun : Star Fox 64 Route Randomizer" to Digg Submit "More PHP Fun : Star Fox 64 Route Randomizer" to del.icio.us Submit "More PHP Fun : Star Fox 64 Route Randomizer" to StumbleUpon Submit "More PHP Fun : Star Fox 64 Route Randomizer" to Google

Updated 08-19-2014 at 07:30 PM by DiscMurderer

Categories
Uncategorized

Comments