Introduction
Welcome to GDD211!
In GDD211 we will continue learning hwo to use Unity to bring your game ideas to life. In this course we focus on three areas of development:
- Animation
- User Interface
- Programming
The lessons learned in this course will continue to build the foundation needed for a career in Unity development for programmers and artists.
Learning Objectives
- Students will:
- Learn how to create sprite based animations for 2D games.
- Learn how to create tweened animations for 3D games, using transitions, blend trees, and animation events.
- Learn how to design and implement a functional user interface.
- Explore more of the c# programming language and learn how to get the most out of your code.
- Create games.
Introduce Yourself
- Let us know who you are, why you're here, your experience in game development, and the area of game development that you're most interested in. This will help me introduce material to the course that might help with your specific interest if there isn't otherwise a lesson on that subject.
- Show off or discuss anything you've made in the past
- Tell us your favorite game/genre
Getting Started
!
When doing work for this course it is recommended that you avoid saving/installing Unity projects to OneDrive folders. Also avoid special characters in your file path names.
The safest bet is a simple path on your machine, ex: C:/GDD/211/i>. You will want to make sure you back up your work on an external hard drive or use a version control system like GitHub.
- Review the course syllabus and grading rubric.
- Download and install Cyberduck to connect to MyWebspace FTP . Instructions on how to connect
- Cyberduck will allow you to copy files from your computer onto a server so that they can be viewed from the internet. This is how you will share your work.
- When connecting: User name "mywebspace.quinnipiac.edu|QUUsername" (there is a vertical pipe before you enter your QU Network Username, the shift+backslash key)
- Use the Bookmark > New Bookmark button in Cyberduck to save the connection for easier log in.
!
The files that you add to Cyberduck become copies that no longer live on your machine anymore. This means that whenever you update a file on your
machine you will need to upload that file again to update the Cyberduck version of the file.
- Create your own (HTML/CSS/JavaScript)
- Copy this example portfolio to your computer and change the HTML to display your name.
- This website will host links to all of your work. When you build an exercise or project it will generate a webpage. The links on this portfolio will point us to your builds.
- To save the page: Open the page > right-click on the background > select Save Page As. Create a folder on your computer for your course work, ex: c:/GDD/GDD211/Portfolio and save the webpage in there as index.html.
- Open your portfolio in a text editor so you can change the HTML to work for your account. Use VSCode if you need a text editor.
- Change the name at the top to your page and change the username cblake inside all of the links to your username. Ex:
<header> <h2>Lab 1</h2> </header> <section> <nav> <ul class="lab_links"> <li><a href="yourTrelloURL"target="blank">Lab 1 Project Management (Trello Example)</a></li> <li><a href="https://mywebspace.quinnipiac.edu/yourUserName/buildFolder">Lab 1 WebGL Build</a></li> <li><a href="yourGitHubURL">Lab 1 GitHub Repo</a></li> </ul> </nav> <article> <h1>Example Lab 1 Project</h1> <img src="http://mywebspace.quinnipiac.edu/yourUserName/imageName.gif"style="width:200px;height;200px;"> <img src="http://mywebspace.quinnipiac.edu/yourUserName/image2Name.gif"style="width:200px;height:200px;"> <p>Description of your game!</p> </article> </section>
- You can now upload a copy of your portfolio to MyWebspace. Inside CyberDuck make a directory called 211, and drag your index.html file into it. To make sure it works you can try clicking the link to your name in the Student Work section or navigating to: http://mywebspace.quinnipiac.edu/username/211/
- This is the most basic example of a working portfolio, I encourage you to explore HTML, CSS, and JavaScript to make it look more interesting!
- Use Canva Template
- Open template here. You will need to create an account and save a copy of the portfolio for yourself.
- Edit the portfolio to include your name, the course title, and your work.
-
Save your Canva as a website
Share > More... > Website > Standard - Email me the URL for your website so I can link your name to it on the Student Work page.
- Installs > Install Editor > Unity 2022.X.X.
- Required Modules: Microsoft Visual Studio 2019, WEBGL Build Support, Windows Build Support. Once you have selected these modules you can begin installation.
Lab 1
Advanced Animation
In this lab we will cover all of the ways to animate your 2D and 3D games.
For 2D games we will be using sprite sheets, or a single image that contains all of the frames of our animation. This image is then sliced into the individual frames inside Unity so that they can be shown one-at-a-time.
In our 3D games we want to use tween based animation, where the 3D mesh is given key poses to reach throughout their animation and then the scale, position, and rotation, moves between those frames over time.
!
This course requires you to use GitHub to download example projects and to host public repositories for your work. Using GitHub Desktop is the easiest way to
do this.
- 1. Download the Lab 1 Example Project from GitHub
- Click the link to open the GitHub repository
- Open the button and select Open With GitHub Desktop
- Select a location to copy the example project on your machine and select Clone. This will create a copy of the Unity project on your machine so you can follow along with the lecture
- 2. 2D Animation
- Creating a sprite sheet
- Installing Unity 2D Sprite package from the Package Manager
- Sprite sheet import settings in Unity
- Sprite sheet slicing in the Sprite Editor window
- Creating the player GameObject with sprite renderer and animator components
- Creating the animation
- Playing the animation
- 3. 3D Animation
- Creating a model with a mesh and armature. Download Blender to create and rig a model.
- Importing model into Unity
- Adding the model to your scene
- Animating the model
- Playing the animations
- Using Blend Trees to control animations
- Using Animation Events
- Using layers in animations
- 4. Creating a GitHub Repo
- Post your repository on your portfolio
Lab 1 Project
Your goal for Project 1 is to create a game that uses at least one 3D model that has at least 3 animations. The animations should
be controlled by setting parameters of the animator.
You can use models and animations you find online, as long as you build out the animator and control the transitions yourself. Don't forget to credit the creators of content you use in your work on your Project Management board.
Remember to include all of the required content detailed on the grading rubric page.
You can use models and animations you find online, as long as you build out the animator and control the transitions yourself. Don't forget to credit the creators of content you use in your work on your Project Management board.
Remember to include all of the required content detailed on the grading rubric page.
Recording of Lab 1 lecture available as a resource for you to see and hear the lesson again.
!
If we are unable to get through all of the material in class you will need to watch the recorded lecture and complete the lesson on your own. Please ask me questions via email/Discord
and schedule meetings during my office hours as needed!
Lab 2
User Interface
In this lab we will dive into Unity's Uesr Interface tools.
Our first lesson will review anchoring UI elements and we'll cover how to use anchor points to ensure your UI looks correct at various aspect ratios and resolutions.
We will also look into the properties of the canvas component to give you full control of your UI.
Next we will learn how to create buttons that call functions in your scripts, allowing them to control UI menu items, influence game objects, change scenes, etc.
We will explore the various ways that UI components can pass data into functions, allowing components like the slider to send it's value into a function.
Finally, we will create look at some examples of creating User Interfaces for menus, forms, and world space information.
!
This course requires you to use GitHub to download example projects and to host public repositories for your work. Using GitHub Desktop is the easiest way to
do this.
- 1. Download the Lab 2 Example Project from GitHub
- Click the link to open the GitHub repository
- Open the button and select Open With GitHub Desktop
- Select a location to copy the example project on your machine and select Clone. This will create a copy of the Unity project on your machine so you can follow along with the lecture
- 2. Understanding the Canvas
- Discuss resolutions/aspect ratios
- Create new Game View resolution settings
- Canvas Render Mode
- Canvas Scaler
- Graphic Raycaster
- 3. UI Anchors and Rect Transform
- Creating UI elements that work at various ratios / aspect ratios
- 3. Buttons and other UI Components - Static and Dynamic Functions
- Buttons
- Toggles
- Sliders
- Scroll Rect
- Grouping Components
Lab 2 Project
Your goal for Project 2 is to create a game that uses at least two UI components in a game.
At least one UI element should control something in the game, passing data from the component into a function that is used in the game.
Another UI element should display some dynamic data, data that changes as the game is played. Think: Player Health, Ammo, Location, etc.
At least one UI element should control something in the game, passing data from the component into a function that is used in the game.
Another UI element should display some dynamic data, data that changes as the game is played. Think: Player Health, Ammo, Location, etc.
Lab 2 example by Matthew G
Lab 3
Programming Deep Dive
In this lab we look closer at some programming concepts we've been using and introduce new ones. We'll begin by picking apart classes and instances of classes. Then we'll look closer at using arrays and loops. We'll also look at using enums and switch statements as control structures. And finally we'll explore polymorphism and learn how to use to inheritance and interfaces.
- 1. Download the Lab 3 Example Project from GitHub
- Click the link to open the GitHub repository
- Open the button and select Open With GitHub Desktop
- Select a location to copy the example project on your machine and select Clone. This will create a copy of the Unity project on your machine so you can follow along with the lecture
- Classes
- MonoBehaviours and C# classes: Monobehaviour classes are C# classes which inherit from another class,
called
MonoBehaviour
. These classes can utilize theStart
andUpdate
functions because they are defined inside theMonoBehaviour
class. -
Here is a
MonoBehaviour
class for our Player.
Players have an Inventory field and when it is initialized with a newInventory
object, theInventory
constructor is called.public class Player : MonoBehaviour { private Inventory inventory = new Inventory(); // Create a new inventory object, Inventory constructor initiailizes object private void Start() { Debug.Log(inventory.Gold); Debug.Log(inventory.Silver); // output: 5 // output: 10 inventory.AddGold(10); Debug.Log(inventory.Gold); // output: 15 inventory.DropAll(); Debug.Log(inventory.Gold); Debug.Log(inventory.Silver); // output: 0 // output: 0 } }
TheInventory
class is not a MonoBehaviour, because it does not inherit fromMonoBehaviour
. It is a regular C# class that would work outside of Unity.
TheInventory
class contains a constructor, properties, fields, and public functions used to control the class data.public class Inventory { public int Gold { get { return gold; } } public int Silver { get { return silver; } } private int gold; private int silver; public Inventory() { gold = 5; silver = 10; } public void AddGold(int amnt) { gold += amnt; } public void DropAll() { gold = 0; silver = 0; } }
- Static modifier
-
Marking the properties of a class as
static
will make them properties of the type itself, instead of instances of the class. This means that instances of the class share the value of the property. -
In this example, an enemy registers itself with a
static
list of enemies on the EnemyManager. The enemies don't need a reference to an instance of the EnemyManager because the list belongs to the class itself.public class Enemy : MonoBehaviour { private void Start() { EnemyManager.AddEnemy(this); Debug.Log(EnemyManager.EnemyCount); } } public class EnemyManager : MonoBehaviour { public static int EnemyCount { get { return 0; } } private static List
enemyList = new List (); public static void AddEnemy(Enemy enemy) { if(!enemyList.Contains(enemy)) enemyList.Add(enemy); } } - Arrays, Lists and Loops
- Arrays are data containers where a single variable can have multiple values, accessed by an index.
- Arrays are immutable
string[] myStringArr = new string[4];
- Lists are mutable
List<string> stringList = new List<string>();
- While loops need a condition defined outside the loop, that is modified inside the loop.
int x = 0; while(x > 100) { x++; }
- Enums and Switch Statements
- Inheritance
- Interfaces
- Pillars Of OOP
Lab 3 Project
Your goal for Project 3 is to create a game that uses inheritance. You should have at least one base class
from which two child classes inherit. Example:
Base Class: Food | - float healing | - float cost | - function Eat() | |__ Child Class: Fruit | - float speedBoost | - override Eat to apply boost | |__ Child Class: Vegetable | - float armorBoost | - override Eat to apply armor
Lab 2 example by Matthew M
In this example, the players weapons inherit from a base Weapon
class allowing the player to call a Fire()
function on any weapon and letting the weapon take over and handle firing itself.
Link to Teams Spreadsheet
Section 1
- 🚹The Guys🚹
Jared L Zachary M Darrell J Richard V - 🐒Ape 8🐒
Kevin T Conner K Max R Victor F Jai H - 🧨 Dynamite Dingos 🦊
Ethan L Jesse D Jesse C Kyle M - 🍀 Team 4 🍀
James C Matt M Aleena G Stephen R - 🐈Catastrophic🐈
Taylor J Khila S Brian P Shane M
Section 2
Project 1
Project 1 is designed to give students the opportunity to work on teams and develop a game that interests them.
In the Design Phase of the project, teams are encouraged to put great thought into what game they will make.
Use brainstorming techniques and assess the viability of each idea based on the team's skill set and timeline for the project.
After a high level concept is selected, teams should start a design document where they begin to fully detail every element of the game. This document should
provide enough detail that everyone on the team can look at the document and derive the same understanding about any element of the game from it.
In the Development Phase, teams will begin completing tasks in weekly sprints. Teams should conduct daily and weekly scrum where team leaders will assign tasks for team members to complete.
At the end of each sprint (1 week) teams should meet to discuss what they were and were not able to complete, to prepare for the following weeks tasks.
- Design Phase
- Team Formation - Introduce self and describe which role you can fill on the team.
- Required Roles
- Team Lead: Responsible for general leadership of the game's production. Ensure the functioning and well-being of the team. Resolve disputes. If there are team issues, this will be my point of contact.
- Scrum Lead: Responsible for organizing task lists w/individual team members. Ensure effective communication during development. Keep team members on tasks and completing tasks on time.
- Potential Roles
- Art Lead: Responsible for leading art direction. Disseminating tasks to artists to complete current sprint. Ensuring art assets look like they all belong to the same game and support the art direction outlined in the Design Document.
- Programming Lead: Responsible for assigning programming tasks that support tasks outlined in current sprint.
- Brainstorming - Given the available team and project timeline, brainstorm ideas for potential games.
- Use a defined brainstorming/ideation method, don't just chitchat about ideas. These methods are designed to elicit creative ideas from all team members, sometimes team members have difficulty speaking out in large groups so just expecting everyone to describe their ideas in a chaotic group setting might cause your team to miss out on valuable creative input.
- After brainstorming, the team needs to decide on a game idea/mechanic to begin with. This can be anything from high-level idea to a finely detailed concept. As long as there is something interesting from which a game can grow the starting idea can work. Games always evolve as they are developed, don't feel like your team needs to be locked into your initial pitch.
- Design Document Creation
- Begin creating your design document. This is a living document that serves to inform everyone on the team of exactly what the game is supposed to look and feel like. Consider detailed information about:
- Overview: This should be your elevator pitch paragraph revised to incorporate any feedback from class.
- Gameplay: Describe the game's mechanics. How does the player interact with the game? What is the player doing from moment to moment? What is the goal? When does it end?
- Game Elementss: Describe the elements in the game. How do they interact with each other or the character (if there is one)? What are their attributes? Are there NPCs that live in your world? Complex factions that shape the culture of your characters? Is the environment Earth-like, or something alien?
- Artistic Direction: What will the game look like? Why? Decisions about artistic direction should be made to evoke a feeling from the player. Is the feeling of your game fun and comical? Or is it brooding and cold? How does your art direction support this theme?
- Visual Design Document: Explain your game visually. You should include text when appropriate, but do so minimally. You may use one of the following approaches. Please choose the one most appropriate for your game. Draw.io is a great tool for creating flow charts and diagrams, however, use whatever tool you are most comfortable with. I'd highly recommend choosing the hybrid example as one of your choices.
- Hybrid: Here is a hybrid (storyboard + layout). Here is a well-executed student hybrid document. Although it could be cleaned up, it does a great job visually communicating the concept.
- Flowchart: Here is an example from a pet training game. Here is one from a narrative-based puzzle game.
- Storyboard: Here is an example. Here is another that could be cleaned up.
- Map: Here is an example. Here is another.
Design Document Examples Click orange links to open in fullscreen