9.7 — Computer Systems: What Runs Your Game
60 frames per second means the machine has 16.67 milliseconds to run YOUR Update, the physics, and a million pixels. Today: the four organs of every computer — and why knowing them turns your tuning instincts into engineering. The specimen is your own project folder.
Your game runs at 60 frames per second in the lab and 25 on the school laptop — and "it is slow" is not one problem. It is four finite resources and one 16.67 ms deadline, and the work is finding out which of them ran out.
First, before anything else: cut that into parts small enough that you could look each one up on its own.
- Name the four organs, and the one job each one doeswhat does this part do?Read: the four-organs table in this lesson's Concept Lab, and the Unit 9 systems overview
- Turn a frame rate into a deadlinewhat does this part do?Read: the frame-budget paragraph in this lesson's Concept Lab, and the deltaTime lesson where the frame rate stopped being a constant
- Work out which organ ran out, before you change anythingwhat does this part do?Read: the Profiler steps in this lesson's editor half, and the Update vs FixedUpdate row of the Unity + C# quick reference
- Know what is in RAM and what is only on diskwhat does this part do?Read: the measured storage table in this lesson's Concept Lab, and 9.4 on what a scene file actually is
- Say where in the frame a thing runswhat does this part do?Read: the pipeline list in this lesson's code half, and the lifecycle split you met in 1.3
The split is the answer to the ask. "It stutters on the other computer" is unanswerable; these five are five separate questions you can each go and measure. Four of them are about a resource running out — compute, pixels, memory, disk — and the fifth is about time. Notice what is not on the list: no new API, nothing to install, and no code to write. Every one of these is a number you read out of a window you already have open, which is exactly why this lesson has no walkthrough.
The test: could you answer this part by opening one window and reading one number? The Profiler answers the third, the Project window answers the fourth, and a stopwatch answers the second. A part that needs somebody else's hardware instead of your own is a part you have not finished splitting.
Your turn
Pick two of the parts above and say in one line what each one actually does.
Your project folder holds 641,512 KiB of Unity import cache and 36,852 KiB of your own source. Which of those two would you hand to a classmate, and what would you tell them if they complained the download was huge?
One sprite sheet in your art folder is 1632 pixels wide and 1536 tall, and its file on disk is 589 KB. Say, without multiplying, which of those two numbers the graphics card is holding — then multiply and check yourself.
Name the one organ you would upgrade first for your own game, and the measurement that decided it rather than the price tag on the box.
Everything the Concept Lab priced is a number you can read out of a window you already have open. These six readings are the diagnosis this lesson exists for: which organ ran out, and how you know.
- Window → Analysis → Profiler, and leave it attached while the game plays: one bar per frame, and the height of the bar is the 16.67 ms being spent. Profiler → CPU is where the bar is split into the bands that filled it, so your Update cost, the physics cost and the render cost are three bands on one bar.
- Game view → press Play on a scene that is doing almost nothing, and read the frame time. On a simple scene most of a quiet frame is render. Then Scene view → let the turrets fire at once and watch the logic band jump: the spike is scheduled work, not a constant cost.
- Hierarchy → drag the enemy prefab in and Ctrl+D until you have 200 of them, each running its own Update and a distance check to the player. Game view → read the frame rate fall, then Profiler → Hierarchy to see which method the milliseconds are being charged to.
- Hierarchy → delete them, and spawn 200 large sprites instead — scaled up in the Scene view until they cover the camera. Game view → the frame drops again, and it drops differently: the cost is in draw calls rather than in logic, which is what the two bands on the same Profiler bar are there to tell apart.
-
Project window →
Assets/_Scenes/Overworld, then Game view → Play. What RAM holds is the scene you loaded: eight tilemaps bounding 15,793 cells, of which the layer that actually stops you is 105 by 91 — 9,555 cells — and the rest are the cave and door alternates of the same level, kept in memory so that opening a door is a swap rather than a rebuild. -
Hierarchy → the door's
SceneSwitchfrom 5.3, then walk through it with the Profiler still open. The old scene UNLOADS — that is the hitch you sometimes see mid-door, and it is RAM being handed over — and the singleton survives it becauseDontDestroyOnLoad(gameObject)says this one is not scene-RAM any more.
Checkpoint — before moving on, you must be able to:
- Name the four organs with your game's demand on each
- Do the frame-budget arithmetic and say what a missed deadline is
- Read the Profiler and identify CPU vs GPU saturation
- Explain the frame pipeline order and a bug it predicts
- Say what your project costs on disk and in memory, and why those two numbers differ
- Explain volatile RAM vs persistent storage with your own coins
- Break this question into parts small enough to look each one up on its own, and say in one line what each part does
- Say which earlier lesson each part of it came from, and where you would reread it
Reference Docs
Need a deeper explanation? These pages cover the same concepts:
- Unit 9: Data & Systems — computer systems in the CED
- Unity + C# Quick Reference — Update vs FixedUpdate
Saved on this device only — the Dashboard tracks your progress.