Game Design & Development 1
2020 Assignment 1
Your task is to create a classic little 2D side scrolling Shmup (“Shoot’em up”, think R-Type, Gradius, etc.) game with Unity to get a hold of game development basics.
The basic features it has to contain are:
For this task we would recommend using Unity 2019.4.x LTS (Long Term Support) version. The visual assets and sounds can be created by yourself in any way you like or you can use any of the many freely available asset packs there are.
You’re free to use any literature or tutorials to complete this task, one tutorial we’d recommend as a starting point is this one: https://pixelnest.io/tutorials/2d-game-unity/
Albeit written for an older Unity version it should easily be possible to adapt to a current version.
We’ve come up with a pool of 10 additional features to implement with the basic shmup gameplay. Every student has to choose 2 features to implement, based on the following rules:
List of additional features:
Bonus:
The target frame rate is 30 FPS or more on a PC built from the most used gaming hardware in the most recent Steam Hardware Survey. To measure the FPS just use the provided FPS indicator script (see below). To measure the FPS just use the package provided in Discord. Make sure that you achieve the target frame rate before submitting your game.
Once done implementing your game please deploy a WebGL build out of Unity.
You’re responsible for uploading and hosting your WebGL build, we recommend using github pages:
https://pages.github.com/ (Create a user site if not done already and then create a project site for your game, there you can host your Unity WebGL build)
Submit your game in the TeachCenter!
October 23th, 2020 11:59 PM (= 23:59)
We provide a FPS indicator script which needs to be included by everybody. Paste the following code into a newly created FramesPerSecond.cs file inside Unity and attach this script to any top-level Hierarchy gameobject in your scene.
We uploaded a unity package to the discord gdd channel instead of this, please include the package instead and have a look at discord for all the details.
using System.Collections;
using System.Threading;
using UnityEngine;
public class FramesPerSecond : MonoBehaviour
{
#region Variables
[SerializeField] private Color textColor = Color.red;
private float TargetRate = 30.0f;
Rect fpsRect;
GUIStyle style;
float fps = 0.0f;
float currentFrameTime;
#endregion
#region Unity callbacks
//----------------------------------------------------------------------------
void Start()
{
fpsRect = new Rect(50, 50, 400, 100);
style = new GUIStyle();
style.fontSize = 30;
style.normal.textColor = textColor;
QualitySettings.vSyncCount = 0;
Application.targetFrameRate = 9999;
currentFrameTime = Time.realtimeSinceStartup;
StartCoroutine(RecalculateFPS());
StartCoroutine(WaitForNextFrame());
}
//----------------------------------------------------------------------------
private void OnGUI()
{
GUI.Label(fpsRect, "FPS: " + string.Format("{0:0.0}", fps), style);
}
#endregion
#region Force And [Re]Calculate FPS
//----------------------------------------------------------------------------
private IEnumerator RecalculateFPS()
{
while (true)
{
yield return new WaitForSeconds(1);
fps = 1.0f / Time.deltaTime;
}
}
//----------------------------------------------------------------------------
private IEnumerator WaitForNextFrame()
{
while (true)
{
yield return new WaitForEndOfFrame();
currentFrameTime += 1.0f / TargetRate;
var t = Time.realtimeSinceStartup;
var sleepTime = currentFrameTime - t - 0.01f;
if (sleepTime > 0)
Thread.Sleep((int)(sleepTime * 1000));
while (t < currentFrameTime)
t = Time.realtimeSinceStartup;
}
}
#endregion
}