Monday, 8 March 2021

Make Your Own Game

Creating A Game


Ideology - To create a game and have a choice of publishing across multiple platforms for PC, Ios or Android etc.

You first need to download game creator application, one like Unity.

You can download Free version or Paid version.

Please check the details and your requirement and choose carefully.

If you are new and just want to build some games, you can go for free version.

For Free Version click here.

For Paid version with additional options click here.

After downloading you can install the Unity hub.



If you have installed the free version, you can connect to internet on Hub and create a unity account.

Later you can go to "install" option and click on Add.

You can choose within the available versions and click next.




To write the coding you need "Microsoft Visual Studios", if already install you can skip it and if not you can choose Monodevelop.

Now choose your require build like Ios, Pc and Android. You can also install Mac, Linux and Lumin builds.

Select the required builds across platforms and choose documentation.

You can see the total size of the Install version/ builds, and then you can click on Next.



Once you have downloaded the Version and installed, you can see the selected platform and builds

.


To start building game/project,  you can go to Projects and choose New.

 



You can choose if you want to build a 2D or 3D game, Name your game on the right and also can change location for the project if required and click on Create.


 


 

Sunday, 7 March 2021

Understand the Overview GUI – Graphical User Interface of Unity Software;

 

Overview GUI

Once you open Unity software, you can see the new window.



Let’s concentrate on Tabs first, as other dropdown like File, Edit, and Assets etc. will come across while building the game.

The first Tab that we can see is the Hierarchy.

At top you can see the name of the scene (Sample scene). All objects placed here are subjected to this scene.

This tab contains the list of objects that we use to build a game.



As you can see in a blank or empty project there is a default object “Main Camera”.

As we watch movies in theater which are made from Camera and shown in theater, the same way building game also needs camera to display the In-Game Objects.
We can control the camera as per our requirements.

Like Camera, further we will come across various features of objects in the game.

 

Next we can see the Scene tab.

This is the tab where you build and edit your game with game- objects like resizing, reshaping. Also adding multiple objects which a required to fulfill the game like envirment, player or enemy etc.



In 2D game the camera will be more like stationary rather than moving  as in a 3D game because 3D games uses 3 directional Axis (X, Y ,Z) and 2D games use 2 Directional (X, Y). For simple understanding Left right and Up down in 2D game.

Here you can modify shape and resize any of the objects that you wish as per your design.

Next we can see the Game tab.



In this tab you can see the reference of the objects that you have placed in Scene tab but you cannot edit, only see how the actual game looks while playing either with touch controls or with keyboard of joystick as per different platforms like Android, Pc or Ios etc.

Next we can see the Inspector tab.

This tab shows the properties of objects that we are using to build a game and allows us to modify the components of the objects as we require.



Here we come across various types like mesh, collider and scripts, particles and lots more which we will discuss further.

As you can see in the inspector there is Transform option for selected camera which shows

Position - location of selected object as per x,y and Z axis.

Rotation – Required curved angle of selected object as per x,y and Z axis.

Scale -the length, width of height of an object.

In the camera option you can see the properties of camera.

Down below we can see the Project tab.

Here you can see the main Category as Assets, which means the required Objects or supports that you import or build/create in the game can be placed in separate folders to use for applying to objects via Inspector tab or adding to Scene tab.

For example – if you have created a tree in Scene tab and you want to apply textures (image) or materials to it, you can add it through inspector tab selecting the tree.


As you can see there are 4 folders below the Assets:

Scenes - Is the default folder which is used to create multiple scenes.

In simple term scene means the whole envirment that includes all of the objects and the elements in the game.

For Example one level can be done in one scene and for other level you can create a new scene and start building,

I have created 4 new folders in here,
Prefabs – Objects that can be placed in this folder can be used repeated in game as we like.

Scripts – Where we write the coding for behavior and instructions for objects in C# or Csharp as we say.

Sprites– Where we put all the images to be added.

Materials – Just the simple color that we need for objects instead of images.

Below the Assets category, we can see another category of Packages.

Packages are the installs that we require to customize our game and assets behavior which can be installed for Package Manager as we come across further.

Next we can see that Console tab which shows the error, warning or debug text as we do any error in coding. We can see the error and rectify as informed in the message which is very simple.



 

Saturday, 6 March 2021

Setting Up the scene for 2D game.

Scene for 2D game.

At first we need to choose which platform are we building from like Android, Windows etc.

Go to File dropdown and choose Build Settings.(or ctrl + shift + B)





Now if you want to build for Android, you can choose Android Platform and click switch platform button below n wait for Unity to switch close the tab.

In the Game tab, choose 800 * 480 resolution.

Now in the Hierarchy on the left we can see two objects Main Camera and Directional light.

You can right click below and choose UI -  Canvas, a canvas is created.

Basically canvas is the parent for user interfaces like image, buttons and slider etc.

Select the Canvas and in inspector tab choose Screenspace- Camera in Render mode and drag the main camera and leave it in Render camera option and choose UI scale Mode to Scale with screen size. (Setting this will allow screen to change as per the devices installed)




Again Right click and choose 2D objects - sprites - Square and click it.

Now Select the Rect tool and drag the image so that it covers the whole camera, canvas view in Game tab.

Rename the Square to Background, by right click and rename..

When you click on Background in hierarchy, you can see its properties in Inspector tab on right side.

In the inspector we can see sprites Renderer, we need to add and image in the sprites option or choose color. It is better to choose image as it looks pretty good.

I have some images which we can apply to the background in sprites folder in Assets.

To add an image first we need to change image properties by selecting image and on inspector tab under texture type choose Sprite (2D and UI) and click apply. Do this for all images if you have any.



Now select Background from Hierarchy and drag and drop image in sprite folder to Source Image option in Inspector tab.

Now the Background is a layer and we can set in in front or back to other images by setting Order in Layer in Sprites Rendered. As background needs to be lowest so we set it to -3.

Now create another three 2D sprite squares and name them as clouds, tree, mountain and ground or you can duplicate thrice background and change names and images of clouds, flowers and ground.

Now select the tree and scale it with rect tool as you need the size.

Duplicate tree 4-5 times and add place in different locations from Move tool.

Set Order in Layer in Sprites Rendered for clouds and mountain to -2, ground to 0 and trees to -1 for all 3 images.



Let’s now create same way 2 images of Asteroid and Dino and set order layer to 0 for both.

You can see that dino legs are apart coz we need to set animation for player.


In this scene there are 3 interactables Dino – player, Asteroid – Destroyer and Ground – move space.

Other images are stationary so we do not need then working.

For these 3 interactables to work we need colliders and rigid body which we will see in next session. 

Friday, 5 March 2021