GB Studio Documentation

repository·develop·Indexed 27 days ago

https://github.com/chrismaltby/gb-studio

A visual retro game maker for Game Boy and Game Boy Color. This repository contains shared libraries for Electron and Node.js, including WebAssembly ports of binjgb and RGBDS. It provides a CLI for exporting .gbsproj files and building ROM, Pocket, or Web files, as well as a standalone GBS Music web application.

Tokens
4.5K
Snippets
7
Records
37
Agent score
93%

What's inside GB Studio

  1. Understand the architecture of src/lib

    develop

    The src/lib directory is reserved for libraries and helpers that meet one of the following criteria:

    1. They depend on running within the Electron main process or a Node.js process.
    2. They are only relevant to or required by the main process and are not needed by the renderer windows.

    Import Rules:

    • You can import functions and types from shared/lib.
    • You cannot import functions from renderer/lib.
    • You can import types from renderer/lib using the import type syntax (e.g., import type { MyType } from "renderer/lib/renderer-lib";).
  2. Understand the architecture of src/renderer/lib

    develop

    The src/renderer/lib directory is reserved for libraries and helper modules that meet one of the following criteria:

    1. They are dependent on running within an Electron renderer process.
    2. They are only relevant to or required by the renderer windows and are not needed by the main process.

    Import Rules

    • Allowed: You can import functions and types from shared/lib.
    • Allowed: You can import types from lib using the import type syntax (e.g., import type { MyType } from "lib/main-lib";).
    • Forbidden: You cannot import functions from lib directly into this directory.
  3. Understand the architecture of src/shared/lib

    develop

    The src/shared/lib directory contains environment-agnostic libraries and helpers. Code in this directory is designed to be portable and can be executed in the following environments:

    • Electron main process
    • Electron renderer processes
    • Node CLI tools

    To maintain architectural integrity, follow these dependency rules:

    • Do not import functions from lib/ or renderer/lib/ into src/shared/lib.
    • Do use src/shared/lib for logic that does not depend on the file system or specific Electron APIs.
    • Logic requiring the file system or Electron-specific APIs should be placed in lib/ or renderer/lib instead.
  4. Guidelines for UI components in components/ui

    develop

    Components located in components/ui are pure view components and must adhere to the following architectural constraints:

    • No Redux Access: They must not have access to the Redux store.
    • No Hardcoded Text: They should not hardcode text or use localized content directly.
    • Encapsulation: They should not include any files outside of the components/ui directory.
    • Styling Pattern: Use style.ts files for styled-components definitions. These files are internal to components/ui and should not be imported elsewhere; instead, provide wrapper components for external use.
    • Transient Props: Do not expose transient props in wrapper components. Convert standard props to transient props (prefixed with $) within the component implementation.
  5. Generate Profiling Statistics from BGB Output

    develop

    When using "Export ROM", GB Studio includes a .map file alongside your ROM. You can use this .map file along with the BGB output log file to generate detailed profiling statistics using the bgb_profiling_toolkit (specifically calc_statistics.py).

    python calc_statistics.py debugmsg.txt game.map
  6. Run or build the GBS Music web application

    develop

    The GBS Music editor is a standalone web application. You can run it locally for development or build it for self-hosting.

    Build outputs for self-hosting are placed in out/music-web.

    Note: If you have recently checked out a new version, you may need to run npm run fetch-deps to ensure you have the latest GBVM and GBDK components.

  7. Localise the user interface

    develop
    To add support for a new language in the user interface, duplicate the existing en.json file in the src/lang/ directory and rename it using the standard locale code (e.g., ja.json for Japanese). Replace all English text values within the new JSON file with the translations for your target language. The project follows the Electron locale naming conventions.