→ From Coder to Shipper
From Coder to Shipper · Rapid-fire

Game Dev — 16 ms at a time

Your web app waits for the user. A game never does: it runs 60 times a second whether anyone touches it or not — and every frame has a 16.6 ms deadline.

← / → to navigate · EN/VI switch below

The basics

What a game actually is

Strip away the graphics and a game is just code you already know: variables, if-statements, and a loop.

A state

A handful of variables: player position, score, lives, what's on screen. The game IS its state.

Rules

If-statements that change the state: did the player jump? Did the ball hit the wall? +10 points.

A loop

It runs 60 times per second: read input → update state → draw. Forever, or until quit.

An engine

A framework that runs that loop FOR you and adds physics, sound, assets — pygame, Unity, Godot.

The contrast

Games don't wait

The same code skills, a totally different contract with time.

Your web app

User clicks, the server thinks, a page comes back. Nothing happens until someone asks. Time works for you.

Seconds are fine — nobody is watching a blank screen.

A game

The screen refreshes 60 times a second whether the player touches anything or not. Miss the 16.6 ms budget once and the player FEELS it: stutter.

The deadline is physical, not polite.

01
The loop

The game loop

One while-true. Sixty times per second. That's the whole skeleton of every game ever made.

One frame

What happens in 16.6 ms

Four jobs, every frame, in order.

  1. 1

    Input

    Poll the keyboard/touch: what did the player just do? Keys pressed, taps, mouse.

  2. 2

    Update

    Apply the rules: move the player, roll the ball, check collisions, add score. The state changes.

  3. 3

    Draw

    Clear the screen and paint everything at its new position. This is the only thing the player sees.

  4. 4

    Wait

    Sleep until the next frame is due — this locks the loop to 60 fps instead of spinning as fast as possible.

The math

The frame budget

1 second / frames = your budget. Spend it on input + update + draw.

60 fps30 fps144 fps
Milliseconds per frame16.6 ms33.3 ms6.9 ms
Who plays at itThe standard — desktop, mobile, everythingOlder phones, casual mobileHigh-refresh monitors, esports
If you miss itOne janky frame out of sixtyLess visible, still noticed in fast scenesYou only have 6.9 ms — AAA games live here
Vocabulary

Six words that cover 90%

Frame / FPS

One frame = one painted picture. FPS = frames per second. 60 fps = a new picture 60 times a second.

Tick

One lap of the loop. 'Update every tick' = every frame.

Sprite

A little image the game moves around: the player, the ball, the enemy. You don't draw pixels — you place sprites.

Collision

The 'did these two overlap this frame?' check — the if-statement that makes games feel physical.

State

All the game's variables at one instant. Save the state and you can pause, rewind, or respawn.

Delta time

How long the last frame actually took. Multiply speeds by it so a slow laptop plays at the same speed as a fast one.

Play it yourself

A whole game in 16 lines

pygame runs the loop for you; you fill in input, update and draw. Arrow keys move the square.

mini_game.py
import pygame, sys
pygame.init()
screen = pygame.display.set_mode((400, 300))
clock = pygame.time.Clock()
x = 200
while True:                      # THE loop — 60x per second
    for e in pygame.event.get(): # 1. poll input
        if e.type == pygame.QUIT: sys.exit()
    k = pygame.key.get_pressed()
    if k[pygame.K_LEFT]:  x -= 5 # 2. update state
    if k[pygame.K_RIGHT]: x += 5
    screen.fill((15, 23, 42))    # 3. draw
    pygame.draw.rect(screen, (110, 231, 160), (x, 120, 40, 40))
    pygame.display.flip()
    clock.tick(60)               # 4. sleep — lock to 60 fps

That's it: input polling, state update, redraw, and clock.tick(60) locking it to 60 fps.

In the terminal

Run it

Install, run, move with the arrow keys, close the window to quit.

ops@vps — zsh
$ pip install pygame
Collecting pygame
Successfully installed pygame-2.6.1
$ python mini_game.py
← arrow keys move the square · close the window to quit
← that was a real game: loop, input, state, draw
The landscape

The big three

Pick one and you can make almost anything.

Unity

The industry default for 2D and 3D. C#, a huge asset store, and most of the mobile hits you've played. Free to start.

Godot

Open-source and completely free. GDScript (Python-flavored), lightweight, and its 2D is genuinely great. The indie favorite.

Unreal

The AAA monster: C++ plus Blueprints (visual scripting), the best real-time graphics anywhere. Big, heavy, overkill for small games.

Side by side

Unity vs Godot vs Unreal

UnityGodotUnreal
LanguageC#GDScript (+ C#)C++ (+ Blueprints)
CostFree up to a revenue threshold, then a share100% free, open source (MIT)Free, 5% after $1M gross
WeightHeavy but batteries-includedLight — the editor opens in secondsVery heavy — built for AAA
Best forIndie → mid-size 2D/3D, mobile2D, quick prototypes, full controlAAA 3D, serious graphics
The choice

Raw pygame vs an engine

Same loop, two ownership models.

Raw pygame — you own the loop

You wrote the while-true, the input polling, the clock. You learn how every frame happens; nothing is for free — no physics, no editor, no asset store.

Use it to learn, or for tiny games.

An engine — it owns the loop

The engine runs the loop; you write callbacks: 'when a frame ticks, move the player'. Physics, animation, editor, assets — included.

Use it for anything you'll actually ship.

The edges

What we're deliberately skipping

Physics

Gravity, bounces, joints — engines ship a physics engine; you aim it, it solves the math.

Animation & art

Sprite sheets, skeletal animation, shaders — the reason games look like games.

Sound & music

Channels, mixing, spatial audio.

Multiplayer

Netcode, latency, synchronization — a whole course on its own.

Levels & worlds

Tilemaps, level editors, world streaming.

Shipping a game

Stores, reviews, monetization — the shipper half of game dev.

Strip a game to the bone and it's variables, if-statements, and a loop — the exact skills you're building in this course. Every engine, pygame to Unreal, is just a different answer to one question: who runs the loop?
the big picture

Sixty frames. Sixteen milliseconds each.

Next: the same ship-it habits, on a phone — mobile dev.