🗒 Cheat Sheet← Lesson
BitWithBite
Pygame Mastery Worksheet

🚀 Optimization & Publishing

Module 19 of 20 · Level ★★★ · Time: 35 min
SCORE___ / 20
NameClassDate
After this worksheet you can
Apply key blitting optimizationsProfile before optimizingPackage a game with PyInstallerPublish a game to itch.io
📚 Quick Recap

convert()/convert_alpha() is the cheapest speed win in Pygame. Profile with cProfile before guessing where slowdowns are. PyInstaller (--onefile --windowed) packages a script into a standalone executable, and itch.io is the standard free platform for publishing indie Pygame games.

🧠 Section A · Concept Check ● ADVANCED 4 × 1 = 4

1What is the single biggest, cheapest blitting speedup?
2Why profile before optimizing?
3What does --onefile do in a PyInstaller command?
4What is itch.io commonly used for?

🧮 Section B · Problem Solving ● INTERMEDIATE 2 + 3×3 = 11

5The -- PyInstaller flag suppresses the console window for GUI apps.
6Python's built-in profiling module is called c.
7Write the full PyInstaller command to package game.py as a single windowed executable.
8Why does using pygame.sprite.Group's built-in draw()/update() often outperform hand-written loops?
9Name two things you should prepare (besides the executable) before publishing a game to itch.io.

🚀 Section C · Challenge ● CHALLENGE 5

10Your game runs at 15 FPS instead of 60. Before touching any code, describe the exact first step you should take to find out WHY, and why skipping straight to "optimizing" without this step is risky.
💭 Reflection — the most useful thing I learned:
A ___/4   B ___/11   C ___/5   Total ___/20 Teacher's Signature Parent's Signature
✂ answer key — fold or cut before handing out

1-B   2-B   3-B   4-B  |  5 windowed   6 cProfile   7 = pyinstaller --onefile --windowed game.py   8 = Group methods are written and tested by Pygame's maintainers to iterate sprites efficiently and consistently, reducing bugs and often avoiding redundant work compared to ad-hoc manual loops   9 = a game description/store page with screenshots or a trailer, and a README or set of controls/instructions for players  |  10 = run a profiler (e.g. cProfile) first to see exactly which function(s) are consuming the most time; optimizing blindly risks spending effort rewriting code that isn't actually the bottleneck while the real slow function goes untouched

📄 Need offline practice?Download the print-ready PDF or open the one-page cheat sheet.
⬇ Worksheet PDF 🗒 Cheat Sheet