Posted by: Morten Nobel-Jørgensen | September 12, 2009

XNA, Unity, Blender Game Engine – Report on 3D Game Engines


This report is written for the MSc course Engine Programming 2009 on IT University of Denmark. I have published the report here, since I feel that the content of the report is highly relevant for people who is considering using one of the these engines.

Xnalogo Unity-game-engine-logo 70px-Blender.svg

Introduction

In this report I’ll compare three different 3D game engines that is targeted indie game developers. The engines are XNA, Unity3D and Blender Game Engine. They are all free or low cost engines and are all popular choices among indie game developers, students and hobbyists.

All three engines have one thing in common; They all provide an IDE for creating games, where as many other game engines only consist of runtime libraries, API and some documentation. For each of the engines, I’ll explain the nature of the engines and list the underlying technologies the engine is build upon. I’ll focus on easy-of-use, since I believe this is the most important feature of a indie game engine.
In the end, I’ll give a comparison of the three engines.

After reading this report, you should have a overview of what the three engines provide, in what way they should be used and whom the preferred user are.

XNA

XnalogoThe XNA (XNA’s Not Acronymed) framework is Microsoft’s platform for games. XNA is a set of libraries that help the developer in creating games for Windows, XBox 360 and the Zune media player. XNA is build on the .NET 2.0 framework, this means that you can use any of the .NET languages (C#, VB.NET, J#) as they can be compiled into the Common Intermediate Language (CIL). However recommended way to use XNA is using the XNA Game Studio (an extension to Microsoft Visual Studio) that only supports the C# language.

Microsoft released the XNA Game Studio Express (XNA 1.0) in december 2006. In april 2007 XNA Game Studio Express Refresh was released; This release made it possible to compile Xbox 360 binaries and share them with other. Developing for the Xbox requires a Creator’s Club Premium members (a paid membership).

XNA is now available in version 3.1. The features available in the current XNA are: Video, Audio, Network, 3D models, 2D images, input devices, network (both for Xbox Live and XNA Framework games), data storage and animation.

Usage

Then creating games in XNA using the XNA Game Studio you startup by creating a new XNA game project (such as Windows Game or Xbox Game). This project contains a set of source files that creates a empty game application. The XNA take care of the game main loop, all you have to do is to implement the following methods:

Function

Description

Update()

Updates the game logic

Draw()

Draw the game to the screen

LoadContent()

Loads resources used for the game

UnloadContent()

Unloads resources

XNA studio

Screenshot 1

Resources such as 3D models, 2D images, sound and video can be added to the projects as asserts. These asserts are accessible from the code.

Developing games in XNA is very code oriented; When you have written your code, you press “Build and run” to see how the game looks.

Not a full game engine

It is worth mentioning that Microsoft doesn’t define XNA as a game engine, but rather a set of libraries that makes game development easier, such as wrapping Direct3D and providing loaders for several 3D formats. The XNA library lacks some of the typical game engine features such as a scene graph and a physics engine, but is still widely used small and simple 2D and 3D games. If you are going to make larger games in 3D, there exists game engines build on top of XNA. One of the most popular engines for XNA is called Ox and has features like scene graph, visual scene editors, visual GUI editor, particle system and camera control. Ox is open source and released under Microsoft Public License.

Technologies

XNA uses the DirectX 9.0c framework (Direct3D, DirectDraw, DirectMusic, DirectPlay and DirectSound) as backend for all its library and works as a wrapper for simplifying these tasks. As XNA uses DirectX 9, it supports Shader Model 3.0.

XNA also requires the .NET 2.0 Framework.

Games created with XNA

There exist a lot of minor games created in XNA both for the Windows and Xbox platform. The official XNA developer site XNA Creators club has a list of games using XNA (http://catalog.xna.com/en-US/gamescatalog.aspx). You can also find XNA powered games at the Xbox marked place (http://marketplace.xbox.com/en-US/).

Conclusion XNA

XNA is an excellent choice if you are a C# programmer who wants to create some indie games for one of the Microsoft platforms. The framework provides a nice abstraction over the low level DirectX platform and helps you get up and running very fast.
However even for small game projects, you should consider using some of game engines build on top of XNA.

Unity

Unity-game-engine-logoUnity is a game engine developed by Unity Technologies. The first game using the engine was Gooball (Mac OS X), that was created using a pre-release version of the Unity in March 2005. The first public version of Unity was available a few months after. The newest version of Unity is 2.5.1. This version supports Mac OS X and Windows development and can build games targeted for the Mac, Windows, Wii and iPhone platforms, including a web browser plugin for Mac and Windows browsers. Unity is available in a limited Indie version and a full Pro version.

Usage

Screenshot 2

Screenshot 2

Unity is visual development environment. The IDE basically consists of a visual scene editor, a preview window, project files, scene graph and a property editor (see Screenshot 2). Besides script code are created using a simple code editor.

You spend most of the time tweaking visual stuff by either moving, turning or scaling objects in the visual scene editor or adjusting the objects properties. The development process is not only drag and drop, you still need to define the behavior and the game logic using script code. Each script file implements certain functions and each script can be associated with one or more game objects in the scene. You are encouraged use member variables instead of constants in your scripts – these variables will exposed in the property editor and makes it possible to balance and fine-tune the game without any coding.

The script files you create implements one or more of the following functions:

Function

Description

Update()

Called before rendering a frame

FixedUpdate()

Called before every physics time step

OnCollisionEnter( collisionInfo : Collision )

Called when a mesh collision occurs

Each unity project contains an asserts folder. This folder is monitored and any changes to files in this folder are reflected instantly in the Unity development environment. In other words, if the folder contains a 3D Max model, after updating and saving this model in 3D Max, Unity will detect the change and reimport the model automatically.

When play testing games using the editor, you can hit the pause button at any time to see the states of the different game objects. You can even adjust some of the properties, a feature useful for debugging.

Technologies

The Unity engine supports both OpenGL ES 2.0 (for the iPhone), OpenGL 2.1 and Direct3D 9.0c as rendering pipeline. This ensures you that your games look great on any platform.

As physics engine the engine uses the Ageia PhysX 2.6.2.

Unity has a set of predefined shaders, but also allows you to write your own shader using their own shader language: ShaderLab.

Unity uses the Mono project as script engine. The Mono project is an open source implementation of the .NET platform.

Games created using Unity

Unity is now one of the major 3D platforms for browser plugins. One of the major titles is the Lego Star Wars – the quest for R2-D2 (http://starwars.lego.com/en-us/funandgames/clonewars.aspx). There exist a number of absolutely amazing indie games, such as Blush (http://blurst.com/blush/). The official (but incomplete) list of Unity powered games can be found here: http://unity3d.com/gallery/game-list/.

Conclusion Unity

Unity is a great platform for creating 3D games. It is very easy to use and you can create some small functional 3D game very fast. Unity is most of all a tool for indie programmers, but as the quality and speed of their engine has improved, small and medium sized companies has used it for both prototyping and creating small games.

The job section at the unity webpage reveals that Unity in the future will be available on even more platforms, such as PS3, Xbox 360 and PSP.

Blender Game Engine

70px-Blender.svgBlender is an open source 3D application available for all major platforms (such as Windows, OS X and Linux). Blender is most often used for 3D modeling, 3D rendering and 3D animation.

Blender is written C and uses Python for writing extensions such as 3D exporters.

A part of the Blender application is the Blender Game Engine. The engine is basically an extension to Blender that allows you to add game logic to your 3D models (such as physics, input device bindings, sound) and compile the project into a standalone game.

Originally the Blender Game Engine included a browser plugin, but the development of this has been discontinued due to some security issues.

Usage

Screenshot 3

Screenshot 3

Creating games in Blender can be done without writing a single line of code. At least in theory. Game logic is modeled using graphical logical bricks. For each object you can add a number of sensors (such as keyboard, mouse, collision). When these sensors are triggered, they fire events to the associated controllers, and finally, if the controllers conditions are met, events are fired to the associated actuators.

Screenshot 4 shows the keyboard key ‘right’ is mapped the actuator that make a simple motion (The other arrow key mapping are collapsed on the screenshot).

Screenshot 4: Graphical logical bricks in Blender

Screenshot 4: Graphical logical bricks in Blender

For larger games (or more complex game behavior) you can also create your own Python scrips and associate them with certain actions.
For users already familiar with Blender creating a game should be very straight forward. It is very nice that most of the modeling and texturing are done in the same program where your construct your game scene and define the game logic. The only external program you might need is a 2D graphics editing program.

Technology

The Blender Game Engine runtime supports only the OpenGL for rendering (the same thing goes for Blender due to its cross-platform nature).

As physics engine Blender Game Engine uses Bullet, a well known physics engine also used in many AAA titles.
The scripts you write run in the Python script engine.

Gamed created using Blender Game Engine

There only exist one well known game created in Blender: Yo Frankie! (http://www.yofrankie.org/) a game developed in the Blender community.

Based on the number of games created in Blender Game Engine you can conclude that Blender Game Engine is not widely used.

Conclusion Blender Game Engine

Blender Game Engine is a good game engine for people used to work in Blender. However Blender itself is a very complex program that takes some time getting used to. If you a programmer with no or little experience within the 3D game world, Blender Game Engine is not the best way to get you started in creating 3D games. On the other hand, if you are already familiar with the Blender environment this is most likely the fastest way to produce a 3D game.

At the current state (version 2.49) I don’t believe that the engine is useful for any serious projects, but for small games and prototypes the Blender Game Engine would be a fine choice.

Personally I dislike the graphical logical bricks, but it is maybe because I’m a developer. A graphical artist might find the concept easier than code.

Conclusion

XNA, Unity and Blender game engines are three very different approaches to creating games. XNA being the most code orientated and Blender Game Engine the most visual orientated. This makes XNA more appealing to developers and Blender more appealing to 3D artists.

The three engines all targets multiple platforms.
From the Comparison chart below you can see that Unity seems to be the best choice, as it appears to be the most complete engine. However since XNA is not defined as being a game engine, this comparison is not fair. A more fair comparison would be against XNA engines such as Ox. Besides Unity is the only commercial engine of the three.

Comparison chart

XNA

Unity

Blender Game Engine

Latest version

3.1

2.5.1

2.49b

Engine type

.Net Framework for creating games on Microsoft platforms.

Visual game editor

3D graphics application with game engine capabilities

Target user

C# developers

Developers and 3D artist in general

Blender artists and developers with Blender experience

Target platform

Windows, Xbox 360 and Zune

Windows (standalone+browser plugin), Mac (standalone+browser plugin), iPhone and Wii

Windows, Mac and Linux

Price

Free (for Windows games)

Premium membership 99 $ (for creating Xbox games)

199 $ (Indie)

1499 $ (Pro)

Free

Programming languages

C#

Javascript, C#, Boo

Python

Script runtime environment

.NET 2.0 Framework

Mono (open source implementation of .NET)

Python runtime

Graphics API

Direct3D 9.0

Direct3D 9.0
OpenGL 2.1

OpenGL ES 2.0

OpenGL

Physics

N/A

Ageia PhysX 2.6.2

Bullet

Shader

Shader Model 3.0

Shader Model 3.0, GLSL

GLSL

Shader language

HLSL

ShaderLab

GLSL Python

Network support

Xbox Live Gamer services

RakNet

N/A

3D scene graph

No

Yes

Yes

3D scene editor

No

Yes

Yes

3D model editor

No

No

Yes

Terrain editor

No

Yes

No

Particle system editor

No

Yes

Yes

Asset importing

Yes

Yes

Yes

Runtime Engine

.NET 2.0

Mono 2.0

Python 2.5 / 2.6

Video support

Yes

Yes

Yes

Sound

Xact (DirectX)

OpenAL / DirectSound3D

OpenAL

References:

2009 Game Engine Showdown: Game developer Magazine May 2009
http://www.gdmag.com/

Frontline awards 08: Game developer magazine January 2009
http://www.gdmag.com/

XNA Framework Class Library
http://msdn.microsoft.com/en-us/library/bb203940.aspx
XNA Library Game Members
http://msdn.microsoft.com/en-us/library/microsoft.xna.framework.game_members.aspx
Microsoft XNA (Wikipedia)
http://en.wikipedia.org/wiki/Microsoft_XNA
Ox Game Engine for XNA
http://www.codeplex.com/OxGameEngine
Unity
http://unity3d.com/
Unity scripting reference
http://unity3d.com/support/documentation/ScriptReference/index.html
Unity 3D review by Foolish Frost
http://forum.unity3d.com//files/unity_3d_review_998.pdf
Unity (Wikipedia)
http://en.wikipedia.org/wiki/Unity3D
Unity Jobs
http://unity3d.com/company/jobs/
Introduction to (Blender) Game Engine (Tutorial)
http://wiki.blender.org/index.php/Doc:Tutorials/Game_Engine/BSoD
Game Bleder (Wikipedia)
http://en.wikipedia.org/wiki/Game_Blender
Bullet
http://en.wikipedia.org/wiki/Bullet_%28software%29
http://www.bulletphysics.com/wordpress/

Advertisements

Responses

  1. Unity is now available in Version 3.3 and the Indie-Version is free. And it only lacks some less important features like real time shadows. Coding in Unity is Component based instead of Object Oriented Programming (OOP). This means you simply add predefined components (colliders, particle systems, audio sources) or your own scripts to any game object and tweak them to achieve what you want. Much more flexible than OOP IMO.

    And the main reason not to use XNA for me is the requirement of .Net Framework and XNA Framework on the target computer. Two very large and Windows only Microsoft Frameworks which hardly any user will install to test an indie game.

  2. Hey there!
    Thanks for the information, this post was really useful for me.
    Nice work!


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: