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.
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.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 }
Spoiler
Code:<?php $missionOne = "Corneria"; $missionTwo = "N/A"; $missionThree = "N/A"; $missionFour = "N/A"; $missionFive = "N/A"; $missionSix = "N/A"; $missionSeven = "Venom"; $pathVal = mt_rand(2,102); if ($pathVal % 2 == 0) { $missionTwo = "Sector Y Combat Zone"; $pathVal = mt_rand(2,102); if ($pathVal % 2 == 0) { $missionThree = "Aquas"; $pathVal = mt_rand(2,102); if ($pathVal % 2 == 0) { $missionFour = "Zoness"; $pathVal = mt_rand(2,102); if ($pathVal % 2 == 0) { $missionFive = "Sector Z Combat Zone"; $pathVal = mt_rand(2,102); if ($pathVal % 2 == 0) { $missionSix = "Area 6"; } else { $missionSix = "Area 6"; } } else { $missionFive = "Macbeth"; $pathVal = mt_rand(2,102); if ($pathVal % 2 == 0) { $missionSix = "Area 6"; } else { $missionSix = "Bolse"; } } } else { $missionFour = "Solar"; $pathVal = mt_rand(2,102); if ($pathVal % 2 == 0) { $missionFive = "Macbeth"; $pathVal = mt_rand(2,102); if ($pathVal % 2 == 0) { $missionSix = "Area 6"; } else { $missionSix = "Bolse"; } } else { $missionFive = "Titania"; $pathVal = mt_rand(2,102); if ($pathVal % 2 == 0) { $missionSix = "Bolse"; } else { $missionSix = "Bolse"; } } } } else { $missionThree = "Katina"; $pathVal = mt_rand(2,102); if ($pathVal % 2 == 0) { $missionFour = "Solar"; $pathVal = mt_rand(2,102); if ($pathVal % 2 == 0) { $missionFive = "Macbeth"; $pathVal = mt_rand(2,102); if ($pathVal % 2 == 0) { $missionSix = "Area 6"; } else { $missionSix = "Bolse"; } } else { $missionFive = "Titania"; $pathVal = mt_rand(2,102); if ($pathVal % 2 == 0) { $missionSix = "Bolse"; } else { $missionSix = "Bolse"; } } } else { $missionFour = "Sector X Combat Zone"; $takeWarp = mt_rand(0,100); $pathVal = mt_rand(2,102); if ($pathVal % 2 == 0) { if ($takeWarp <=50) { $missionFive = "Sector Z Combat Zone"; } else { $missionFive = "Macbeth"; } $pathVal = mt_rand(2,102); if ($pathVal % 2 == 0) { $missionSix = "Area 6"; } else { if ($takeWarp <= 50) { $missionSix = "Area 6"; } else { $missionSix = "Bolse"; } } } else { $missionFive = "Titania"; $pathVal = mt_rand(2,102); if ($pathVal % 2 == 0) { $missionSix = "Bolse"; } else { $missionSix = "Bolse"; } } } } } else { $missionTwo = "Meteo"; $pathVal = mt_rand(2,102); if ($pathVal % 2 == 0) { $missionThree = "Katina"; $pathVal = mt_rand(2,102); if ($pathVal % 2 == 0) { $missionFour = "Solar"; $pathVal = mt_rand(2,102); if ($pathVal % 2 == 0) { $missionFive = "Macbeth"; $pathVal = mt_rand(2,102); if ($pathVal % 2 == 0) { $missionSix = "Area 6"; } else { $missionSix = "Bolse"; } } else { $missionFive = "Titania"; $pathVal = mt_rand(2,102); if ($pathVal % 2 == 0) { $missionSix = "Bolse"; } else { $missionSix = "Bolse"; } } } else { $missionFour = "Sector X Combat Zone"; $takeWarp = mt_rand(0,100); $pathVal = mt_rand(2,102); if ($pathVal % 2 == 0) { if ($takeWarp <=50) { $missionFive = "Sector Z Combat Zone"; } else { $missionFive = "Macbeth"; } $pathVal = mt_rand(2,102); if ($pathVal % 2 == 0) { $missionSix = "Area 6"; } else { if ($takeWarp <= 50) { $missionSix = "Area 6"; } else { $missionSix = "Bolse"; } } } else { $missionFive = "Titania"; $pathVal = mt_rand(2,102); if ($pathVal % 2 == 0) { $missionSix = "Bolse"; } else { $missionSix = "Bolse"; } } } } else { $missionThree = "Fortuna"; $pathVal = mt_rand(2,102); if ($pathVal % 2 == 0) { $missionFour = "Solar"; $pathVal = mt_rand(2,102); if ($pathVal % 2 == 0) { $missionFive = "Macbeth"; $pathVal = mt_rand(2,102); if ($pathVal % 2 == 0) { $missionSix = "Area 6"; } else { $missionSix = "Bolse"; } } else { $missionFive = "Titania"; $pathVal = mt_rand(2,102); if ($pathVal % 2 == 0) { $missionSix = "Bolse"; } else { $missionSix = "Bolse"; } } } else { $missionFour = "Sector X Combat Zone"; $takeWarp = mt_rand(0,100); $pathVal = mt_rand(2,102); if ($pathVal % 2 == 0) { if ($takeWarp <=50) { $missionFive = "Sector Z Combat Zone"; } else { $missionFive = "Macbeth"; } $pathVal = mt_rand(2,102); if ($pathVal % 2 == 0) { $missionSix = "Area 6"; } else { if ($takeWarp <= 50) { $missionSix = "Area 6"; } else { $missionSix = "Bolse"; } } } else { $missionFive = "Titania"; $pathVal = mt_rand(2,102); if ($pathVal % 2 == 0) { $missionSix = "Bolse"; } else { $missionSix = "Bolse"; } } } } } ?>
If you want the entire thing for download, which includes the images and the source, you can get it here
↧
More PHP Fun : Star Fox 64 Route Randomizer
↧