Minigame 1 - Peanut Drop

File Setup, Touch Controls and Mobile Device Simulation:

As the lead programmer of the Peanut Gallery project, it was important to ensure a Bitbucket repository was made that each team member could access if needed. As only two members (Andy and I) need direct access to the file at this time, we took charge on piecing a Unity file together and uploading it to the repository. My experience using Unity and C# is currently limited and diving into the project without background research was unrealistic and potentially dangerous to future development if dealt with poorly. I began by researching touch controls and mobile simulators as these are the most important core requirements for the project.

Touch controls turned out to be far more difficult than I had anticipated. After a number of days researching alternate methods and testing code from Stack Overflow and the official Unity forum, I successfully implemented touch capabilities using Unity’s new input system. This required me to create a singleton script and install the new ‘Input System’ package. Unfortunately, this new system has a very limited number of online contents to assist me in using this package to its full potential. The next hurdle was the device simulation, straight forward yet extremely painful. The universal android screen size/ratio is 16:9 and hence I made the screen bounds to that exact dimension. This turned out to be a huge miscalculation as not all mobile devices follow this universal screen dimension. After downloading the ‘Device Simulator’ Unity package it became clear that multi device compatibility would be a hurdle I would have to tackle further down the road.

Concept play and mechanics:

The next step to the project was to break down how the first minigame would play out. Andy was able to produce an animation of the Peanut Drop minigame that allowed me to break down each mechanic I would need to include to achieve a functioning product.

Andy's 'Peanut Drop' Gameplay Concept Animation.

The animation above breaks down as follows: 

  1.   The trunk at the top of the screen rotates ~40° from left to right. 
  2.   When the player touches the screen, a peanut is fired out of the trunk. 
  3.   A peanut is removed from the peanuts reserve display. 
  4.   The peanut rebounds off of the pins until it falls through or strikes the ‘X’. 
  5.   A win menu pops up when the ‘X’ is struck by a peanut. 
  6.   If the player runs out of peanuts, they lose, and a lose menu pops up.
  7.   Peanuts are rewarded to the player if they win.

At this point there are still a number of unknowns that will be addressed further down the road. 

Development List:

1.       Rotating Trunk Script

I first created a script for the rotating trunk that would continue to rotate during play. This script was quite simple and only required a few lines of code.

2.       Peanut Spawner Script

Next, I created the peanut spawner script. With my limited knowledge of Unity and C#, this was initially quite challenging for me. Once I had learned about the prefab tools, I was able to make a prefab of the peanut that could be instantiated into the scene that would inherit the world position of an empty game object attached to the rotating trunk. Now that the peanut spawns at the correct location and rotation, I had to apply a force to the prefab in the direction it was facing. This was to ensure that the peanut left the trunk on an angle rather than just dropping straight down.

3.       Peanut Collisions Script

Now that the trunk rotates and a peanut can be fired out of the trunk, I had to write a new script that defined the peanuts collisions. This script was attached to the peanut prefab along with a new tag ‘peanut’. Tagging the peanut ensures that it does not destroy itself when two collide (Which happens quite often). The Ad and ‘X’ are also tagged to allow tag based if statements.

4.       Ad & ‘X’ Collisions Script

Much like the peanut collisions script, the Ad and ‘X’ collisions were very similar. This time however, the script uses the tag of the object the script is attached to in determining its course of action.

5.       Pause Script

This script was extremely straight forward, when the player touches the pause button, the time scale is set to 0, which pauses the game. The pause menu screen is then set to active. This script will eventually include actions for Home and Replay buttons.  

6.       Win/Lose Script

This script determines the number of peanuts the player has remaining and will active the lose menu if all of them have been destroyed. The ‘Win’ screen is activated externally from the peanut collisions script when a peanut collides with the target ‘X’.

Problems:

Developing ‘Peanut Drop’ has had only a few production complications so far. These complications include projectile spawn velocity, navigation capabilities for target audience age bracket, and ‘ad’ inclusion.

At first, spawning a peanut would inherit the trunks rotation and position exactly as needed, however, the peanut would just drop on the spot it spawned in as there was no script to give it a velocity. After researching C# syntax and scouring Stack Overflow and the Unity forum, I wrote two lines of code that referenced the rigid body of the peanut prefab and apply force to it in the direction inherited by the trunk. The code goes as follows. 

A Fragment of the ‘Spawner’ Script for ‘Peanut Drop’ minigame.

As discussed previously, the target audience for Peanut Gallery is quite young (5+), and a number of gameplay mechanics were not clear enough to players who are unable to read. To ensure the game is clear, a simplification process was undertaken. This involved removing complex words and adding visual clues such as symbols and buttons. It is still unclear at this time whether children within our target audience age bracket will be able to navigate the game in its current state.

In its current state, ‘Peanut Drop’ has a row of individual ads spawn at the bottom of the screen. The issue here is that the space is far too small to fit ads. If we are to include individual ads as it is now, they would have to be small squares, or I will have to rewrite the spawner script to include ads that fill up more than one space in width.  

Future Inclusions:

I would like to rewrite the script for the peanut reserve display so that they do not have to be lined up but rather spread around and rotated as if they were thrown into a bag. I would also like to add a randomizer to the destroyer function in the script that chooses a random peanut to remove when the player drops a peanut to give the display some character. The issue of the ads is still ongoing and external ideas may be required to determine a fitting solution. Finally, I will set up the curtain animation that Andy has been working that will open up when the player opens the minigame.   

‘Peanut Drop’ Current Product Development State.

Comments

Popular posts from this blog

Minigame 2 - Peanut Shoot