Day 45: Time.deltaTime

I grew up playing on dedicated consoles like the Sega Genesis where a game would run exactly the same no matter whose Sega you played it on.

On PC, developing a game means having to adapt code to run smoothly on virtually an unlimited amount of computer configurations.

This is where the concept of Time.deltaTime comes in. (I’m just reiterating what I’ve learned to solidify the points in my head – feel free to correct me if my understanding on any of the points are wrong)

Let’s say I’m creating a game where I want to move an object at the speed of 6:

public class moveObject : MonoBehaviour
     public float speed = 6f;
     void Update()
         transform.Translate (speed, 0, 0)

But I’m poor and have a slow computer. It runs the game at 30 frames per second.

FPS (30) * speed (6) = 180 (distance moved)

Someone else has a faster computer. It plays at 55 frames per second.

FPS (55) * speed (6) = 330 (distance moved)

In one second, the game object on the faster computer traveled nearly twice as far in the same time because it called the Update() function 25 more times in one second.

Time.deltaTime is used make this movement frame independent. It represents the time passed in seconds since the last Update().

public class moveObject : MonoBehaviour
     public float speed = 6f;
     void Update()
         transform.Translate (speed * Time.deltaTime, 0, 0)

My Slow Computer
30 (frames) / 1 (second) = 0.0333333333333333 (time between updates)
Speed * Time.deltaTime =
6 * 0.0333333333333333 = 0.2 (amount moved each frame)
30 FPS * 0.2 = 6 (distance moved each second)

Someone’s Faster Computer
55 (frames) / 1 (second) = 0.0181818181818182
Speed * Time.deltaTime =
6 * 0.0181818181818182 = 0.109090909909091
55 FPS * 0.090909099090909 = 6 (distance moved each second)

Using Time.deltaTime made the distance traveled by the object frame independent. Now no matter how fast or slow your computer runs, it will move at the same rate on screen as another player’s.

The same principle applies on the same computer. If I have a lot of programs running, my game might be running slower at some points and faster at others. Time.deltaTime will smooth the movement of the object instead of it looking twitchy each time Update() is called and the object ‘rushes’ to catch up.

In the same vein of frame rate independency, I also need to learn about FixedUpdate() for physics calculations.

Current Progress Status

  • Tower Defense Tutorial: 47/73
  • Unity in Action (Pg 324 of 352)


Day 40: Mixamo

Just spent a little time playing with the free Mixamo 3D characters and animations in Unity.

Also bookmarked UMA 2 in the Unity Asset store for creating customizable characters – will have to look at this more in depth later.

Current Progress Status

  • Tower Defense Tutorial: 39/73
  • Unity in Action (Pg 229 of 352)


Day 38: Editing Multiple Prefabs

I was never able to select multiple prefabs in Unity’s Project window and edit them in the Inspector like I was seeing done in tutorials.

Unity apparently overhauled their prefab workflow in 2018.3(?) which no longer allows users to do so. (I’m on 2018.3.6f1)

There are two ways to go about getting this functionality back.

Workaround method: Drag the Prefabs into the Hierarchy window. Select them and edit the properties you wish to apply to all of them. Then in the Inspector window, click on ‘Overrides’ and then ‘Apply all.’ The changes have now been effected to all of the Prefabs and you can delete them from the Hierarchy.

A bit of a hassle, but it works.

Install preview build: Unity heard the grumblings and developed a preview build that allows multiple prefab editing from the Project window. Read more here. (I like how Unity listens & responds to their base and makes adjustments when feasible)

Until that particular build passes their Alpha/Beta testing, I’ll continue using the stable version with the workaround.

Current Progress Status

  • Tower Defense Tutorial: 37/73
  • Unity in Action (Pg 207 of 352)


Day 25: Assets & Resources

This entry will be short…it’s been one of those days. Admittedly, I’m glad I started this daily blog because it forces me to accomplish something each day. It has been a great tool to keep me accountable.

I’ve set up this page to help me keep organized and for ease of reference. It will be updated with links to free assets, tutorials and other resources that I’ve found helpful or am planning to look into further. It’s still fairly sparse, but will add more as time goes on.

Tower Defense Tutorial Progress: 5/73

Only progressed through one video today, but it’s still progress.


Day 24: Hard Work ≠ Success?

“Help me understand what the hell is going on. I have made the biggest mistake of my life”

Reading this reddit post made me really feel for the developer. Tldr: indie dev spent 4 years and a lot of money on his game, released on Steam, Android, and iOS and has only “recouped less than 10% of [his] money thus far.”

The game looks very polished. Why didn’t it live up to the dev’s expectations?

I’m trying to take to heart all the constructive criticism in that thread. I would also love to hear your thoughts on why you think his game isn’t performing as well as he thought it would and what you would’ve done differently (or do going forward) if you were in his shoes.

Tower Defense Tutorial Progress: 4/73

I learned having public fields is generally bad practice in OOP but that Unity still allows you access to private fields in the Inspector by using SerializeField. I can have my cake and eat it too!

The first several videos have been about setting up the game grid through code. Since the tutorial was created, however, Unity has added a new Tilemap system making it so much easier. I’ll have to back and try out the new system sometime later.


Day 23: Language Immersion

I spent a summer in Germany one year and wound up watching a lot of TV during my stay. The subtitles were always on: German show, English subtitles and vice versa. Because German uses the Latin alphabet too, it was easy to follow along.

By the end of a few weeks I had begun to recognize and pick up common phrases like greetings, pronouns, and the like.

That’s the stage I’m at in my learning C#. It’s looking less like a completely foreign language. I’m recognizing keywords, modifiers and parameters. I know I’m making progress even if I don’t understand everything 100%.

Isometric Gaming

Unity just added a blogpost & video tutorial regarding the Isometric Tilemap support which was added in 2018.3. This type of visual perspective appeals a lot to me since many of my favorite games utilized this view.

The new Tilemap features provide a fast and performant way to create 2D environments based on isometric and hexagonal grid layouts, the likes of which are seen in many game classics, including the first entries of the Diablo and Fallout franchises, Civilization, Age of Empires, and many more.

25GB+ of Sound Effects (Free)

Sonniss GameAudioGDC Bundle

​In celebration of GDC 2019 we are giving away 25GB+ of high-quality sound effects from our catalogue. Everything is royalty-free and commercially usable. No attribution is required and you can use them on an unlimited number of projects for the rest of your lifetime.

This reddit post also contains links to previous year releases

Tower Defense Tutorial

Progress: 2/73 videos

This will take a lot longer than I first outlined in my weekly goal. At 20 hours of video, which means more like ~40 hours including implementation, it will take about a month if I work on it ~1 hour a day.

No more dillydallying then.


Day 22: Tower Defense Tutorial

Today I began inScope Studios’ tower defense tutorial. The entire 73 video playlist clocks in at 20 hours, 38 minutes – that’s a lot of learnin’!

I signed up to Patreon so I could purchase the assets for the tutorial. Five dollars for 20+ hours of content (that part is free) and assets that are permitted for (re)use in any personal or commercial game is a deal. (My monthly recaps will tally how much money was spent throughout my endeavor)

I appreciate how Kenneth’s first video is an overview of the finished game. Being able to see what the completed project looks like before we begin is invaluable and something all teachers should try to emulate.


Day 16: Duality

It was getting cumbersome toggling between all the open applications but today I fortunately was able to pick up a second (very old) VGA monitor for free. Sure, my two screens are different sizes and don’t match but now when I’m coding I feel like Tank in The Matrix.

During my lunch hour I watched a GDC Talk from a few years back with Grey Alien Games’ Jake Birkett. He explains how to survive as an independent game developer without having a single hit game.

Jake kept a log of all hours worked and income gained from his projects and provided a lot of insight to the financial challenges of being an indie dev.

This evening I completed the assignment for the 3D Helicopter game and tomorrow I’ll go onto the next lecture – Dreadhalls – which features procedural maze generation and first person camera control.

Added diamonds that appear less frequently than coins, worth +5 coins. Also fixed the bug where the scroll speed didn’t reset after each game.


Day 15: Casual Endless Flyer

The game dev lectures at HarvardX: CS50G, while informative, are not like the how-to tutorials you’d see on Youtube.

There isn’t a step-by-step creation process to follow. Instead, the game is already completed (everything including models, sounds, and scripts) and then after watching the lecture your assignment is to make certain tweaks or additions to the game.

The lecture for the 3D Helicopter game is ~2 hours and the instructor does talk in depth about the game, but I don’t feel this would be a good place to start if it was someone’s first foray into Unity.

I spent several hours going through the code and editor, trying to figure out and understand what was done and where.

My version of the helicopter game I have linked in the video below is basically what would be termed a ‘reskin.’

I created a new scrolling background in MS Paint (because I can’t draw anyways), new sound effects using Bfxr, new explosion effects dabbling with particle systems, added music from Bensound and changed the font, layout and model colors – but the core of the game – the 3D models and code are not mine.

Still, it was altogether a good learning exercise. I basically have the framework to complete a simple endless flyer from scratch but need to learn how to build 3D models in Blender, animate and import them. The game itself isn’t technically 3D…more like 2.5 since it’s 2D with 3D elements.

Royalty Free Music from Bensound
Airplane, helicopter & building model by HarvardX: CS50G
Coin font from Lecompte Free Font (Andy Lobjois)
Spinning Coin model from Proto Pack (PIXELATTO)

The assignment for this game is two parts:

  1. Introduce gems into the game that spawn just like coins but more rarely; each gem should be worth 5 coins
  2. There’s currently a bug where the scroll speed of skyscrapers and coins doesn’t reset on game over (hint: static variables don’t refresh on scene reload); find and fix this!

I’ll start working on this tomorrow.


Day 10: Install Git

It was a silly oversight on my part that will make programmers facepalm. I must’ve completely zoned out while watching tutorials about connecting VSCode to Github, or perhaps they logically assumed I had completed the necessary prerequisite: first install Git. I had not.

The other day when I read that VSCode had git integration, I incorrectly thought that was all I needed to connect with Github.

I didn’t understand why I was getting this error

Later when I finally clued in and downloaded Git, the installer was giving me grief and wouldn’t let me proceed with my editor selection:

I discovered it was because I had VS Code open. Oops.

Frankly, it was just one hiccup after another and nothing much was accomplished tonight.

Actually, that’s not true. I now know more about Git than before. I practiced how to stage, commit, and push files. I learned what a SHA-1 hash is, how to clone a repository and create a new branch. And I’ll continue with my research tomorrow.

(See how easy those negative thoughts can creep in. I need to push them away. Shoo! Scat!)


Create your website with
Get started
%d bloggers like this: