Introduction: Unity 3D Video Game Tutorial

Like most gamers, we have always dreamed of making a video game, but we just assumed it would be an extremely hard task to accomplish. Nowadays, however, with programs like Unity and the power of the Internet, video game design is easier then ever for amateurs like us. This project will involve 3D modelling, 3D animation, video game design and programming.

After making a 3D model of an anthropomorphic moose for our last project, we decided to continue using it and make it the main character of our 3D video game we made in Unity. In 5 weeks, we made a playable game with collectibles, a timer for added difficulty and GODDAMN WATER PHYSICS!

The purpose of this project was to learn the basics of video game designs and programming in C#. It also let us have another game to play in philosophy class that is both free and addicting

To use it, just open the .exe file for the game and you are ready to play. The controls are simple with WASD for movement imput and R to restart the game

Step 1: Tools and Software Needed

Before we begin, make sure you have the following

Tools

  • Creative Mind
  • Patience (Programming)
  • Computer (Obviously...)

Software

References

-This tutorial is the basis of ours:
https://unity3d.com/learn/tutorials/projects/roll-...

Step 2: Making Character

Since we've already made a character, please check our other tutorial (Making a 3D Model for Animation in Blender) over here: https://www.instructables.com/id/Pissed-Off-Moose-M...

For those who are lazy, feel free to use the character we made by downloading the "pissedoffmoose.obj"

*Notice* Due to time constraints, we didn't manage to animate the character. We used a ball as the player and made the moose a stage prop

Step 3: Create a New Project

First we need to make a new project
-Open Unity
-Click "NEW"
-Make name and add the location for your project
-For simplicity, select some preloaded asset packages
(or 3D model your own and place them in the Asset folder of your Project folder)

-Click "Create Project"

Congratulations, now we can start building

Step 4: Making the Stage

To make stages in Unity, all you need to do is create geometrical shapes that you shape, scale, rotate and place in a XYZ environment:

-Click "Create" in the "Hierarchy" tab
-Hover over "3D Objects" and select desired object
-Shape, scale, rotate and place it
-Rinse, wash and repeat until satisfied
-For added flare, go in the "Project" tab. Here you will find other assets and materials to make your game look less garbage.

Step 5: Making Player

Because of time constraints, we will be using a ball as our character

-Click "Create" in the "Hierarchy" tab
-Hover over "3D Objects" and select Sphere
-Place it in the center of your stage
-Select the sphere in the Hierarchy, and rename it “Player.”
-Click "Add Component" at the bottom of the "Inspector" and , in the "Physics" tab, add "Rigidbody"

Now lets add the program that will control the ability to move, pick up objects, keep score, win and reset

-Click "Add Component" and select "New Script",
-Name the script "PlayerController," and choose CSharp (C#)
-In the "Project" tab, create a new folder called "Scripts" and place your new script there (organisation is key)
-Open the script file and this will open Microsoft Visual Studio (or your default programming software)
-Add this code:


Step 6: Making the Camera Follow the Player

If you start playing now, the camera doesn't follow the play. Let's fix that:
-Set the position of the camera (preferably 10 units away and facing 45 degrees down
-Using the "Add Component" button, choose "New Script" and name it "Camera Controler".
-Now add this code to it:

Step 7: Making Collectibles

With a controllable player, now our game needs an objective. In this one, it will involve collecting objects.

-Create a new object (e.g. cubes, capsules, barrels,...)
-Have hover over the ground slightly
-In the inspector tab, change the tag to "Pick Up" (you must create a new tag called "Pick Up")
-Add a new component: Physics -> Mesh Collider
-In the mesh collider settings, check the "Is Trigger"
-Make 7 more copies (8 objects total)

Now when you collider with the object, it disappears and adds a point to your score
When you collect all on them you win, but to show this message, we need to make the UI first

Step 8: User Interface (UI)

First we need a scoreboard
-Create a "Text"
-Name it "Score" (for organisation)
-Place it in the desired spot
-Modify the font and color
-In the script component for the player, drag this new Text into the "Count Text" box

Second, we need a "Winner" pop-up when you pick up all the collectibles
-Create a "Text"
-Name it "Score" (for organisation)
-Place it in the desired spot
-Modify the font and color
-In the script component for the player, drag this new Text into the "Count Text" box

Third, we need a "Try Again?" pop up for when you lose (time hits 0)
-Create a "Text"
-Name it "Lose" (for organisation)
-Place it in the desired spot
-Modify the font and color
-In the script component for the player, drag this new Text into the "Lose Text" box

Lastly, we a need a "Press 'R' to Restart" indicator
-Create a "Text"
-Name it "Restart" (for organisation)
-Place it in the desired spot
-Modify the font and color
-In the script component for the player, drag this new Text into the "Restart Text" box

Step 9: Making a Time

Next, we need to add a timer that will stop the game when time is up.

-Add a "New Script" named "Timer" to a random stage object (e.g. The floor)
-Add a new Text to the UI and name it
-Modify it by placing it and changing its font/color
-Add this script (Timer.cs)
-In the script component, drag the Timer Text into the box that says "Timer Text"

Step 10: Project to Video Game

With our finished project, now lets make this a stand-alone application that will let us play the game simply by opening a launcher.

-In "File", open "Build Settings"
-Select the platform you want to play your game on (PC is recommended)
-Add your Scenes (Levels)
-Click "Player Settings" to add the name and icon to your game"
-Click "Build and Run"
-Enjoy your game

Step 11: Conclusion

In conclusion, creating a video game from scratch was a lot more work than we thought it would be but we still managed to do a lot of things on our own and learn a lot in the process. We learned valuable things about the process of making a game but also how to meet a deadline and set reasonable goals. Animating a self-built mesh is a lot more complicated than we thought but nonetheless we are satisfied with the model itself and it’s texture.

Since we were not able to come up with a satisfying rig for the character, we were not able to animate it. We lacked time and the resources available were not clear nor complete. As a solution, we integrated the moose as a statue in the game, meaning it does not move but is still relevant and present in the game since he is in the middle of the map. In addition, we were not able to program enemies because of the lack of recent and updated resources. Because we still wanted to have some sort of obstacle or difficulty in the game, we added a 15 second timer. So the player can now race against the clock to complete the game.

Overall, we are very proud of our project and would like to learn more about the process of making a video game.

Comments

About This Instructable

2,012views

13favorites

License:

More by DinoR5:Unity 3D Video Game TutorialPissed-Off Moose: Making a 3D model for animation
Add instructable to: