Defold Engine Documentation

repository·master·Indexed 40 days ago

https://github.com/defold/doc

Official documentation for the Defold game engine, covering core concepts, API references, and development guides. Includes details on Lua scripting, C# and C/C++ extensions, physics, GUI templates, and platform deployment. Provides resources for contributing translations and using the Documentation Consistency Checker.

Tokens
245.9K
Snippets
536
Records
1.1K
Agent score
50%

What's inside Defold

  1. What is included with Nintendo Switch access in Defold

    master

    Once your status as an approved Nintendo Switch developer is confirmed, you receive the following resources:

    • Nintendo Switch extension: Source code access containing console-specific API integrations.
    • Nintendo Switch enabled Defold engine: Source code access to the engine version enabled for the platform (useful for engine core contributions; not required for standard game building).
    • Command line tool (BOB): Access to the BOB command line tool which supports bundling for the Nintendo Switch platform. Note: Bundling directly from the Defold editor is not supported for Nintendo Switch.
    • Support Forum: Access to a dedicated forum for Nintendo Switch-specific technical support.
  2. Overview of animation types in Defold

    master

    Defold provides built-in support for several animation types that serve as graphic sources for components. You can use these to animate 2D sprites, 3D models, or object properties directly.

    Built-in Animation Types

    • Flip-book animation: Playing a series of still images in succession (common for 2D sprite animations).
    • Model animation: Playing 3D skinned animations.
    • Property animation: Animating properties such as position, scale, rotation, and many others.

    Extension-based Animation

    For specialized animation needs, you can add support via extensions:

    • Rive animation: Playing vector-based 2D skeletal animations.
    • Spine animation: Playing textured 2D skeletal animations.
  3. What is included with PS4™ and PS5™ Defold access

    master

    Once your status as a licensed developer is confirmed, Defold provides the following resources:

    • PS4™ and PS5™ extension: Source code access to the extension containing console-specific API integrations.
    • Engine Source Code (PS5™ only): Licensed PS5™ developers receive source code access to the PS5™-enabled version of the Defold engine (intended for engine core contributions; not required for standard game building).
    • Bundling Support: Access to the Bob command line tool which supports bundling for PS4™ and PS5™ platforms. Note: Bundling directly from the Defold editor is not supported for these consoles.
    • Support: Access to a dedicated forum for PS4™ and PS5™ specific technical support.
  4. Overview of networking options in Defold

    master

    Defold provides several ways to implement network connectivity depending on your game's requirements:

    • HTTP Requests: For communicating with backend services (e.g., posting scores, matchmaking, cloud saves).
    • Socket connections: For low-level, direct network communication.
    • WebSocket connections: For real-time, bidirectional communication over web-friendly protocols.
    • Online services: For integrating with platform-specific online features.
  5. Overview of Defold debugging facilities

    master

    Defold provides several tools to identify and resolve issues in your project:

    • Lua Debugger: An integrated debugger with inspection capabilities for debugging game logic.
    • Profiling Tools: Built-in tools to analyze performance issues and resource usage.
    • Crash Logs: Provided by the engine in the event of a system-level crash.

    For specific workflows, refer to the guides for debugging game logic or debugging native code.

  6. Optimize a Defold game for size, speed, memory, and battery

    master

    To ensure a Defold game runs effectively on target platforms, you must optimize across four primary dimensions:

    • Game size: Minimize the game bundle size to meet platform requirements without sacrificing quality.
    • Runtime speed: Optimize for CPU and GPU usage to maintain a stable frame rate on the target hardware.
    • Memory usage: Reduce the memory footprint to stay within the constraints of the target platform.
    • Battery usage: Focus on power efficiency, which is critical when targeting mobile or handheld devices.
  7. Supported animation types in Defold

    master

    Defold provides built-in support for several animation types that can be used as graphic sources for components:

    • Flip-book animation: Sequential playback of a series of static images.
    • Model animation: Playback of 3D skeletal animation.
    • Property animation: Animation of properties such as position, scale, rotation, and more.

    Additional animation formats can be added via extensions, such as Rive (vector 2D skeletal animation) and Spine (2D skeletal animation with textures).

  8. Choose the right automation interface in Defold

    master

    Defold supports automation at multiple levels, primarily distinguishing between the Defold Editor and a running game. These are separate processes with separate HTTP servers. Use the following guide to select the appropriate interface for your task:

    LevelPurpose
    Editor ScriptsCustom commands, workflows, or editor integrations (e.g., level/resource generation)
    Editor UI ScriptsCustom visual tools, popups, or settings interfaces using Editor Scripts
    Editor HTTP APIControlling the project via OpenAPI (project resources, commands, previews, preferences, console output) for external tools or IDE integrations
    Bob CLIProject creation, data file generation, or building standalone packages via CLI/CI
    Lifecycle HooksValidating or producing assets before/after creation or package builds
    Engine ServiceInspecting the running dmengine, development services, profile creation, or runtime automation via extensions
    Automation BridgeOfficial extension providing additional runtime automation endpoints
    Automated TestingTesting game logic, messages, physics, and engine behavior via scene inspection or running test collections
    Shell Scripts / Task RunnersFile manipulation, formatting, and repetitive tasks
    Platform/Browser ToolsHTML5 interaction testing, screenshots, and web integrations
    AI Programming AgentsComplex tasks requiring exploration or multimodal analysis (e.g., semantic scene analysis)
  9. Choose the appropriate Defold automation interface

    master

    Defold provides multiple layers of automation depending on whether you need to interact with the Editor, the running game engine, or the build process.

    Automation Layers

    LayerPurpose
    Editor ScriptsCustom commands and workflows (e.g., level or asset creation)
    Editor UI scriptsCustom visual tools, popups, and configurators
    Editor HTTP APIControlling the open project via OpenAPI (builds, previews, editor commands, preferences, or running editor scripts)
    Bob CLICommand-line building, creating data archives/bundles, and CI integration
    Lifecycle hooksValidation or generation before/after editor builds or bundling
    Engine HTTP serviceInspecting the running engine (dmengine), profiling, runtime messages, or sending commands to a debug build
    Automation BridgeOfficial extension providing additional engine runtime automation endpoints
    Automated testsTesting game logic, physics, input, and scene inspection
    Shell scripts / Task runnersFile operations, formatting, and repeatable tasks
    Platform-specific toolsDesktop testing, HTML5 interaction, and web browser automation
    AI coding agentsSemantic analysis of scenes, GUI layouts, or runtime screenshots where deterministic logic is difficult

    Note: The Defold Editor and the running game are separate processes with separate HTTP servers.

  10. Understand Defold core concepts and terminology

    master

    The Defold glossary provides definitions for the fundamental building blocks used in the engine. Key concepts include:

    • Game Object: A container for components (graphics, sound, scripts) that has a separate lifespan during game execution. They can be placed manually in collections or spawned dynamically.
    • Component: Specific functionality attached to a game object (e.g., graphics, animation, coded behavior). Components do not exist independently of game objects.
    • Collection: A tree structure of game objects and other collections. Used as templates (similar to prefabs) that can be reused.
    • Atlas: A compiled sheet of multiple images used to improve performance and memory efficiency.
    • Builtins: A read-only project folder containing default resources like the renderer, render scripts, and materials. To modify these, copy them into your own project.
    • Lua: The scripting language used for game logic. It supports procedural, object-oriented, functional, and data-driven programming.
  11. Check Microsoft Xbox support status

    master
    As of the current documentation, Defold does not yet support Microsoft Xbox. The Defold Foundation is working towards becoming an Xbox Middleware provider. If you are an approved Xbox developer, you can help accelerate this process by contacting your Xbox developer representative and requesting Defold support for Microsoft Xbox.
  12. Write native extensions for Defold

    master

    Defold allows you to write native extensions in C, C++, C#, Objective-C, Java, or JavaScript to handle low-level tasks that Lua cannot, such as hardware interaction (e.g., cameras), low-level API access, or high-performance data processing.

    C# Support Note: C# support is experimental and uses .NET 9 NativeAOT to produce a static library. Add .cs files to an extension's src folder and the build service will generate the project file. This is intended for native extensions, not Defold script components.