From Unity 2D to Unreal Paper 2D

The Game Developers Conference is coming quickly and we’re impatient to hear the announcement from the big guys!

Since a while I wanted to give a try to the Unreal Engine. I’d no doubt that it could outperformed Unity on complex 3D rendering stuff, but for this first test I focused on simple 2D stuff to get familiar with the user interface, engine build process, scripting… Unreal Engine sounded like an indomitable beast in my mind (I spent hours on Unreal Tournament when I was young) but coming from an Unity background, the beast was easily tamed! If you never tried the Unreal Engine, the first thing to do is to check the Unreal Engine 4 For Unity Developers!

Engine & Editor
I installed Unreal on my Mac and my Pc. My old iMac (2013) makes it running, but I wouldn’t imagine crafting a strong 3D project on it. Compared to Unity, it feels way slower, I’ve some freeze, crash etc. But the awesome thing is: no mac is required to make an iOS build! So Unreal meets Adobe AIR as the only technologies which enable iOS build on Pc and that’s huge! Note I’m a happy mac user, but having choice does matter.

Unreal’s Editor is similar to Unity’s one, a Content Browser, a World Ouliner (Hierrachy), Details (Inspector)… You won’t get lost since it also use an entity/component system. Unity Editor VS Unreal Editor

After creating a project, or running samples, the first thing we can easily notice is: there are tons of objects created at runtime! An Unreal’s project doesn’t come with an empty Scene like in Unity. Each Unreal project is associated to a GameMode. Reading GameMode documentation remind you that Unreal Engine has been made for making multiplayer 3D FPS games! So yeah there will probably be no Deathmatch in your app, neither a Match State or Spectators… but you couldn’t remove the GameMode from your project so you’ve to get familiar with it. On the good side, note if one day you need to support multiplayer in your app the engine’ll be almost ready!

So I setup my blueprint character (more on that later) as the Default Pawn class to the GameMode and put it in the level. But when compiling, what the hell, is there two characters? The second one is created automatically by the GameMode! It takes me ages to figure how to remove/how to prevent the one created by the GameMode at runtime! Select the Pawn component, then for the auto possesses player property, select player 0. And that’s it!

Adding 2D Sprite
Unreal works fine with SpriteSheets. Using TexturePacker you’ve a premade template, so you can export easily your assets for Unreal. Unreal’s 2D system is called Paper2D. Compared to Unity’s 2D there are pros & cons:

  • TileMaps support!
  • No 2D physics engine (Box2D only supported for Windows platform).
  • No 2D effector (like one-way platform).
  • Z-sorting or Y-sorting (since Unreal invert Y – Z axis) is like Unity: complicated. You can sort along axis, Settings, rendering, transulancy sort policy: sort along axis (y -1.0) but the y moves also the physics (I’ll come back later on that subject). Or/and you can manage via the Actor (aka GameObject) / Rendering / Translucency Sort Priority.
  • No flip property (added recently by Unity).
  • For having a Sprite animation, create a Flipbook. The animation will play directly on the Scene and the Content Browser.
  • No Mecanim‘s equivalent.

Physics system
On Unreal physics is managed a bit differently than Unity. In Unity you had an Entity, with a SpriteRenderer component and you could add one or multiple Rigidbody2D components and so define the collision in those components. On Unreal, the collision can be defined directly inside the Sprite source editor. So if you move the Sprite depth (via Y axis) it will also change collision management since we’re using a 3D physics engine!

From an API point of view, Unreal exposes a Tick method similar to Update from Unity, but there isn’t a FixedUpdate. Instead you can turn on physics-sub-stepping.

Meeting Blueprints
Here we go… with the real Unreal’s beast. Unity offers C# API, Unreal a C++ one. However if you dig into the Unreal world, you will meet a really popular other way to add scripting to your game: Blueprints. Blueprints is a visual scripting interface integrated inside Unreal. Using engines like Unity, Unreal, there isn’t only developers using them but gameplay designer, level designer, audio designer etc. And having tools like we made in A Blind Legend is really important for the whole team. Since it’s the first time I played with a visual scripting tool, I was enthusiastic. I thought it would be pretty straightforward… crazy me!
some blueprints
It’s really another way of thinking. I spent hours making simple things I would beat in few minutes even with C++! In fact, I understand it’s more readable than code for a non programmer, but writing is own blueprints is not a dummy task.

So forget about Blueprints and move on C++ only? Well, it’s not that easy. Unity’s Prefab are just GameObjects with Components marked as Prefabs for runtime instanciation etc. With Unreal, a Prefab is a Blueprint class. So you create an Actor (aka a GameObject) add components, and finally add a Blueprint class.
Unity’s Prefab suffers from a big lack, no nested prefab support! In Unreal a Blueprint class can extend an other one and that’s so powerful! Oh and Blueprint classes can extend C++ classes! So you will make your strong programming part in C++ and expose simple script via Blueprint so your team can manage them. It feels that Unreal is more suitable for a complex game hierarchy than Unity.

Input
Concerning Input, Unreal has a similar management than Unity for mapping axis, keyboards etc. They can be read directly via Blueprint.

Versioning
Ok so until now, Unreal had many good points, isn’t it? But that last part… oh dear! Ok so let’s go for a bummer: there is no way (please tell me that I’m wrong) for saving Unreal’s files in plain text. No YAML support like Unity, everything is saved in binary file (except C++ file obviously). So no easy versioning on Blueprint. What a shame!
Well in fact, you can’t use external tools to manage diffing. You have to use Source Control integrated with Unreal. You might have to reconfigure your repository so you can use source control integrated.

So that’s it for a first article on Unreal! Maybe it will evolve with further articles 😉

Using Unreal for a pure 2D game sounds a bit unreal (you got the joke) but finally it isn’t that far from making 2D game with Unity. Next to those big guys, there are small ones making an awesome job for pushing pixels on screen: Starling 2 beta is out, and Nez a newcomer based on MonoGame.

5 thoughts on “From Unity 2D to Unreal Paper 2D”

  1. hi so for a bigger who is good with graphics and want to start with a game engine doing 2d game similar to megamanx code : hardcore , or and metrovania style game / vanilla ware
    which engine will help the most for a 2d game with less coding.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.