MIT Licensed Open Source version of Torque 2D game engine from GarageGames

Torque Logo

We've moved!

All torque engines have moved to a new organization, Torque Game Engines. Torque2D can be found at https://github.com/TorqueGameEngines/Torque2D. This repository will not be updated. We encourage you to use the new repository instead of this one. Thank you!

Torque 2D 3.4

MIT Licensed Open Source version of Torque 2D from GarageGames. Maintained by the T2D Steering Committee and contributions from the community.

Dedicated to 2D game development, Torque 2D is an extremely powerful, flexible, and fast C++ engine which has been used in hundreds of professional games. It is a true cross platform solution providing you access to Windows, OSX, Linux, iOS, Android, and the web - all from one codebase. It includes an OpenGL batched rendering system, Box2D physics, OpenAL audio, skeletal and spritesheet animation, automated asset management, a modular project structure, TAML object persistence, and a C-like scripting language.

Branches

Here is an overview of the branches found in the Torque 2D repository:

  • master: this branch contains the current stable release code that can be used in a production environment.
  • development: this branch is dedicated to active development. It contains the latest bug fixes, new features, and other updates. All pull requests need to go to the development branch. While we try our best to test all incoming changes, it is possible for mistakes to slip in therefore this branch should always be considered unstable.
  • gh-pages: this branch currently contains the html pages generated from doxygen for the engine and TorqueScript references.

Precompiled Version

If you do not wish to compile the source code yourself, precompiled binary files for Windows and OSX are available from the Torque 2D Release Page.

Building the Source

After downloading a copy of the source code, the following project files for each platform are provided for you and can be found in the engine/compilers folder.

  • Windows: Visual Studio 2017 (works with the free Community Edition)
  • OSX: Xcode
  • Linux: Make
  • iOS: Xcode_iOS
  • Android: Android Studio
  • Web: Emscripten/Cmake

See the wiki for available guides on platform setup and development.

Batteries Included

Running Torque 2D for the first time out of the box will start you off in the Sandbox. The Sandbox is a collection of over 30 simple "toys" (or modules) which demonstrate various features in T2D. The default toy is a side scrolling level with a monster truck. To see a list of the available modules/toys to choose from, click on the Show Tools button in the lower right corner of the screen.

Naturally all of the script code and assets for each toy are available to you in the modules folder to use as practical examples while learning T2D.

The Sandbox is also an excellent framework for rapidly prototyping your own game ideas - it allows for easy integration of additional modules and provides numerous debugging features, like console access and real-time metrics.

Documentation

All documentation for the open source version of Torque 2D can be found on our Github wiki page. It contains many tutorials, detailed technical information on engine systems, a script reference guide automatically generated from the source code, and articles on how to contribute to our open source development.

Community

Don't go it alone! Join the active Torque community. Ask questions, talk about T2D and general game development topics, learn the latest news, or post a blog promoting your game or showing off additional engine features in your T2D fork.

You also might be able to find useful information on the less active GarageGames website.

Support

Torque 2D is completely free to use, but like all things, it takes time and energy to maintain and develop. You can support T2D by becoming a sponsor on Patreon. Doing so ensures that T2D will continue receiving the attention it needs to remain competitive.

Become a Patron

You can also support development directly by submitting pull requests or joining the steering committee! See the wiki for details.

License

Copyright (c) 2012 GarageGames, LLC

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Comments
  • TextSprite and Rus text

    TextSprite and Rus text

    Does TextSprite support not latin text? I tried to make a symbol map with english and russian letters, english letters render well but russian letters are invisible

  • GetVersionEx Deprecated Warning

    GetVersionEx Deprecated Warning

    T2D calls GetVersionEx (or, rather, GetVersionExW) in a few places in an attempt to determine the Windows version and do various hacky things (like work around very old Voodoo & Windows 2000 bugs...).

    Unfortunately this is wrong on two fronts. First, GetVersionEx has been deprecated since Windows 8.1 and will return the wrong version information depending on app compatibility settings, etc. More importantly, the workarounds used by the engine really shouldn't be necessary anymore, and seem like old left overs from the TGE codebase. In particular, the engine does things like disable DirectInput & delete the GL context on versions of Windows older than Win2k. Is anyone still releasing games that support Windows 98 and below?

    In my opinion the correct way to go about this is to remove the calls to GetVersionEx altogether and do some cleanup on the winInput.cc and winOGLVideo.cc so the engine stops trying to support 20 year old operating systems. The other approach is to check for the Windows version the "correct" way, like so: http://stackoverflow.com/questions/22303824/warning-c4996-getversionexw-was-declared-deprecated

  • Sixtyfoursupport

    Sixtyfoursupport

    This branch allows Torque2D to be built for 64bit platforms, i.e. 64bit OSX and 64bit Windows.

    The biggest change in this branch is in the TorqueScript compiler & interpreter. To allow for the fact that 64bit machines tend to use 64bit pointers, the code stream has been adjusted so that 8 bytes of data are reserved for string and namespace pointers instead of just 4.

    For details, check out the post on GarageGames: http://www.garagegames.com/community/forums/viewthread/133068

    The project files for Visual Studio 2010 and XCode have been modified to enable 64bit builds. Since I do not have a copy of Visual Studio 2012 installed, that project file remains unchanged.

  • Add initial Linux support

    Add initial Linux support

    This pull request includes the following changes:

    • Addition of a 'Make' compiler folder, for use on Linux-like machines (BSD support has not been tested yet!)
      • Makefiles for Torque2D, zlib, lpng, ljpeg are all included.
    • Rename 'box2d' folder to 'Box2D' to fix case sensitivity problems.
      • Includes changes to relevant project files for other platforms.
    • Change a number of includes throughout the codebase to use proper case.
    • Fix OpenAL searching and functionality for TORQUE_OS_LINUX
    • Add necessary platform methods, some of which are currently stubs until SDL 2.0 is used.
    • Fix platform main loop.
    • Removed CD audio support since no other platforms support it anymore and it's basically irrelevant.
    • Cleanup a few places with dead code.
    • Get cpu frequency reporting to work correctly.
  • Normals of collision shapes appear to be inverse when created after player object added to scene

    Normals of collision shapes appear to be inverse when created after player object added to scene

    When working in the sandbox toys, or in modules of my own, collision normals appear to be getting inverted depending on the sequence of adding objects to a scene. Tested it through a variety of Torque development builds but the behavior has remained consistent and I have been unable to determine if it is something I am doing or not.

    I create some basic platforms as such:

    function PlatformerDemo::createPlatformBlock(%this, %posX, %posY, %sizeX, %sizeY)
    {
        %posZ = 0;
        %object = SandboxScene.create( Sprite );
        %object.Size.x = %sizeX;
        %object.Size.y = %sizeY;
        %object.setBodyType("static"); // Platforms float, so we don't want them effected by gravity
        %object.Position = %posX SPC %posY SPC %posZ;
        %object.Image = "ToyAssets:Tiles";
        // Create some collision shapes.    
        %object.createPolygonBoxCollisionShape(%sizeX,%sizeY);
        %object.setSceneLayer(10);
        return %object;
    }
    

    When a player collides with the object, I check to see if its the top of a platform or block. If so, I turn off gravity on the player object and set a variable denoting that it is on the ground:

    function Player::onCollision(%this, %colide, %details)
    {
        %normal = getWord(%details, 2) SPC getWord(%details, 3);
        // Adjust our normal by rounding up a little
        %word0 = getWord(%normal, 0);
        %word1 = getWord(%normal, 1);
        %word0 = mFloatLength(%word0, 2);
        %word1 = mFloatLength(%word1, 2);
        %normal = mFloatLength(%word0, 4) SPC mFloatLength(%word1, 4);
        if (%normal $= "-0.0000 1.0000" || %normal $= "0.0000 1.0000")       // Haven't checked this recently, may be a result of my rounding, but sometimes the normal returns with a -0.0000 value on the first word so I try to account for both here
            {
            %this.onGround = true;
            %this.setGravityScale(0); // turn off gravity while we're grounded
            }
    }
    

    If the blocks are added to the scene before the player object, everything functions as expected. If the blocks are added after the player is added to the scene, those blocks act as if their normals were reversed: Landing on the top of the block keeps gravity on and treats the player like they are falling in the air. Touching the underside of the block, turns gravity off as if the player landed on the top of the block, and the player will be able to hang in the air and can run back and forth under the edge of the platform.

    Currently I've worked around this by setting a flag on any blocks created when the player object already exists, and checking that flag on collisions. If its true, I reverse the normals before comparing them for the collisions.

  • createPath(%path) no longer creates a path.

    createPath(%path) no longer creates a path.

    When calling createPath, the path is not created. This occurs on all platforms.

    the following code isn't working:

    // When we create the toy, we want to check for a save file.
    // set up our path and filename for save data.   
     PixelPainter.savedirectory = getUserDataDirectory() @ "/PixelPainter";
    
    // if the save directory doesn't exist, create it.
     if (!isDirectory(PixelPainter.savedirectory))
     {
        createPath(PixelPainter.savedirectory);
     }
    

    The isDirectory call returns false and the createPath call returns true, but the path is not created.

    This was working as soon as a week ago when I implemented this script.

  • Android platform updates

    Android platform updates

    • Added Spine files
    • Removed Leap Motion references
    • Fixed multi-touch
    • Case sensitivity fixes for Android on Linux (from camporter)
    • Changes to work with latest NDK (from cam porter)

    This replaces pull request #169

  • OSX build and precompileds broken- libogg error

    OSX build and precompileds broken- libogg error

    Since the 3.2 release, I can't get the engine to build on OSX. When compiling, it complains about needing libogg.dylib come link time, and when running a precompiled build, it crashes looking for libogg.dylib. I don't know the OSX build system well enough to fix it (yet, I'm tinkering with it now), but It sounds like we're not shipping the OSX version of certain OGG (and possibly vorbis) libs. Is this a boneheaded error on my part or do we have an issue here?

  • Implementation of one way collisions for chain and edge shapes

    Implementation of one way collisions for chain and edge shapes

    Updated code based on pull request #236 which uses the ContactFilter to avoid modifying the Box2D library. Currently chain and edge shapes need to be offset from the center of the scene object for the one way property to work. Thanks to @RichardRanft for the original submission.

    Forum discussion can be found here: http://www.garagegames.com/community/forums/viewthread/138755

  • Solution Folders compatibility - Visual C++ 2010 Express

    Solution Folders compatibility - Visual C++ 2010 Express

    When opening the Solution file in Microsoft Visual C++ 2010 Express, the following error is generated

    Solution folders are not supported in this version of the application. Solution folder 'Libraries' will be displayed as unavailable.

    Once the error message is dismissed, the Output window displays the following message

    Some of the properties associated with the solution could not be read.

    Note that the solution still compiles without issues, in Debug, Release and Shipping build configurations.

    There does not appear to be an option in the Express Edition to remove or manage Solution Folders.

    Even removing the 'Libraries' folder from the Solution Explorer still generates the error.

  • Compiling Dev branch on Android

    Compiling Dev branch on Android

    Has anyone been able to compile an Android .apk with the recent version of the Development branch? I spent some time, will probably spend some more but haven't been able to resolve some of the errors I'm getting in android studio. I'm happy to share the specific problems, but wanted to know if there is a change in the build process that maybe hasn't been updated?

    I was still following the Android Development Guide

Related tags
Improved version of the X-Ray Engine, the game engine used in the world-famous S.T.A.L.K.E.R. game series by GSC Game World.
Improved version of the X-Ray Engine, the game engine used in the world-famous S.T.A.L.K.E.R. game series by GSC Game World.

OpenXRay OpenXRay is an improved version of the X-Ray Engine, the game engine used in the world-famous S.T.A.L.K.E.R. game series by GSC Game World. S

Jun 18, 2022
MAZE (My AmaZing Engine) - 🎮 Personal open-source cross-platform game engine
MAZE (My AmaZing Engine)  - 🎮 Personal open-source cross-platform game engine

MAZE (My AmaZing Engine) is the self-written open-source cross-platform game engine in the active development stage. At the moment it is my main pet project, developed for the purpose of learning and preserving different game dev technologies.

Jan 9, 2022
OpenMW is an open-source open-world RPG game engine that supports playing Morrowind.

OpenMW is an open-source open-world RPG game engine that supports playing Morrowind.

Jun 14, 2022
Minetest is an open source voxel game engine with easy modding and game creation

Minetest is an open source voxel game engine with easy modding and game creation

Jun 22, 2022
CLUSEK-RT is a complex game engine written in C++ and the successor of the CLUSEK game engine
CLUSEK-RT is a complex game engine written in C++ and the successor of the CLUSEK game engine

CLUSEK-RT is a complex game engine written in C++ and the successor of the CLUSEK game engine. This engine has been designed with a cross-platform design in mind. Thanks to Vulkan API it delivers a next-gen experience with ray tracing to both Linux and Windows platforms

Jun 12, 2022
Ground Engine is an easy to use Game Engine for 3D Game Development written in C++
Ground Engine is an easy to use Game Engine for 3D Game Development written in C++

Ground Engine is an easy to use Game Engine Framework for 3D Game Development written in C++. It's currently under development and its creation will b

Jun 10, 2022
Rogy-Engine- - My 3D game engine source code.
Rogy-Engine- - My 3D game engine source code.

Rogy-Engine Development My 3D game engine. (NOT THE FINAL VERSION- Windows only) Features: PBR shading and reflection probes with parallax correction.

Apr 29, 2022
Cross-platform, sophisticated frontend for the libretro API. Licensed GPLv3.
Cross-platform, sophisticated frontend for the libretro API. Licensed GPLv3.

RetroArch RetroArch is the reference frontend for the libretro API. Popular examples of implementations for this API includes video game system emulat

Jun 22, 2022
Open-source, cross-platform, C++ game engine for creating 2D/3D games.

GamePlay v3.0.0 GamePlay is an open-source, cross-platform, C++ game framework/engine for creating 2D/3D mobile and desktop games. Website Wiki API De

Jun 17, 2022
KlayGE is a cross-platform open source game engine with plugin-based architecture.

KlayGE KlayGE is a cross-platform open source game engine with plugin-based architecture. It's started since 2003. The explicit goal of KlayGE is: to

Jun 22, 2022
Powerful, mature open-source cross-platform game engine for Python and C++, developed by Disney and CMU
Powerful, mature open-source cross-platform game engine for Python and C++, developed by Disney and CMU

Panda3D Panda3D is a game engine, a framework for 3D rendering and game development for Python and C++ programs. Panda3D is open-source and free for a

Jun 21, 2022
Free, open-source, game engine and a 3D sandbox.
Free, open-source, game engine and a 3D sandbox.

Work-in-Progress The official "early alpha" release should be available around April 2021 SGEEngine SGEEngine is an open source (MIT License), C++ cen

Jun 13, 2022
Ducktape is an Open source Light weight 2d Game Engine that gives utmost priority to user convenience.
Ducktape is an Open source Light weight 2d Game Engine that gives utmost priority to user convenience.

Ducktape is an Open source Light weight 2d Game Engine that gives utmost priority to user convenience. It is written in c++ and uses SFML and Box2d for graphics and physics respectively.

Jun 6, 2022
SnaX Game Engine - Open Source
SnaX Game Engine - Open Source

SnaX Game Engine License SnaX Game Engine - https://github.com/snaxgameengine/snax Licensed under the MIT License http://opensource.org/licenses/MIT.

Jun 8, 2022
This is a list of different open-source video games and commercial video games open-source remakes.

This is a list of different open-source video games and commercial video games open-source remakes.

Jun 20, 2022
Godot Engine – Multi-platform 2D and 3D game engine
Godot Engine – Multi-platform 2D and 3D game engine

Godot Engine 2D and 3D cross-platform game engine Godot Engine is a feature-packed, cross-platform game engine to create 2D and 3D games from a unifie

Jun 22, 2022
Flax Engine – multi-platform 3D game engine
Flax Engine – multi-platform 3D game engine

Flax Engine – multi-platform 3D game engine

Jun 20, 2022
The Atomic Game Engine is a multi-platform 2D and 3D engine with a consistent API in C++, C#, JavaScript, and TypeScript
The Atomic Game Engine is a multi-platform 2D and 3D engine with a consistent API in C++, C#, JavaScript, and TypeScript

The Atomic Game Engine is a multi-platform 2D and 3D engine with a consistent API in C++, C#, JavaScript, and TypeScript

Jun 19, 2022
Hyperion Engine is a 3D game engine written in C++
Hyperion Engine is a 3D game engine written in C++

Hyperion Engine About Hyperion Engine is a 3D game engine written in C++. We aim to make Hyperion be easy to understand and use, while still enabling

Jun 18, 2022