Tuesday 8 November 2016

BASIC UNITY GAME


We will develop a very basic game. The aim is to give basic knowledge needed to create a functional game.

To start a game, you need to have a story line that will guide you game. Any update to game follows update to the story.

Our basic games is: Catch A box. 
The title of the game is simple and self explanatory.

Story line:
The game involves some boxes that drop from above and the player is required to collect the boxes. At the end of the game. the player should be able to tell how many boxes we generate and how many s/he managed to collect.

From story line above:
The required assets are just the box and few images. We don't need to download any assets for this game. Advanced well, the game can create one of the successful games. This is to mean that you don't need fancy assets to create a game.
We also need to show our results. The player should also be able to control the box.

The story line above will be update as the game evolves till a complete game is ready for the play store.
  1. You need to plan for you marketing. Don't wait till you game is live in store to start marketing. Making it in android play store requires extensive marketing.
  2. Create social media accounts for your game. Have enough followers to download your game.
  3. Have alternative ways of getting your game know to the world. This requires creativity.
  4. Regularly update your game. 
  5. Play your own game to know the weaknesses.
  6. Focus on strong points when marketing.
  7. Critics will be there whether the game is good or not. What matters is never quit.
  8. Never use copyrighted music or music you are not sure about ownership. Google has systems to check and confirm the music assest online. You account can get disabled.  Youtube has free to use music.
  9. If your app is disapproved due to copyright, it is not easy to reinstate it.
Our simple Game.
The game in this tutorial is basic game to demonstrate how to develop games in unity. The game is a 2D.
Please follow steps described in the tutorial: Basics you need to know here. Name the project as "Catch A box." 
Make sure you are under scene view. We now add a box. It is a 3D object added to 2D view.

We can add it in two ways
  1. From GameObject menu -> 3D object -> cube.
  2. From hierarchy, create -> 3D object -> cube.
Make sure you can see the rectangular box in both scene view and game view. The position does not matter at this time. We will work to position it to the right place as we build our game.

In the inspector, the setting for our box are now visible. Transform settings helps in positioning, scaling and rotating the box. collides will be used to test if the box comes into contact with any other game object.

Select the box if not selected in the hierarchy menu and in the inspector menu, change the name from cube to box as show below. Change its y position to 4.

We also need to add floor where all boxes will fall to. Add another box, call it catch up and adjust y position to -4.5 and scale it to 3 along x.

click on game view to see how the two boxes look like. We have now our bases for the game. The box at the top represent the box falling down while the one at the bottom represent the box capturing the falling boxes.

The box at the top will use gravity to fall.

In the next lesson, we learn gravity and collision. We will let the box fall and capture it with the box at the bottom.

To add movement to our box. We will add gravity to allow free fall of our box. The box will continue to fall till it comes across an obstacle. In our case, we need to capture the box

Select the box. Move to the inspector panel and add component. Select Rigidbody and not Rigidbody2D since it is a 3D game object.

Don't change the settings. Ensure Use gravity is ticked. Also ensure Box collider is present. Don,t tick "is trigger". This would cause our box to pass the catch up box.

Select catch up and make sure box collider is added and "is trigger" is disabled. Don't add Rigidbody as we don't want this box to fall.


Click the play button and watch the box fall down.


We need to redefine our game and make it more interesting hence need to update our story line. Every game is developed along a story line. This makes it easier for you to update the game without changing the original game plan.

Story line:
The game involves some boxes that drop from above and the player is required to collect the boxes. At the end of the game. the player should be able to tell how many boxes we generate and how many s/he managed to collect.

From the story line, we have managed to add box, move and pick it. The story line describes boxes with player collecting them. The player needs to know how many we released and how many were collected.

Task ahead:
  1. Generating more boxes.
  2. Player collect them.
  3. Display boxes generated
  4. Display boxes collected.
Generating more boxes: - We need to generate additional boxes. Our story line does not specify how to generate. This creates a scenario which defines game levels.
Level 1 ->  Generate one box at a time
Level 2 ->  Generate 2 or more boxes at a time and different intervals.
Level 3 ->  Generate and move the boxes to different directions.
and so on.

Player collect them: how does the player collect this boxes. Again this can define more levels. The player can move right to left. There can be obstacles he must jump to collect the box.

Working with current story line, we are left with displaying boxes collected and generated. this involves coding. As noted earlier, knowledge in C# (object oriented) is necessary at this point. We will walk together and explain the code in details.

We will then redefine the story line to describe how he should collect the boxes. This will now define our levels. The game can also be endless where we don't define levels but let the player continue with game changing the play settings each time certain score is reached.

No comments:

Post a Comment