Terasology Documentation
repository·develop·Indexed 26 days ago
https://github.com/movingblocks/terasologyAn 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.
What's inside Terasology
- The DiscordRPC subsystem enables Rich Presence via Inter-Process Communication (IPC). When active, it automatically sets and updates the user's Discord status to indicate they are "Playing Terasology" (or similar).
Understand Terasology Shape File Formats (.shape)
developTerasology block shapes are defined in
.shapefiles, 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 requiresvertices,normals, andtexcoordsarrays to be of identical length. - 1.1 (Current/Unreleased): More versatile. Sections can have any unique name (except reserved names like
authororcollision). It allowsvertices,normals, andtexcoordsto have different lengths and supports an optionalsidesparameter to define rendering directions.
- 1.0 (Legacy): Uses fixed section names (e.g.,
Understand the Terasology Engine States
developThe Terasology engine operates through three primary states:
MainMenu,Loading, andInGame. 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.isServerto start the server, checkingnetMode.hasLocalClientto 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
DisplayDeviceprepares to render, followed byNUIManagerandWorldRendererupdates.
- HandleInput: Managed by the
Use Marker Components to indicate entity state
developA 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.,
BlockDamagedComponentindicates a block is in a damaged state).
Identify Terasology core repositories and organizations
developThe Terasology codebase is split across two primary GitHub organizations:
- MovingBlocks Organization: Contains the engine and core libraries.
- Engine: The core game engine, including the PC Facade (standard application) and the Core Module (github.com/MovingBlocks/Terasology).
- 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.
- MovingBlocks Organization: Contains the engine and core libraries.
Integrate Project Reactor in modules
developTerasology provides access to Project Reactor libraries, includingReactor Core,Reactor Extra, andReactor Test. Developers can useFluxandMonoto define and schedule asynchronous operations more effectively than the standard Java API. For detailed usage of these operators, refer to the Project Reactor Reference Guide.Use Terasology libraries and supporting tools
developSeveral 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
- Launcher: The recommended way to run the game, providing auto-updating and version management (github.com/MovingBlocks/TerasologyLauncher).
- Applet: A Facade for running the browser-based version of the game (github.com/MovingBlocks/FacadeApplet).
- TeraMisc: A repository for miscellaneous assets like raw model files and utility scripts (github.com/MovingBlocks/TeraMisc).
Understand Terasology architecture
developTerasology 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) andTeraNUI(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.
Access Terasology services and community sites
developTerasology 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).
Understand and use Terasology Modules
developTerasology 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
helpcommand. - 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.
Understand Block Shape structure and parts
developA 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-block Direction Axis Center - - Top +Y axis Bottom -Y axis Front -Z axis Back +Z axis Left -X axis Right +X axis Use Configuration Components for entity settings
developA 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) orPlaySoundActionComponent(for interaction sounds).