What's more fun than a barrel of squirrels? Crazy squirrels on a ship loaded with cannons! Chase down pirate ships while steering clear of the flotsam and jetsam in your way. Steer with either your thumb on the wheel or tilting. Pummel your enemies with the nut-a-polt and blast them with your cannons when you get close enough.
-Benxing Entertainment
-Benxing Entertainment
Hard-A-Port, an "infinite sailing" iOS game, was my first shipped title (with Benxing Entertainment or otherwise.) Fairly soon after starting with the children's educational game company in the winter of 2011, I started work on gameplay programming for the project. By the end of several weeks, I had developed and balanced the "Nutapult" (or Nut Cannon, depending on the phase) as well as the procedural leveling system by which the game speeds up and presents obstacles.
Nutapult and Nut Cannon
Hard-A-Port has two game modes: Endless and Chase. This is something of a misnomer, as Chase mode involved endlessly chasing down enemy ships (as opposed to endlessly avoiding barrels that come out of nowhere.) The practical difference between Endless and Chase mode is that Chase mode adds a combat mechanic by which the player can collect acorns floating in the water and launch them out of a catapult (the "Nutapult!") at the pirate ship they are pursuing in order to advance the game faster.
The Nutapult would have three stages based on how far the player had progressed, and determining both the amount of acorns the player can store and the ease by which the player can aim the shot. Ease of aim would be achieved by simply pitching down the trajectory and increasing the starting velocity of the acorn, so that the player didn't have to do as much guesswork when placing shots.
When the first iteration of this mechanic was put forth, that's about as deep as it was implemented. Since the player's aim radius was restricted by the direction of the ship, and the trajectories were rather steep, it was far too difficult to actually hit the target. To remedy this, I proposed that we build in a handicap that ensured the acorn would always land at the correct distance along the Z-axis, which meant that the player only had to worry about hitting the correct point on the X-axis. This was done by removing the Z-component of a the standard trajectory algorithm and replacing it with a linear interpolation. This meant that the player was effectively firing in a straight line forward from the ship, but the illusion of a real trajectory was still important for aesthetic value.
When the first iteration of this mechanic was put forth, that's about as deep as it was implemented. Since the player's aim radius was restricted by the direction of the ship, and the trajectories were rather steep, it was far too difficult to actually hit the target. To remedy this, I proposed that we build in a handicap that ensured the acorn would always land at the correct distance along the Z-axis, which meant that the player only had to worry about hitting the correct point on the X-axis. This was done by removing the Z-component of a the standard trajectory algorithm and replacing it with a linear interpolation. This meant that the player was effectively firing in a straight line forward from the ship, but the illusion of a real trajectory was still important for aesthetic value.
Other minor tasks I carried out in preparing the Nutapult mechanic were a picture-in-picture cutscene showing the player's friendly pirates operating the Nutapult (shown above on the left), creating art assets for the 3D acorns, 2D acorn visualizations, and the 2D "launch" button, and writing a GUI easing interpolation function to visually display a Nutapult upgrade (shown below.)
Procedural Leveling
The procedural leveling system is simply the algorithm by which Hard-A-Port scaled in difficulty, and revolves around single Barrel Generator scripts. In Chase mode, a derivative Chase Barrel Generator is used.
The standard Barrel Generator tracks the level of the game and generates a weighted random value that dictates what type of Barrel to generate. Obviously, as the game progresses, "drink" and "boost" (helpful Barrels) are gradually outweighed by standard, explosive Barrels.
The Chase Barrel Generator script is actually attached to the enemy ship, meaning that the movement of the ship is determined by the Chase Barrel Generator script. This was done simply so that Barrels could easily be generated at the position of the enemy ship.
The standard Barrel Generator tracks the level of the game and generates a weighted random value that dictates what type of Barrel to generate. Obviously, as the game progresses, "drink" and "boost" (helpful Barrels) are gradually outweighed by standard, explosive Barrels.
The Chase Barrel Generator script is actually attached to the enemy ship, meaning that the movement of the ship is determined by the Chase Barrel Generator script. This was done simply so that Barrels could easily be generated at the position of the enemy ship.