Quantcast
Channel: Envato Tuts+ Game Development
Viewing all articles
Browse latest Browse all 728

How to Learn Orx

$
0
0

Orx is an open source, portable 2D game engine, which currently runs on Windows, Mac, Linux, iOS and Android (2.3+), and uses OpenGL (ES for iOS/Android) for render acceleration. It's data-driven, and uses a simple yet powerful configuration system which allows you to quickly prototype and validate ideas. In this article, I'll share tips and resources for learning Orx, and show you what it's capable of.


Why Orx?

I've tried different game engines and frameworks (Corona SDK, AndEngine, and recently Unity) before finding Orx, and, since then, I've never found anything similar or easier to use for my needs. (Admittedly, that's a subjective statement.)

Under the hood, Orx uses OpenGL-accelerated rendering, with auto-batching when possible, OpenAL for sound positioning, and Box2D for physics.

Here are the main reasons why I stick with Orx.

The Author

Honestly, this is the main reason. The author of Orx (alias iarwain) is really a nice guy, open-minded, and very helpful (both regarding Orx itself and gamedev in general), and that's priceless for me. If you're stuck with something, or you miss an API, just drop a post in the forum and you'll get a response in no time.

It's Open Source

I'm not an open-source extremist; I don't mind using a good closed source library / framework if it does the job correctly and has a good API and documentation. But being open-source with a very permissive license (zlib, in Orx's case) is always a plus. This has allowed me to write and rewrite the Android plugins to get it to work—and it's always interesting to see what's under the hood.

(The Orx code and APIs are very clean, too, so you can learn a lot from digging in to them.)

The Configuration System

This where Orx shines. Frankly, the configuration system deserves a complete article to itself, because there is a lot to it. Configuration may not be the best name, because it's much more than just the engine configuration. The syntax is based on .INI files and adds some useful features, like section inheritance.

There are many different usages for the configuration system:

  • Engine and plugin configuration: This is where you tweak the physics, set the camera and display sizes, set the stream buffers' sizes, map the inputs, and so on.
  • Object data definition: Here, you define your textures, graphics, sounds, effects, animations, objects, spawners, shaders, and so on.

    In Orx you can, of course, create engine objects through the API, but you can also create them by specifying the name of a section in your .INI files:

    orxOBJECT* pstSoldier = orxObject_CreateFromConfig("Soldier");
    
    [Soldier]
    
    Graphic = SoldierGraphic
    Position = (0, 0, 0)
    
    [SoldierGraphic]
    
    Texture = soldier.png
    Pivot = center

    The above will create and display the Soldier "sprite" in the center of the world. Now I can add effects, shaders, and animations, change its size, its texture, and more, without changing a single line of code! That is genius.

  • Global data: Since the configuration is accessible through the API, you can use it to store and retrieve global variables.
  • Advanced usage: This includes timelines (which execute commands, like a scripting language) and object templates.

Who Is It For?

Orx is a fully featured 2D game engine running on both desktop and mobile platforms, and can be used for prototyping and for complete games with all the shiny effects you can imagine.

I would personally recommend Orx for anyone that wants to make games and focus on the game logic, whether pro, indie or amateur. If you know C/C++, you should give a try, I think you'll be impressed.

It may sound like I'm promoting the product (well, maybe I am, a bit), but this is my personal experience I'm expressing here.


Showcase

Unfortunately, Orx suffers from poor public exposure, so there is no big released game to show off. But let's look at what Orx games are out there already.

Mushroom Stew

Mushroom Stew is a small platform game developed by the author of Orx. It includes nice water effect shaders and some local time distortion.

How to Learn Orx
How to Learn Orx

N.E.X.U.S. Reloaded

Also known as The Clarion Project, this is a remake of the 1986 Commodore 64 game N.E.X.U.S.


Le Magasin Des Suicides

Le Magasin des Suicides was made by myself as a promotional Android/iOS game for the French movie of the same name.

How to Learn Orx

Hazardous Attack

Hazardous Attack is a cartoon shooter made by Oxl Games.



Getting Started

Where to Download Orx

You can find the download links on the official Orx website. Precompiled libraries are available for each platform for the latest released version.

Since Orx is open source, you can also get the complete source tree from the official Bitbucket repository. This repository is always in good shape and ready to be compiled, and is the recommend way to start working with Orx since it includes the latest fixes and new features added to the game engine. It also contains the source of the tutorials.

Compile It

If you downloaded the precompiled libraries (not recommended) you are all set; just add the include and lib folder to your game project, and start working on your next killer game.

If you cloned the Mercurial repository, you first need to compile the engine. No big deal here. Orx uses premake4 to set up the project to compile for your desired platform (except for Android).

  1. Go to the orx/code/build directory
  2. Call premake (located in orx/extern/premake) with the desired IDE as an argument.

Here is the list of supported arguments.

  • codeblocks: Generate Code::Blocks project files
  • codelite: Generate CodeLite project files
  • gmake: Generate GNU makefiles for POSIX, MinGW, and Cygwin
  • vs2002: Generate Microsoft Visual Studio 2002 project files
  • vs2003: Generate Microsoft Visual Studio 2003 project files
  • vs2005: Generate Microsoft Visual Studio 2005 project files
  • vs2008: Generate Microsoft Visual Studio 2008 project files
  • vs2010: Generate Microsoft Visual Studio 2010 project files
  • vs2012: Generate Microsoft Visual Studio 2012 project files
  • vs2013: Generate Microsoft Visual Studio 2013 project files
  • xcode3: Generate Apple Xcode 3 project files (experimental)
  • xcode4: Generate Apple Xcode 4 project files (experimental)

Android

For Android, you'll need the latest Android NDK installed. Then:

  1. Go to the orx/code/build/android directory.
  2. Call ndk-build.
  3. Call the install.sh script to copy the binaries to their installation directory.

Official Forums

The Orx forums should be your first place to look for help. The community is very small, but seasoned members are willing to help anyone.

The author of the engine is also very quick to respond and, as a senior game developer (currently working at Ubisoft Montreal), he always has relevant advice to offer for solving a problem.


The Wiki

The Orx wiki is also a good place to look at if you are lost. There are sections to help you set up your environment for the different supported platforms, and a section to help you with the configuration system.

The Tutorials

The tutorials will guide you from the basics to the more advanced features of Orx.

The first tutorial shows how to render the most simple scene, and how you can play with the different object properties in the .INI file to change the scene without changing the code.

It's a good tutorial for experimenting with the data-driven part of Orx and how it allows you to quickly prototype something.


Tools

Let me make it clear: Orx is not Unity, so you won't find a fully featured Scene Editor with real time preview or anything like that.

However, the community has built some tools to help you with different aspects of Orx. You can find them at the Orx Bitbucket page. I've rounded up some of my favourites.

Scroll/ScrollEd

Scroll/ScrollEd is not really a tool, it's more like a layer on top of Orx that helps you with the binding of your C++ game objects' classes.

How to Learn Orx

It also includes a level editor.

How to Learn Orx

TexturePacker Exporter

TexturePacker Exporter is an exporter for the powerful tool TexturePacker.

AnimationEditor

AnimationEditor is a simple GUI tool to help you create animations for Orx.

How to Learn Orx

TiledToOrx

TiledToOrx is a simple GUI tool that converts Tiled Map Editor files (.TMX) into ORX Config (.INI) files.

How to Learn Orx

Conclusion

Orx is an actively developed game engine. I've been using it for my personal projects for two years, and I've lost count of all the new features added since then. You can check the complete list of features on the About Orx page.

I hope this small introduction gave you a taste of what Orx is and what makes it a powerful and interesting game engine. I can only encourage you to give it a shot and play with the tutorials. Don't hesitate to ask your questions here or in the Orx forum.


Viewing all articles
Browse latest Browse all 728

Trending Articles