-
Notifications
You must be signed in to change notification settings - Fork 138
Directory structure
Once you have Torque2D running, it is worth getting to know how the repository is laid out.
The stock Torque 2D repository includes dozens of folders and thousands of files. It is easy to be overwhelmed at first, but if you spend a little time to browse through the directory hierarchy while reading along with the directory tours below, you'll find that everything is organized in a straightforward and intuitive manner. Following the tours, we have also included a brief description of the file types you will encounter while using Torque 2D.
| Folder | Description |
|---|---|
| (repository root) | The top of the Torque2D SDK. The built engine executable (Torque2D.exe / Torque2D_DEBUG.exe, or the platform equivalent) is written here and must be run from here so it can load main.cs and the script/asset trees. The CMake generator scripts (generate-vs2022.bat, generate-xcode.command, build-linux.sh, …) also live here. See Building from Source. Two documents worth knowing about sit here too: CONTRIBUTING.md (how to submit a change) and TORQUE_SCRIPT.md (how script is organized in this project). |
engine/ |
The C++ engine: its source code, third-party libraries, and build inputs. |
engine/source/ |
All of the engine source, organized by system — e.g. 2d/ (Sprites, Scene, assets), graphics/, audio/, gui/, console/, and the platform*/ back-ends. Classes related to Sprites, for example, live under 2d/. |
engine/lib/ |
The third-party libraries the engine uses (lpng, ljpeg, libogg/libvorbis, zlib, freetype, …), built as static libraries by CMake. |
engine/compilers/ |
One item only: android-studio, a Gradle project whose native build step drives the root CMake through the NDK. Every other build project that used to live here — the Visual Studio solutions, the Xcode projects, the Makefiles, the Emscripten recipe — has been removed, replaced by CMake. |
engine/bin/ |
Code-generation tools used during the build (Bison, Flex, NASM, etc.). You rarely need to touch these. |
cmake/ |
The CMake build definition: the explicit engine source lists (EngineSources.cmake, PlatformSources.cmake) and the per-platform build notes. |
editor/ |
The in-engine tools (Project Manager, Asset Manager, GUI Editor), written in TorqueScript. |
library/ |
Reusable, importable modules (AppCore, ArtPack, Audio, ScreenFade, …) you can pull into a project. |
toybox/ |
The stock example "toy" modules that showcase the engine's features. |
tutorials/ |
The module(s) used by the wiki tutorials. |
tools/ |
Miscellaneous utilities and plugins not built into the engine (e.g. a TexturePacker exporter, Doxygen config, CMake helpers). |
PlanetX/ |
The demo game — a twin-stick shooter, and the reference for how a 4.0 project is put together. Made of the modules PlanetXGame, AppCore, Audio and ScreenFade, plus its own themes/. |
tests/ |
The two test suites: C++ unit tests and TorqueScript integration tests. tests/README.md explains how to write one. |
images/ |
Images used by the repository itself, not by the engine. |
Based on a fresh clone; subject to change as the repository is updated. (Generated
build/directories appear once you configure a CMake build.)
-
.asset.taml - A TAML file containing an Asset definition. Can be edited using any XML or text editor.
-
.bat - Windows batch files that contain OS commands which can be run to perform tasks. Mostly used in the Torque environment for deleting multiple files at once (.dso, prefs, .uft, etc).
-
.c / .cpp - Source code files. These contain the C and C++ language programming instructions which are compiled by developer tools to create the game executable (.exe).
-
.cs - TorqueScript files contain most of your programmed game logic and processing using the TorqueScript language.
-
.command - The Mac equivalent of a .bat file.
-
console.log - This file is generated by your game whenever you run it. A lot of information about the critical events that occur during your game are written and saved here.
-
.dso - TorqueScript (.cs) files that have been compiled into an encrypted format. DSO files are more secure than the original uncompiled .cs files that they are created from.
-
.dll - Dynamically Linked Library files (DLL) contain code that can be called at runtime by application binary files (.exe and .app) instead of being compiled directly into the binary file itself. This is useful for common libraries, such as OpenGL, OpenAL, Havok, etc.
-
.exe / .app - Binary files created by developer tools during the compiling process. Most commonly used to launch your game, a Torque tool, or any other normal computer application.
-
.gui.taml - A TAML file containing GUI controls. Can be edited using any XML or text editor.
-
.h - Header files contain declarations written in the C and C++ languages for classes, structs, variables, and other programming elements, which are compiled by the engine in conjunction with .c and .cpp files to create binary files.
-
module.taml - A TAML file containing a module definition. Can be edited using any XML or text editor.
-
.ogg - Contains audio data in the Ogg Vorbis format for playing sounds and music in your games.
-
.png / .jpg / .gif / .dds - Raw image files.
-
.scene.taml - A TAML file that contains a Scene. Can be edited using any XML or text editor.
-
.taml - A generic TAML file containing persisted object(s). Can be edited using any XML or text editor.
-
.torsion - A project file for Torsion, a Windows TorqueScript IDE that is no longer sold or maintained.
sandbox.torsionis left in the repository for anyone who still has a copy; nothing in the engine reads it, and it can be ignored. -
.uft - These files contain pre-cached font information.
-
.wav - Contains audio data in the Waveform format for playing sounds and music in your games.