Terasology Documentation

repository·develop·Indexed 26 days ago

https://github.com/movingblocks/terasology

An open-source voxel-based game platform and engine built on a modular architecture. Documentation covers installation via launcher or direct download, system requirements, development environment setup using JDK 17, and the distinction between Modules and Subsystems. Includes technical guides on the Terasology CLI, Gradle run tasks, the TypeHandlerLibrary for serialization, GameScheduler for work scheduling, and Linux-specific memory management flags.

Tokens
45.6K
Snippets
79
Records
297
Agent score
87%

What's inside Terasology

  1. Understand Terasology Shape File Formats (.shape)

    develop

    Terasology block shapes are defined in .shape files, which are JSON files (using GSON) that provide rendering mesh data, physics collision data, and mouse collision data for voxel blocks.

    There are two versions of the specification:

    • 1.0 (Legacy): Uses fixed section names (e.g., front, back, top) and requires vertices, normals, and texcoords arrays to be of identical length.
    • 1.1 (Current/Unreleased): More versatile. Sections can have any unique name (except reserved names like author or collision). It allows vertices, normals, and texcoords to have different lengths and supports an optional sides parameter to define rendering directions.
  2. Understand the Terasology Engine States

    develop

    The Terasology engine operates through three primary states: MainMenu, Loading, and InGame. Understanding these states is essential for determining when specific systems (like Input, Rendering, or World Generation) are active and how data flows through the engine.

    1. MainMenu State

    Used for user interaction before a game session begins.

    • HandleInput: Managed by the InputSystem.
    • Update: Follows a sequence of NUIManager $\rightarrow$ EventSystem $\rightarrow$ StorageServiceWorker.
    • Render: Handled by the NUIManager.

    2. Loading State

    A transitional state that executes a complex sequence of initialization steps. The loading process includes:

    • Mod & Rendering Initialization: Registering mods, checking for headless mode, and initializing rendering/entity systems.
    • World & Data Loading: Registering blocks, loading prefabs, initializing component systems, and loading extra block data.
    • World Construction: Initializing the world, registering block families, ensuring save game consistency, and initializing physics.
    • Entity & Generator Setup: Loading entities, initializing block type entities, creating the world entity, and initializing the world generator.
    • Network & Player Setup: Checking netMode.isServer to start the server, checking netMode.hasLocalClient to setup the local player, and awaiting character spawn.

    3. InGame State

    The active gameplay state.

    • HandleInput: Managed by the InputSystem.
    • Update: Follows a sequence of EventSystem $\rightarrow$ UpdateSubscriberSystems $\rightarrow$ WorldRenderer $\rightarrow$ StorageManager $\rightarrow$ NUIManager $\rightarrow$ StorageServiceWorker.
    • Render: The DisplayDevice prepares to render, followed by NUIManager and WorldRenderer updates.
  3. Use Marker Components to indicate entity state

    develop

    A marker component represents a single binary piece of information. It marks an entity as having a specific property or state. Systems use the presence or absence of this component to determine which actions to take.

    Key characteristics:

    • They do not contain configuration or additional state data.
    • They act strictly as indicators (e.g., BlockDamagedComponent indicates a block is in a damaged state).
  4. Identify Terasology core repositories and organizations

    develop

    The Terasology codebase is split across two primary GitHub organizations:

    • MovingBlocks Organization: Contains the engine and core libraries.
    • Terasology Organization: Dedicated to hosting content modules.
      • Root repos: Modules maintained by the official community.
      • Fork repos: Modules hosted by modders that are eligible for official distributions.
  5. Use Terasology libraries and supporting tools

    develop

    Several specialized libraries and tools support the Terasology ecosystem:

    Libraries

    • TeraBullet: Voxel-world integrations with JBullet.
    • TeraOVR: A wrapper for the Oculus Rift SDK.
    • Jitter: A utility framework for Leap Motion.

    Supporting Projects

  6. Understand Terasology architecture

    develop

    Terasology is built using a layered architecture:

    • Engine: The core of the project, containing the default facade and subsystems.
    • Libraries: Core functionality provided by in-house libraries, such as gestalt (entity system and module management) and TeraNUI (UI library).
    • Modules: The actual game content, which is added on top of the engine and libraries. All modules reside in the Terasology GitHub organization.

    For deeper technical details, refer to the following documentation:

    • Project Structure: High-level overview of the codebase.
    • Entity System Architecture: Structure and usage of the entity system.
    • Events and Systems: How to hook in new game logic.
    • Block Architecture: Development overview of the Block system.
    • Block Shapes: How to define 3D meshes via JSON definitions.
  7. Access Terasology services and community sites

    develop

    Terasology provides several online services for discussion, server discovery, and information:

    • Portal / Forum: The main site for announcements and community discussion (forum.terasology.org).
    • Meta Server: Provides a list of game servers and modules. It is accessible via API and is used by the game and the launcher (meta.terasology.org).
    • Splash Site: An introductory site for the game (terasology.org).
  8. Understand and use Terasology Modules

    develop

    Terasology uses a modular system where content, gameplay mechanics, and engine extensions are stored in "modules". These are smaller building blocks that can be combined.

    Key Concepts:

    • Modules vs. Mods: Modules are intended to be small, composable building blocks rather than large, monolithic modifications.
    • Gameplay Templates: These are collections of modules grouped together (similar to mod packs). They are the recommended way to enable content and are available via a drop-down menu during world creation.
    • Module Selection: You can manually customize module selection using the "Modules" button, but it is generally advised to rely on Gameplay Templates to avoid instability.
    • Automatic Selection: Some world generator types may automatically select specific modules required for their functionality.
    • Console Commands: Enabling certain modules may unlock additional console commands. You can check for available commands using the help command.
    • Updates: The game can download module updates from a central meta-server. When connecting to a server, clients are automatically sent the correct versions of any enabled modules to ensure compatibility.
  9. Understand Block Shape structure and parts

    develop

    A block shape defines the visual geometry of a block. A single shape can be used by multiple blocks with different textures. A shape consists of up to 7 parts:

    • Center: The central mesh, always rendered if present. Used for geometry contained within the block's volume.
    • Side Meshes: Six possible meshes (Top, Bottom, Front, Back, Left, Right). These are only rendered if the side is not obscured by an adjacent block.

    Each side can be a full side (fills the entire side and obscures adjacent blocks) or a partial side (does not obscure adjacent blocks).

    Direction Mapping

    Sub-blockDirectionAxis
    Center--
    Top+Y axis
    Bottom-Y axis
    Front-Z axis
    Back+Z axis
    Left-X axis
    Right+X axis
  10. Use Configuration Components for entity settings

    develop

    A configuration component stores settings or parameters that can be modified by the player or the game engine. Systems use these components to apply specific settings to the in-game representation of an entity.

    Key characteristics:

    • They contain only configuration data.
    • They are not intended to provide state data.
    • Examples include DisplayNameComponent (for non-technical names) or PlaySoundActionComponent (for interaction sounds).