Game Design & Development Β· Lesson 3

VS Code for Game Dev

Visual Studio Code Live Server Extensions Project Structure Workflow Beginner Friendly

Professional game developers use powerful editors that give instant feedback, catch errors before you run the code, and let you see changes in the browser without reloading manually. Visual Studio Code is free, runs everywhere, and is used at Google, Microsoft, and every major game studio that targets the web. Let's set it up right β€” one step at a time.

🧭 Before You Dive In

Installing new software can feel like the intimidating part, but this is really just clicking through an installer β€” the same way you'd install any app on your phone or laptop. Nothing in this lesson can break your computer, and if a step ever feels off, you can simply re-download and try it again.

Go at your own pace: check off one step in the checklist below, then take a breather before the next one. There's no timer here β€” the goal is a working setup, not a fast one.

First time setting up a code editor? That's exactly why this lesson exists β€” you're not expected to know any of this already.

πŸ’» Why Visual Studio Code?

You've probably typed in Google Docs, Notes, or Notepad before β€” VS Code is a text editor too, just one built specifically for writing code. The big difference: while you type, it quietly watches for mistakes and helps you write faster, instead of just holding plain text.

VS Code (not to be confused with Visual Studio) is a lightweight but powerful code editor β€” free, open source, and built by Microsoft. It has become the most-used editor in the world because it's fast, extensible, and works for every language.

For game development with JavaScript and HTML5 Canvas, VS Code gives you:

πŸ”΄
Error Highlighting Red squiggles appear under mistakes while you type β€” before you even run the code.
πŸ’‘
IntelliSense Autocomplete suggests function names, property names, and parameters as you type.
πŸ”„
Live Reload Save a file and the browser tab refreshes automatically β€” no manual F5 needed.
πŸ›
Built-in Debugger Set breakpoints, inspect variables, and step through code line by line inside the editor.

βœ… Setup Checklist

Click each step as you complete it. Progress: 0 / 7 steps done.

Let's get started!

  • βœ“
    Download VS Code β€” Go to code.visualstudio.com and download the installer for your OS (Windows, macOS, or Linux). Run the installer with default settings.
  • βœ“
    Open a project folder β€” In VS Code: File β†’ Open Folder… β†’ choose or create a folder named my-game. VS Code treats the folder as your project root.
  • βœ“
    Install Live Server β€” Click the Extensions icon (four squares) or press Ctrl+Shift+X. Search Live Server by Ritwick Dey and click Install. This is the most important extension for game dev.
  • βœ“
    Install Prettier β€” Search Prettier - Code formatter and install it. It auto-formats your code when you save, keeping indentation and spacing clean.
  • βœ“
    Create your first file β€” Right-click in the Explorer panel β†’ New File β†’ name it index.html. Type ! and press Tab β€” VS Code generates a full HTML skeleton instantly.
  • βœ“
    Launch Live Server β€” Right-click index.html in the Explorer β†’ "Open with Live Server." A browser tab opens at localhost:5500. Now every save instantly updates the browser.
  • βœ“
    Open the terminal β€” Press Ctrl+` (backtick) to open VS Code's built-in terminal. You can run commands, start build tools, and manage files without leaving the editor.

πŸ—‚οΈ Game Project Folder Structure

A clean folder structure makes your project easier to manage, especially during a Game Jam when time is short. Here's the recommended layout β€” skim it once, but don't feel like you need all of it on day one. The tip right after the tree explains why.

πŸ“ my-game/
πŸ“„ index.html ← entry point, open this in Live Server
πŸ“ src/
πŸ“„ game.js ← main game loop, all logic
πŸ“„ player.js ← player object (when code gets big)
πŸ“„ enemies.js ← enemy logic
πŸ“ assets/
πŸ“„ sprites/ ← PNG images for characters & tiles
πŸ“„ sounds/ ← WAV or OGG sound effects & music
πŸ“„ maps/ ← JSON level data (Tiled map editor output)
πŸ“ lib/
πŸ“„ kaplay.js ← engine library (if using one)
πŸ“„ README.md ← what the game is, how to run it
Game Jam tip: Don't overthink the structure at the start of a jam. One index.html and one game.js is fine. Organize when you need to β€” clean code is good, but a shipped game beats a perfectly organized one that's not done.

πŸ” The Live Server Workflow

Think of Live Server as a mirror that's always watching your file: every time you save, it instantly shows the browser what changed β€” no manual refreshing, no forgetting to reload. Your development cycle should be fast. With Live Server, it looks like this:

1. Write code in VS Code
2. Press Ctrl+S to save
3. Browser tab automatically reloads
4. See the result immediately
5. Repeat β€” every 30 seconds if needed

This tight feedback loop is how professionals work. The goal is to never go more than a few minutes without running your code. Small, frequent tests catch bugs early β€” long sessions without testing mean hours of debugging later.

πŸ” Opening the Browser DevTools

Press F12 in the browser to open DevTools. The Console tab shows error messages and any console.log() output from your game. This is your primary debugging tool β€” seeing a red error message here isn't a failure, it's the tool doing exactly its job.

// Add debug output anywhere in your game:
console.log('Player position:', player.x, player.y);
console.log('Enemy count:', enemies.length);
console.warn('Lives low!');   // shows in yellow
console.error('Crash!');     // shows in red

⌨️ Essential Keyboard Shortcuts

You don't need to memorize all ten today β€” start with Save and Undo, and the rest will stick naturally the more you code. Bookmark this table and glance back whenever you need one.

ActionWindows / LinuxmacOS
Save fileCtrl + S⌘ + S
Save all filesCtrl + K, S⌘ + K, S
UndoCtrl + Z⌘ + Z
Find in fileCtrl + F⌘ + F
Find & ReplaceCtrl + H⌘ + H
Open terminalCtrl + `βŒƒ + `
Toggle sidebarCtrl + B⌘ + B
Command paletteCtrl + Shift + P⌘ + Shift + P
Duplicate lineShift + Alt + ↓⇧ + βŒ₯ + ↓
Multi-cursor selectCtrl + D⌘ + D

🧩 Recommended Extra Extensions

These are optional add-ons, not requirements β€” Live Server and Prettier from the checklist above are the only two you truly need to get started.

🎨
One Dark Pro zhuangtongfa.material-theme The most popular dark color theme. Easier on the eyes during long jam sessions.
πŸ”·
ESLint dbaeumer.vscode-eslint Catches common JavaScript mistakes β€” undeclared variables, missing semicolons, unreachable code.
πŸ–ΌοΈ
Image Preview kisstkondoros.vscode-gutter-preview Shows a preview of image files in the gutter when you reference a path in code.
πŸ”‘
GitLens eamodio.gitlens Shows who wrote each line and when β€” great for team jams and seeing your own history.