• ### Remove ads and support GameDev.net for only $3. Learn more: The New GDNet+: No Ads! • # Learning How to write a 2D UFO game using the Orx Portable Game Engine - Part 1 General and Gameplay Programming # Overview Welcome to the 2D UFO game guide using the Orx Portable Game Engine. My aim for this tutorial is to take you through all the steps to build a UFO game from scratch. The aim of our game is to allow the player to control a UFO by applying physical forces to move it around. The player must collect pickups to increase their score to win. I should openly acknowledge that this series is cheekily inspired by the 2D UFO tutorial written for Unity. It makes an excellent comparison of the approaches between Orx and Unity. It is also a perfect way to highlight one of the major parts that makes Orx unique among other game engines, its Data Driven Configuration System. You'll get very familiar with this system very soon. It's at the very heart of just about every game written using Orx. If you are very new to game development, don't worry. We'll take it nice and slow and try to explain everything in very simple terms. The only knowledge you will need is some simple C++. I'd like say a huge thank you to FullyBugged for providing the graphics for this series of articles. # What are we making? Visit the video below to see the look and gameplay of the final game: # Getting Orx The latest up to date version of Orx can be cloned from github and set up with: git clone https://github.com/orx/orx.git  Once cloning has completed, the setup script in the root of the files will start automatically for you. This script creates an$ORX environment variable for your system. The variable will point to the code subfolder where you cloned Orx.

Why? I'll get to the in a moment, but it'll make your life easier.

The setup script also creates several projects for various IDEs and operating system: Visual Studio, Codelite, Code::Blocks, and gmake. You can pick one of these projects to build the Orx library.

# Building the Orx Library

While the Orx headers are provided, you need to compile the Orx library so that your own games can link to it. Because the setup script has already created a suitable a project for you (using premake), you can simply open one for your chosen OS/IDE and compile the Orx library yourself.

There are three configurations to compile: Debug, Profile and Release. You will need to compile all three.

For more details on compiling the Orx lbrary at: http://orx-project.org/wiki/en/tutorials/cloning_orx_from_github at the Orx learning wiki.

# The $ORX Environment Variable I promised I would explain what this is for. Once you have compiled all three orx library files, you will find them in the code/lib/dynamic folder: • orx.dll • orxd.dll • orxp.dll Also, link libraries will be available in the same folder: • orx.lib • orxd.lib • orxp.lib When it comes time to create our own game project, we would normally be forced to copy these library files and includes into every project. A better way is to have our projects point to the libraries and includes located at the folder that the$ORX environment variable points to (for example: C:\Dev\orx\code).

This means that your projects will always know where to find the Orx library. And should you ever clone and re-compile a new version of Orx, your game projects can make immediate use of the newer version.

# Setting up a 2D UFO Project

Now the you have the Orx libraries cloned and compiled, you will need a blank project for your game. Supported options are: Visual Studio, CodeLite, Code::Blocks, XCode or gmake, depending on your operating system.

Once you have a game project, you can use it to work through the steps in this tutorial.

Orx provides a very nice system for auto creating game projects for you. In the root of the Orx repo, you will find either the init.bat (for Windows) or init.sh (Mac/Linux) command.

Create a project for our 2D game from the command line in the Orx folder and running:

init c:\temp\ufo

or

init.sh ~/ufo

##### Share on other sites
8 hours ago, trsh said:

..\..\..\lib;$(ORX)\lib\dynamic; doesn't exsist. Some some steps setting up new project are missing. Hi Trsh, thanks for reporting. Under "Getting Orx" there is a part that mentions that git close auto-setup creates a project so that Orx can be used in your own projects. On reflection it's not 100% clear that you need to compile the projects. But I did include the link on compiling which takes you to the Orx wiki. Let me know if that doesn't solve the issue. However, once the orx libraries (debug, profile and release) are all compiled, the "dynamic" folder should then exist. Also check that after git clone step (the post setup step) managed to create an$ORX variable in your environment variables.

##### Share on other sites
On 3/15/2018 at 11:45 PM, trsh said:

..\..\..\lib;\$(ORX)\lib\dynamic; doesn't exsist. Some some steps setting up new project are missing.

I recently made the building of the Orx lib instructions more clear. Should be less of a barrier for new comers.

## Create an account

Register a new account

• 13
• 13
• 11
• 10
• 14
• ### Similar Content

• Hiya! i'm Jason, And i want to reach everyone here who's excited about making games! And as the Title says, I'm looking for either GMS2 Programmers Or Godot Programmers.
I want to invite you to my Game Creation Of Imagistory, A Beautiful 2D RPG game with Plot twists, Corky Characters and an amazing story.
Here is some spoliers:
Long ago, A mystical Comet Flew throughout the universe.
Legends say that one day this comet will create a brand-new galaxy.
A little scientist named Brown tried to fly to space to see the comet in action.
His Friends, the Wizards, went with him to see the explosion.
Until…
A Vortex Pulled them into a strange portal. They all scattered in different locations.
What will Brown Do?

And Here is Some Art:
I'm Ciao Gelato #7986 on discord and my email is is imagistory2500@gmail.com, if you want to contact me there.

• I'm looking for a open source PBR rendering engine that I can use.  Basic requirements are Windows (C/C++) and free to use type license.

The first two hits I get on Google are:

Filament

LuxCoreRender
https://luxcorerender.org/

Does anybody have any experience using any of these, or do you recommend something else that's better?
Thanks.
Pluses: Active development, easy to compile, zero dependencies.
• By Novakin
Looking for a c++ pogrammer to help us on a Viking battle game. We are using unreal engine 4 so knowledge of blueprint would be handy. The project is intended to sell commercially so you will recieve revenue shares. For more info on the project please contact me. Thnak you
• By Sneikyz
Hello,
I'm an amateur digital artist looking for a beginner-level project. I'd like to be a part of a team that wants to learn to create games. It might be a simple idle, mini, simulation game or a visual novel.
I'm still a beginner at backgrounds and I usually draw females but I'm willing to learn.
Time invested to the game creation might differ every week mostly because of my work and will be discussed separately.

Here's my DA : https://www.deviantart.com/sneikyz
• By Josheir
This is a follow up to a previous post.  MrHallows had asked me to post the project, so I am going to with a new fresh thread so that I can get the most needed help.
I have put the class in the main .cpp to simplify for your debugging purposes.  My error is :
I tried adding : #define GLFW_INCLUDE_NONE, and tried adding this as a preprocessor definitions too. I also tried to change the #ifdef - #endif, except I just couldn't get it working. The code repository URL is :
https://github.com/Joshei/GolfProjectRepo/tree/combine_sources/GOLFPROJ

The branch is : combine_sources
The Commit ID is: a4eaf31
glad1.cpp was also in my project, I removed it to try to solve this problem.

Here is the description of the problem at hand:
Except for glcolor3f and glRasterPos2i(10,10); the code works without glew.h.  When glew is added there is only a runtime error (that is shown above.)

I could really use some exact help.  You know like, "remove the include for gl.h on lines 50, 65, and 80.  Then delete the code at line 80 that states..."

I hope that this is not to much to ask for, I really want to win at OpenGL.  If I can't get help I could use a much larger file to display the test values or maybe it's possible to write to an open file and view the written data as it's outputted.