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)

Onward!

Day 28: Pixel Art

Nostalgia overload! I was browsing sprite sheets of older gen video games at Spriters Resource and lost track of time. It’s amazing how much detail can be packed into so few pixels.

I may pick up Aesprite to create pixel animations for my games as it’s currently listed on Humble Bundle. Another option is to legally compile the source code myself for free.

There are other software options specializing in pixel art including some that are 100% free like Graphics Gale.

Ideally, Photoshop would be the best way to go so I could use it for more than pixel art, but right now a monthly subscription just isn’t in the budget :/ I’ve heard GIMP is a pretty good free alternative.

Tower Defense Tutorial Progress: 14/73

Onward!

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.

Onward!

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.

Onward!

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.

Onward!

Day 6: Job Competition

Calgary, Alberta is best known for hosting the ’88 Olympics, cowboy hats and Oil & Gas. The city has never been considered a gaming development hub.

So it was a pleasant surprise when earlier this month New World Interactive announced it will be opening a development studio here in May. The makers of ‘Insurgency’ and ‘Day of Infamy’ plan on hosting job fairs to attract talent and are already accepting applications.

The Calgary studio hopes to expand to up to 50 employees in the next 3 years. Don’t quote me on this but I thought I heard on the radio that they had already received hundreds of applications within days of the announcement.

That’s some tough competition. How would a new would-be developer like myself even hope to land a job in the industry when there are so many more qualified candidates?

I need to work hard and somehow stand out.

New World Interactive uses UE4 for their development (darn!) but I believe if I get a solid understanding of programming and design under my belt, those skills are transferable regardless of the engine used.

Today, I began the Beginner Gameplay Scripting tutorial. I made sure to type out all the code – no copying and pasting.

I’m enjoying this tutorial series because not only does it teach C# but also how it relates specifically to Unity. Some things are beginning to click. That’s a nice feeling.

Onward!

Day 5: Connecting With The Player

My wife is in the other room screaming. No, she isn’t upset. She’s playing the remake of Resident Evil 2 and really getting into it.

As I watched her play earlier, I tried getting feedback from the viewpoint of a prospective game designer. What caused her to have the biggest reactions? What was(n’t) fun? What was(n’t) intuitive?

I found it interesting that a lot of the suspense created was due to sound alone. Even when she couldn’t see Mr. X, his heavy footfalls were enough to elicit an ‘Oh sh–!”

It’s amazing how games can make you smile, laugh, cry (GoldenEye – Aztec level, Difficulty: 00-Agent), or even scare you. They can draw you into an engaging story and let you escape into a different world. It can be an emotional experience that drains or uplifts you.

And now I proudly present my very first game that evokes none of the feelings described above: Tic Tac Toe.

What a masterpiece

The Unity tutorial I followed helped me get a better feel for the Hierarchy, Project, Scene and Inspector windows and I feel comfortable laying out a simple menu.

But if I’m being completely honest – a lot of the code didn’t feel like it was at a “beginner” level. Reading the code made sense and I understand the logic, however I don’t remember any of the syntax. At all.

I’ll follow WeirdBeardDev’s suggestion and tackle the tutorial that focuses on scripting next.

Also, thank you AJ for pointing me towards Visual Studio Code. It loads and runs so much quicker! I appreciate all the tips!

Just for fun, I muddled through the build settings and uploaded the tic-tac-toe game onto itch.io:

https://paused.itch.io/my-first-game-ever

I notice that after you play one game and start a second, the “Choose who goes first” button text color changes and isn’t readable. Maybe I’ll fix that in a subsequent patch 😉

Is it normal for small WebGL games to take so long to load? Does anyone have experience with itch.io for hosting games? Any other sites that you prefer? So many questions.

Onward!

Day 1: 365 Days To A Published Game

I’ve created this devlog as a motivational and accountability tool to keep myself on track.  I’m on the wrong side of my 30’s and in a non-career.  I feel like my life is stuck on pause so I need something to focus on, to create, to move forward.   They say you’re never to old to learn and I’m going to put that adage to the test.

The goal:  to have a game published on Android and/or iOS and/or Steam.  My hope is that a year from now I can look back at the progress I’ve made with pride and perhaps help encourage someone else that finds themselves in a similar position.   The 5-year stretch goal is to become a game developer full-time, either as an indie or part of a studio.

GameSalad, Unity, Unreal Engine, Corona, GameMaker Studio, and Godot are just some of the game engines available

A lot of time has been spent researching which programming engine/language to use.  In the end, I wanted the flexibility to create both 2D and 3D games along with multi-platform developability, so I’ve decided on Unity with C#.    There was plenty of analysis paralysis with this decision.  I just needed to choose something and start programming!

Unity has a lot of tutorials.  But before I jump in with the game engine, I want to lay  down a knowledge base with C#.   The last time I’ve “programmed” anything was over 20 years ago, but the only thing I can actually remember goes even further back – to the days of Apple IIe and BASIC:

10 PRINT "HELLO"
20 GOTO 10
RUN

I remember being fascinated by games like Elite and RoadWar 2000.  My friend had a huge collection of floppy disks (his dad’s) and he would bring them to school for us to play.

Apple IIe
This technological marvel was the pride of my elementary school

Sadly, computers were cost prohibitive back then so I begged my parents for the next best thing: a video game console.  Coleco, Atari, and Intellivision were old news.  There were two new kids on the block.

I stared at that Consumers Distributing catalog for hours, agonizing between the NES and Sega Master System.   The fateful decision made on that day would determine who were my friends and enemies at my elementary school.   Once a side was chosen, I was bound to uphold and vindicate the supremity of that system.  The latest issue of EGM and GamePro would provide fodder for each respective side.

Consumers Distributing ad
The 80’s were a magical time

But I digress. I’ve procrastinated long enough.  It’s time to start on the  journey to become a game developer myself.

I will begin with this free course on Youtube:   C# Tutorial – Full Course for Beginners by Mike Dane.

If you are reading this, feel free to comment and leave your thoughts throughout the journey.

Onward!

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