Subscribe to GameFromScratch on YouTube Support GameFromScratch on Patreon

9. June 2015

 

This isn’t actually a topic I intended to cover, I was actually working on demos for a Sound tutorial and needed a simple UI.  I started using UMG to knock up a simple HUD, then realized the UI layer itself probably required a tutorial of it’s own!  So here we are, we are going to quickly explore the widgets of UMG to create a simple UI.  As always there is an HD video version of this tutorial.

First we should touch upon some of the technologies available in Unreal Engine, as it can get a bit confusing.  There are two different technologies for UI in Unreal,  Slate and Unreal Motion Graphics(UMG).

Slate

Slate is a UI framework built on top of Unreal Engine.  Much of the Unreal Engine editor itself was built using Slate.  Slate fills the same role as UI solutions such as Scaleform would often perform, although Slate is a bit lower level than that.  Slate uses a declaration language that is a subset of C++.

Unreal Motion Graphics

UMG is a more recent development and is in-fact built over top of Slate.  It is a collection of UI Widgets ( buttons, labels, panels, etc ) exposed using Blueprints.  On top it includes visual designer for composing UIs.  UMG is the preferred technology for creating in game UIs.  In simple terms, it’s a UI layer that enabled you to work visually and using blueprints.

 

Creating a Widget Blueprint

 

To start creating your own UI, create a Widget Blueprint via Add New->User Interface->Widget Blueprint

image

 

I renamed it MyUI, somewhat unimaginatively.

image

Double click the Widget Blueprint to bring up the Designer:

image

 

The Palette has a collection of UI Widgets you can assemble in your own widget.  You may notice in the Hierarchy panel, we start with a Canvas Panel as our root element.

 

Creating a UI is as simple as drag and drop, like so:

gif

 

As you can see, the properties for each widget can be set on the right hand side.  You can then wire events up to the UI component by clicking the + icon to the right of the Event you want to respond to.

image

This will create a new event in the UI widget event graph. 

image

 

We will do a simple Print String on button click, like so:

image

 

Now that we have a UI we need to display it.  To do so, in the Level Blueprint, add the following:

image

When the level loads, we create a new MyUI widget, and add it to the viewport.  The other bit of this blueprint gets the character controller and sets the mouse cursor visible.

Now when you run it, you should see:

image

 

The following function I wired up to a On key handler for toggling the visibility of the UI.  UI layer is a variable I set from the return type of Create MyUI Widget from the blueprint above.

image

 

Of course, this only brushes the very surface of what you can do with UMG, you can do very flash like timeline based animations and create much more involved UIs, but that goes beyond the scope of what I intend to cover today.

 

The Video

Programming , ,

9. June 2015

 

In this tutorial we are going to look at getting a MonoGame development environment up and running on MacOS, create and run our first MonoGame application and finally take a quick look at the Content Pipeline tool.

 

For those that prefer video, there is a video version of this tutorial available here or embedded below.

 

The Installation Process

In order to get up and running there are a couple things you need to install, Mono itself then MonoGame.  We will also be installing Xamarin Platform, which includes Xamarin’s cross platform Mono based IDE Xamarin Studio.  It is not strictly required, but will make your life a great deal simpler.

 

The process is as straight forward as installs can get, simple download an run each installer.  There is not ambiguity to the install, however the install order is extremely important.  Download the following in this order.  In each case be sure to install the most recent version if given an option.

 
As I said earlier, there should be nothing complicated about any of those installs, except the order.  If you install out of order the proper templates for MonoGame won’t get added to Xamarin Studio.
 
 

Our First Project

Now let’s fire up Xamarin Studio and create our first application.  Once Xamarin loads, select New Solution...
 
Ss1
 
 
In the resulting dialog, next select the project template to get started.  Along the left hand side scroll down and locate Other->Miscellaneous. On the right hand side you should see a number of preconfigured MonoGame templates.  For this example we are going to target only Mac OS using Xamarin’s Mac libraries, so select MonoGame Mac Application (Xamarin.Mac), then click Next.
 
Ss2
 
 
All that remains is to pick a location and name for your application as well as if you want Git control or not.  When ready click Create.
Ss3
 
 
This should create a simple application for us with the following code:
#region Using Statements
using System;

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Storage;
using Microsoft.Xna.Framework.Input;

#endregion

namespace HelloMonoGame
{
  /// <summary>
  /// This is the main type for your game.
  /// </summary>
  public class Game1 : Game
  {
    GraphicsDeviceManager graphics;
    SpriteBatch spriteBatch;

    public Game1 ()
    {
      graphics = new GraphicsDeviceManager (this);
      Content.RootDirectory = "Content";
      graphics.IsFullScreen = true;
    }

    /// <summary>
    /// Allows the game to perform any initialization it needs to 
    before starting to run.
    /// This is where it can query for any required services and load 
    any non-graphic
    /// related content. Calling base.Initialize will enumerate 
    through any components
    /// and initialize them as well.
    /// </summary>
    protected override void Initialize ()
    {
      // TODO: Add your initialization logic here
      base.Initialize ();
        
    }

    /// <summary>
    /// LoadContent will be called once per game and is the place to 
    load
    /// all of your content.
    /// </summary>
    protected override void LoadContent ()
    {
      // Create a new SpriteBatch, which can be used to draw textures.
      spriteBatch = new SpriteBatch (GraphicsDevice);

      //TODO: use this.Content to load your game content here 
    }

    /// <summary>
    /// Allows the game to run logic such as updating the world,
    /// checking for collisions, gathering input, and playing audio.
    /// </summary>
    /// <param name="gameTime">Provides a snapshot of timing values.<
                    /param>
    protected override void Update (GameTime gameTime)
    {
      // For Mobile devices, this logic will close the Game when the 
      Back button is pressed
      // Exit() is obsolete on iOS
      #if !__IOS__
      if (GamePad.GetState (PlayerIndex.One).Buttons.Back == 
          ButtonState.Pressed ||
          Keyboard.GetState ().IsKeyDown (Keys.Escape)) {
        Exit ();
      }
      #endif
      // TODO: Add your update logic here 
      base.Update (gameTime);
    }

    /// <summary>
    /// This is called when the game should draw itself.
    /// </summary>
    /// <param name="gameTime">Provides a snapshot of timing values.<
                    /param>
    protected override void Draw (GameTime gameTime)
    {
      graphics.GraphicsDevice.Clear (Color.CornflowerBlue);
    
      //TODO: Add your drawing code here
            
      base.Draw (gameTime);
    }
  }
}

 
We aren’t going to go into any specifics of what this code does, not yet anyways, but we will make sure that it runs.  Hit the Play icon in the top control bar:
 
Ss4 
 
You should now see a full screen cornflower blue window.  If so, congratulations, you just successfully made your first Monogame application!
 

The Content Pipeline

 

The content pipeline was a major component missing from MonoGame, but they have recently implemented one.  The Content Pipeline takes external assets for your game, be them videos, textures, sounds, fonts, etc…  converts them for your platform of choice, generating a XNB file, a binary format that XNA used internally.  Let’s take a look at the process in MonoGame.

 

If you look under the Content folder of your Solution, you will see a file called Content.mgcb. 

Ss5

 

Double click this and the Content Pipeline tool will load:

Ss6

 

This is the tool you use to assemble the assets your game is going to use.  Let’s take a quick example of importing a texture.

 

First select Edit->Add->Existing Item...

Ss7

 

Browse to the image you wish to import as a texture then select OK.

Screen Shot 2015 06 09 at 12 35 35 PM

 

Now you will be asked how you wish to import the file.  I want a copy to be made so the original is unaffected.

Screen Shot 2015 06 09 at 12 36 41 PM

 

Your texture should now be added:

Screen Shot 2015 06 09 at 12 37 09 PM

 

You now have a few options about how the content will be processed on import.  With the image selected, notice the options available below it:

Screen Shot 2015 06 09 at 12 38 17 PM

 

Each different importer has a different set of parameters you can modify.  Here you can set the automatic generation of mip maps, resize to power of 2 dimensions, change the compression settings, etc.

 

By selecting the Importer drop down you can get an idea of the various type of assets supported by the Content Pipeline:

Screen Shot 2015 06 09 at 12 40 04 PM

 

Now select the Content node and the properties available will change again.  This time we simply want to change the target platform to MacOS:

Screen Shot 2015 06 09 at 12 41 11 PM

 

You can have the Content Pipeline automatically process content for a variety of different platforms.  Now that this task is done let’s actually build our content.  Simply select Build->Build or hit F6:

Screen Shot 2015 06 09 at 12 42 08 PM

 

In the directory [Content]/bin/MacOSX there will now be an XNB file available for use.  Let’s add it to our project.

 

In Xamarin Studio, right click the Content folder and select Add->Add Files...

Screen Shot 2015 06 09 at 12 44 15 PM

 

Navigate to the XNB file in Content/bin/MacOSX that you just created and select it.  Then select Override Build action and choose ‘Content'

Screen Shot 2015 06 09 at 12 46 11 PM

 

This time when prompted how to add the file, choose the Link option:

Screen Shot 2015 06 09 at 12 47 57 PM

 

Congratulations, you have now added an asset to your game.  In future tutorials we will look at using them in more detail.

The Video Version

, , ,

7. June 2015

 

In the previous tutorial we covered Sprite Animation, although to be honest it was more about creating animation ready sprites.  The actual way we performed animation wasn’t ideal.  Fortunately we are about to cover a way that is very much ideal… and capable of a great deal more than just animating sprites!

 

As always, there is an HD video of the this tutorial available right here or embedded below.  It’s important to have followed the previous tutorial, as we will be building directly on top of it.

 

Keyframes Explained

 

Before we get to far into this tutorial I think it’s pretty critical to cover a key concept in animation, keyframing.  Essentially you animate by setting a number of “key” frames in the animations timeline, then let the computer take care of the rest.  You can set a keyframe on just about any property available in Godot as we will soon see.  For example you can create a key on the position value of a sprite.  Then advance the timeline, set another key at a different position.  The computer will then interpolate the position over time between those two keys.  This interpolation between key frames is often referred to as a “tweening” as in “inbetween”.  Don’t worry, it will make a lot more sense when we jump in shortly.

 

AnimationPlayer

 

In the previous tutorial, we created a simple animation using code to increment the current frame at a fixed play rate.  Now we are going to accomplish the same thing using the built in animation system in Godot. 

Start by opening up the previous project and remove the code from our AnimatedSprite.  Now add a AnimationPlayer node under the root of your scene, like so:

image

 

With the AnimationPlayer selected, you will notice a new editor across the bottom of the 2D window:

image

 

This is your animation timeline control.  Let’s create a new animation named “walkcycle”

Click the New Animation icon

image

 

Name your animation and click Ok

image

 

Click the Edit icon

image

 

This will extend the animation options even more.

image

 

First let’s set the duration of our animation to 2 seconds:

image

 

You can then adjust the resolution of the animation timeline using the Zoom slider:

image

 

Here we’ve zoomed in slightly to show just over 2 seconds:

image

 

Now that we are in edit mode with our AnimationPlayer selected, in the 2D view, you will notice there are new options available across the top

image

 

This is a quick way to set keys for a nodes positioning information.  You can toggle on or off whether the key will store location, rotation and/or scale data.  You set a key by pressing the Key icon.  The first time you press the key icon you will be prompted if you want to create a new track of animation.

Select your sprite, make sure the timeline is at 0 and create a key. Advance the timeline to 2secconds, then move the sprite to the right slighly, then hit the key icon again to create another key frame.

g1

 

Press the play icon in the AnimationPlayer to see the animation you just created:

g2

 

Well that’s certainly movement, but pretty crap as far as animations go eh?  How about we add some frame animation to our mix.  Here is where you start to see the power of animation in Godot.

 

With the AnimationPlayer selected, rewind the timeline back to zero, make sure you select your AnimatedSprite, then in the Details panel you will notice that all of the properties have a little key beside them:

image

 

This is because you can keyframe just about any value in Godot.  We are now going to do it with the Frame value.  This is the value we programmatically increased to create our animation before.  Now we will instead do it using keyframes.  With the timeline at 0, set Frame to 0 then click the Key icon to it’s right.  Click Create when it prompts you if you wish to create a new track.  Then move the timeline to the end, increase Frame to the final frame (21 in my case), then click the Key again.  This will create a new track of animation:

image

 

You can see the different track names across the left.  The blue dots represent each key frame in the animation.  There is one final change we have to make.  Drop down the icon to the right of the animation track and change the type to Continuous, like so:

image

 

Now when you press play, you should see:

g3

 

Playing Your Animation

 

While your animation appears properly if you press Play in the AnimationPlayer interface, if you press Play on your game, nothing happens.  Why is this?

 

Well simply put, you need to start your animation.  There are two approaches to starting an animation.

 

Play Animation Automatically

You can set the animation to play automatically.  This means when the animation player is created it will automatically start the selected animation.  You can toggle if an animation will play automatically using this icon in the Animation Player controls.

image

 

Play an Animation Using Code

Of course, AnimationPlayer also has a programmatic interface.  The following code can be used from the scene root to play an animation:

extends Node

func _ready():
   get_node("AnimationPlayer").play("walkcycle")

 

Scripting the AnimationPlayer

 

Say you want to add a bit of logic to your keyframed animation…  with AnimationPlayer you have a couple options we can explore.

 

First there are the events that are built into the AnimationPlayer itself:

image

For simple actions like running a script when an animation changes or ends, using AnimationPlayer connections should be more than enough.

 

What about if you wanted to execute some code as part of your animation sequence?  Well that is possible too.  In your Animation editor window, click the Tracks button to add a new animation track:

image

 

Select Add Call Func Track:

image

 

Another track will appear in your animation.  Click the green + to add a new keyframe.

image

 

Now left click and drag the new key to about the halfway (1 second) mark.  Switch to edit mode by clicking the pen over a dot icon, then click your keyframe to edit it.  In the name field enter halfway.  This is the name of the method we are going to call:

g4

 

Add a method to your root scene named halfway:

extends Node

func _ready():
   get_node("AnimationPlayer").play("walkcycle")

func halfway():
   print("Halfway there")

 

When the keyframe is hit, the halfway method will be called.  Adding more function calls is as simple as adding more keys, or complete Call Func tracks.  As you may have noticed in the video above, you have the ability to pass parameters to the called function:

image

 

Finally, you can also access animations, tracks and even keys directly using code.  The following example changes the destination of our pos track.  This script was attached to the AnimationPlayer object:

extends AnimationPlayer


func _ready():
   var animation = self.get_animation("walkcycle")
   animation.track_set_key_value(animation.find_track("AnimatedSprite:transform/pos"),1,Vector2(400,400))

 

Now when you run the code you should see:

g5

 

The Video

Programming , , ,

3. June 2015

 

In this tutorial we are going to look at Sprite Animation in Godot Engine, specifically on using the AnimatedSprite class.  We are going to import and create a node that has multiple frames of animation, then look at some code to flip between frames.  In the immediately following tutorial, we will then cover a much better animation method using AnimationPlayer.

 

As always, there is an HD Video version of this tutorial available right here or embedded below.

 

Alright, let’s just right in with AnimatedSprite.

 

Sprite Animation

AnimatedSprite is a handy Node2D derived class that enables you to have a node with multiple SpriteFrames.  In plain English, this class enables us to have a sprite with multiple frames of animation. 

 

Speaking of frames of animation, this is the sequence of png images I am going to use for this example:

image

 

You can download the zip file containing these images here, or of course you can use whatever images you want.

 

Now we simply want to import them to our using the standard Import->2D Texture method.  Be aware, you can multi select in the Importer, so you can import the entire sequence in one go.  Assuming you’ve done it right, your FileSystem should look somewhat like:

image

 

Now add an AnimatedSprite node to your scene like so:

image

 

Now we add the frames to our AnimatedSprite by selecting Frame->New SpriteFrames

image

 

Now drop it down again and select Edit:

image

 

The 2D editor will now be replaced with the SpriteFrames editor.  Click the open icon:

image

 

Shift select all of the sprite frames and select OK

image

 

All of your sprites should now appear in the editor:

image

 

Now let’s add some code to flip through the frames of our AnimatedSprite.  Attach a script to the AnimatedSprite node, then use the following code:


extends AnimatedSprite

var tempElapsed = 0

func _ready():
   set_process(true)
   
func _process(delta):
   tempElapsed = tempElapsed + delta
   
   if(tempElapsed > 0.1):
      if(get_frame() == self.get_sprite_frames().get_frame_count()-1):
         set_frame(0)
      else:
         self.set_frame(get_frame() + 1)
      
      tempElapsed = 0
   
   print(str(get_frame() + 1))

The logic is pretty simple.  In our process tick we increment a variable tempElapsed, until 1/10th of a second has elapsed, at which point we move on to the next frame.  If we are at the last frame of our available animation, we then go back to the very first frame.

 

When you run it, you should see:

walking

 

Pretty cool!  However, instead of advancing the frame using code there is a much better approach to animation, that we will see in the next tutorial.  Stay tuned.

 

The Video

Programming , , ,

1. June 2015

 

Today we are going to look at creating 2D maps composed of tiles.  You can think of tiles as re-usable lego block like sprites that are assembled to create a more detailed map.  Tiles are stored in a data structure called a tileset, where collision details can be added.  These tiles and tile sets are then used to “paint” 2D scenes in something called a tilemap.  A tile map itself can contain multiple layers of tiles stacked on top of each other.  Don’t worry, it will make sense once we jump in.

 

WARNING!


When I wrote this tutorial, the majority of functionality I cover is currently under very active development. In order to follow along with this tutorial you need to have version 4.8 installed. Currently 4.8 is in preview release only, hopefully it will be released soon and I can remove this message. For now however, if you want to work with 2D tilemaps with collision data, you need to install the development release. For details on how to do this please read this post.

 

So, at this point I assume you either have the developer preview download, enough time has elapsed that this functionality is in the main release or you are simply reading on for future reference.  All the disclaimers out of the way, let’s jump in!

 

There is an HD video version of this tutorial available here: [Coming Soon].

 

Creating a Tileset

 

First start off by loading a sprite sheet texture in Unreal Engine, details of loading a sprite are available here.

For  this particular example, we need some tiles to work with.   Instead of creating my own spritesheets, I am going to use some of the free graphics that Kenney.nl makes available, specifically the Platform Pack.  Obviously you can use whatever image you wish, just be sure that the tiles are size the same and ideally that your image is a power of two in size. 

Import the spritesheet you are going to use for your tiles, in my case I selected Spritesheets/spritesheet_ground.png.  Make any changes you wish to the texture, such as disabling mipmaps and turning filtering to nearest.

Now right click your newly created texture and select Sprite Actions->Create Tileset:

image

 

This will then create a TileSet object, double click it to open the editor.

image

 

The TileSet editor should appear:

image

 

Across the left hand side are all of the tiles that are in your imported sprite.  Selecting one will make it visible in the top right window.  The bottom right window has properties for the entire texture set.  The most important to set right away is the Tile Size:

image

 

Here you enter the pixel dimensions of each individual tile within your image.  In the spritesheet from Kenney.nl, each tile is 128x128 in size.  The remaining settings are for tilesets that have gaps between tiles and aren't applicable in this case.  Both the left and top right window can be zoomed and panned using the regular commands.

 

Now let’s look at setting up collision shapes for a few tiles.  First select a tile from the left side, like so:

image

 

A white rectangle will bound around the selected tile.  It will now appear in the top right window:

image

 

We can now define bounding shapes using the toolbar:

image

 

In this case, a simple box is the easiest ( and least processing intensive.  So click Add Box:

image

 

This will now make it so the entire surface causes a collision.   For non-box shaped tiles, you are often going to want to use the Add Polygon option instead, then define the collision boundary accordingly, like so:

tile

 

Simply click for each vertices you wish to create.  Once done hit enter to finish your shape.  You can shift click to add new points to an existing shape.

Repeat this action for each tile that has collision data.  If a sprite is able to pass completely through the sprite without collision you don’t need to provide a collision shape at all.  Repeat this step for each tile in your set that can be collided with.

You can easily check which tiles you’ve defined a collision shape for by clicking Colliding Tiles:

image

 

When done click Save and we have just created our first TileSet.

 

Creating a TileMap

 

Now it’s time to create a Tilemap.   To create a tilemap select Add New –>Paper2D->Tile Map

image

 

This will create a new tile map object.  Double click it to bring up the tilemap editor.

image

 

Here is the tilemap editor in action:

image

 

On the left hand side is a selection of tiles you can paint with.  In the middle is the canvas you paint on, while on the right are your layer controls and the layer properties.  There are a couple critical things you need to configure right away.

 

First select your tileset.  On the left hand side, drop down the Active Tile Set dialog ( hit the grid icon ) and select the tile set we just created.

image

 

Now in the layer properties, we set the size of our tiles and the overall width and height of our layer ( in tiles ):

image

Start by selecting a base tile to fill the entire map with, select file mode and then click somewhere inside the map grid, like so:

 

Select base tile:

image

 

Choose Fill:

image

 

And click:

image

 

Now select an individual tile to paint with, click Paint, then draw it on the map, like so:

tile2

 

Quite often you are going to want tiles to appear “over” other tiles.  This can be accomplished using layers.  To add a layer simply click the Add New Layer button:

image

 

The order layers are drawn is the same as they are displayed:

image

You can use the up and down icons to change the layer order.  The layer selected ( the one highlighted ) is the layer that all drawing will occur on.

 

Adding your Tilemap to the Scene

 

Now that you’ve created your map, you can use it like you would any Sprite object.  Simply drag it into your scene:

tile3

 

The positioning of the tilemap is important, the Y value is going to determine what is drawn over or under when drawing the scene, just like with sprites.  In this case however, sometimes you want to position your sprite in front of the background, but behind a foreground layer, like so:

tile4

 

This is done using a property called Separation Per Layer in the Tilemap details.

 image

This is the Y coordinate ( confusingly called Z order in the tooltip ) of the layer within the game world.  For example if you position your tilemap at Y= –10 and set Separation Per Layer to 50, the first layer will be at Y=40, the second at Y=90, etc.  Therefore a sprite at 0 will draw in front of the bottom layer, but behind the top layer.

If you want to see a more detailed example showing collisions in action, be sure to watch the video version of this tutorial.

 

The Video

 

Coming soon

Programming , ,

Month List

Popular Comments

C# comes to Unreal Engine
Subscribe to GameFromScratch on YouTube Support GameFromScratch on Patreon


Home > News >

24. October 2014

 

On a daily basis I use dozens of different programming languages.  Some languages are certainly better than other languages at certain tasks, while other languages truly shine on certain platforms.  Some languages are more portable than others, others are more customizable while some can be faster.  All that said, when all other things are equal and I need to just pick a language, the one I go to is generally C#.  C# just strikes that right balance for me, straddling the line between low level and productivity, convenience and speed, functional and procedural, for me at least.  This news then is welcome, for me at least. :)

 

Xamarin, the maker’s of Mono, a cross platform open source version of the .NET runtime and framework (Perhaps most famously known as the language technology that underpins Unity)  have announced they are bringing it to Unreal Engine.  Here are some of the features and benefits of Mono for Unity:

 

Hot Reload

 

We fully support Unreal Engine's Hot Reload functionality.

This means that whenever you rebuild your C# code in Xamarin Studio, your changes are immediately reloated into the Unreal Editor. The changes are also reflected with running games in the editor, so you can quickly iterate on your design.

On fast machines, the process of rebuilding the C# code and reloading it live takes less than a second. It feel instantaneous.

 

Xamarin Studio

While hard core hackers are happy editing their game code with vi or emacs and have the hot reload functionality do all the work for them, we have also provided a nice integration with the MonoDevelop (and Xamarin's branded version, Xamarin Studio).

It provides a first-class IDE with rich, accurate code completion, and powerful refactoring and analysis tools.

 

Debugging

Full support for C# debugging is included. Simply launch your game from Xamarin Studio as a standalone editor or mobile preview process, and it will connect to the runtime debug engine, giving you full access to a rich suite of abilities to inspect and debug your code.

Seamless Blueprint and Editor Integration

Your C# classes that are exposed to Unreal Engine are fully accessible from Blueprint and the Unreal Editor, just like Blueprint-accessible C++ classes.

You can continue using Blueprint for simple logic and use C# when things get more complicated.

And you can consume your C# classes from Blueprint.

 

Mixed C#/C++/Blueprint Solutions

The same tool that we use to generate bindings to Blueprint-exposed Unreal Engine APIs is integrated into Unreal Build Tool, and will automatically generate bindings to all of your Blueprint-exposed C++ gameplay code and engine modifications.

 

Native Access

In addition to the automatically generated bindings to Blueprint-exposed Unreal C++ code, the Mono runtime allows accessing any native APIs, including custom C/C++ code and the native platform API.

You can manually bind C APIs using Platform Invoke services, or use CppSharp to generate bindings to C++ APIs.

 

Async Programming

The Getting Started tutorial shows the low-level approach to defining behaviors, but this approach can become cumbersome when defining more complex behaviors and AI. Luckily, this task can be simplified with async programming, a C# compiler feature that rewrites what appears to be linear code into a state machine.

For more details about how this helps writing complex gameplay logic, see our overview of async programming.

 

API Profile

The Mono Mobile Profile is the core API profile in the support for Unreal Engine.

The Mono Mobile Profile removes a number of bloated .NET features including System.Configuration support from the Base Class Libraries. This is the same API profile used by Xamarin's Android, iOS and Mac products.

Note: The Mobile Profile is not ABI compatible with existing assemblies compiled for a different profile (like the .NET desktop, Silverlight or Windows Phone). You mustrecompile your source code to generate assemblies targeting the Mobile profile.

A full list of the assemblies in our Mobile framework profile can be found here.

 

Portable Class Libraries

You can use Portable Class Libraries with Xamarin's Unreal Engine support. This allows the same binary library to be shared across a wide range of platforms without code modifications.

To learn more about using Portable Class Libraries with Xamarin, read our Introduction to Portable Class Libraries document.

 

There are a couple limitations.  It’s based on .NET up to 4.5, with a smattering of .NET 5 features.  Well, anync, which is frankly the .NET 5 feature.  Perhaps the biggest limitation is it only has access to code from the Blueprint API.  Given that the Blueprint API has access to just about everything C++ does, this isn’t perhaps the limitation it sounds like.  If you want to make more C++ accessible to .NET you need to use CppSharp.  Additionally, Unreal AND Mono need to be available on the targeted platform, although frankly, Mono is available just about everywhere these days.  However, right now only Windows and Mac are supported, with other platforms under development.

 

Oh yeah, there is of course one other big side effect… money.

 

To redistribute code written with Mono for Unreal Engine, you must have a commercial license to the Mono runtime. These licenses are available from Xamarin for Mac, Android and iOS online, and you can request Windows licenses through support.

 

This of course is completely reasonable.  People make their money selling software, so obviously they have to sell their software.  That said, I’ve always found Xamarian’s licensing to be a bit awful.  There are almost unique in the development world for not offering a (real) free version for non-commercial development and this is a huge mistake IMHO.  The lack of a free edition makes open source software around their tools pretty much non-existent.  Of course you can open source work made with Xamarian tools, but good luck building a community around a commercial only development product.

 

That said, this is still an interesting development and one more feather in Unreal Engine’s cap.  Given that Unity is moving away from Mono and developing their own runtime, it’s not entirely shocking that Xamarin made this move.  It is somewhat ironic that the Unreal Engine .NET runtime will be substantially newer and more complete than Unity’s!

News , ,

blog comments powered by Disqus

Month List

Popular Comments