Wednesday, February 22, 2017

Day 15: Starting a New Game - RPG

Yesterday I decided to jump right in to making a simple RPG. I will probably be deviating a bit from the tutorials, but for the most part, it will be the same.

In the first tutorial video (which might take two or three days) I will be setting up the scene and player movement. Now, the player movement in the tutorial is "click to move". I don't like that much, so I will attempt to make an option to switch to third-person locked view, probably by pressing the "V" key.

First off, I need to get an asset pack called "Low Poly Free Pack". This allows me to set up the scene without having to make everything from scratch.

In the Hierarchy I made an empty object. This is where I will put everything so I can move it all around at once if need be.

Next, I made a cube, and scaled it up to 15x15x1. This will be the ground.

Coloured it and scaled it up a bit more.

I then used a bunch of assets from the asset pack to create a scene/

That done, I added another light source, turned shadows for it off, and made it purple. This will help give the scene a "night" feeling later on. I also added fog.

After a while, I finally found some lighting settings that I liked/

I then added light sources in the lantern and the crystals.

The biggest thing I learned today in the tutorial is how to customize lighting. Next class I will finish up creating the scene (the first half of the video), and move on to player movement control (the second half).




Tuesday, February 21, 2017

Day 14: Building the Game

When a game is "Built", it can be built for many different platforms: PC, mobile, console, etc. I decided to build it for PC to start with (console and mobile are more complicated). To start, I needed to open the Build Settings window.

I then selected the scene(s) I wanted in the game (there was only one), clicked "build", and saved it in a "Builds" folder as "Roll-a-Ball Built".

Now to test the game itself.

And it works! A few things I would like to do (and I might, at a later date) is add a menu with a restart button and sensitivity options, more "levels", mobile support, and sounds. For now though, I am officially done with this project.

Here's what I learned throughout the Roll-a-Ball tutorials:

  • How to create new game objects and:
    • position them in the scene
    • add components
    • how to add custom behaviours using scripting
  • Lights
  • Camera
  • RigidBody physics component
  • Triggers
Next class, I plan to do another tutorial, this time on making a simple RPG game.



To test the game, download the folder here, unzip the folder, and run the executable file inside.

Monday, February 20, 2017

Day 13: Displaying Score and Text

To make the game 'count' how many objects have been picked up, I needed to add another variable to the Player Controller script. The script I added has a green description next to each part of it.

Now, to display text, I needed to create a new text object.

The script that I then added creates a variable called "CountText", and it is set equal to the Count variable every time a object is picked up.

Now, to connect the text object to the script, I simply dragged it into the  "Count Text" slot in the inspector.

It works.

To make the "You win!" text at the end, I first created a new text element, same as last time. I named in "Win Text" (not shown).

Now, to display the text, I added a new variable...
And added some code to display the text "You Win!".
And it works!

Next class I will "Build the game and deploy it using a standalone player". In other words, it will be an independent game from the Unity game engine.



Friday, February 17, 2017

Day 12: Collecting the Pick Up objects

To make the player collect the objects, I needed to add a script that detects when the ball collides with the Pick Up objects and makes the Pick Up object disappear. This script (below) causes the pick up object to disappear when the ball touches it. That way, the ball won't bounce off of it.
Now, this script doesn't do anything by itself, since the pick up objects also have to "agree" with the ball's code. The ball is looking for an object with a tag of "Pick Up". The pick up objects currently don't have that tag. So, to fix that, I simply add a tag to the main prefab.

Now the object should "agree" with the ball's code. One more thing I had to do is make the pick up objects into "triggers".

Now to test it out.

It works! Now, to minimize the amount of resources used (number of calculations), I added a "Rigid Body" component to all of the Pick Up objects, and selected "is kinematic".

For Future Reference
-Use Gravity: self explanatory. gravity affects the object.
-Is Kinematic: The object isn't moved by physics forces, ie. Gravity or collisions. It can only be affected by transformations (movement scripts, for example)
-Freeze position: Keeps the object in that position indefinitely (unless disabled by a script). The object does not react to physics forces, and can not be moved with scripts before being disabled.

Next class I will add a score system.

Day 11: Creating Collectible Objects

To create a collectible object, I first created a new cube and named it "Pick Up". Simple enough. I then unchecked the sphere to hide it.













To make it more interesting, I made it smaller (so it looks like it's floating), tilted it 45 degrees in each axis, and added a script to make it rotate and made it yellow.

Once I got the aesthetics out of the way, I made the pickup object into a 'prefab' by dragging it into a Prefab folder I made. This means I can edit the prefab and any duplicates of it in the scene will all be edited.

I then made a parent object to hold all the pickups in the scene, and dragged the pick up object into it.



















To duplicate the object, I pressed ctrl+D, and dragged the duplicate where I wanted it.

Tomorrow I will learn how to make the player pick them up when it touches them. I will also learn how to add a scoring system.

Wednesday, February 15, 2017

Day10: Setting Up the Play Area

To start, I need to make walls for my play area. To do this, I first made a new game object called "Walls". This will be the parent object for the walls themselves.
Next, I create a new 3D object (cube), and name it "West Wall". I then parent it to the "Walls" game object.

Now I just need to scale it. The values I use are x=0.5, y=2, and z=20.5

Turns out I hadn't scaled the plane up as well. I took a couple seconds to fix that.

Now all I do is move it, and repeat the process three more times.
Now the ball can't fall off the play area.

Next class I will be creating the objects for the player to pick up.