Subscribe to GameFromScratch on YouTube Support GameFromScratch on Patreon
13. November 2014

 

Welcome to the first ever Steam Powered Game Dev review, a look at game development tools available on Steam.  This post looks at FUSE character creator by Mixamo.  In addition to this text review, you can watch the entire thing in video form by clicking right here, or using the embedded player at the bottom.

 

title

Product

Fuse Character Creator

Product Type

3D Graphics Application

Steam Store Page

Website Link

Current MSRP

$99 USD

Steam Discount at Time

75% off

Product Website

Website Link

Available On

Windows, Mac




First let’s start with what Fuse is.   It’s a character creation package, for generating fully textured 3D character models.  If you’ve ever used Smith Micro’s Poser or Daz Studio, you should have a basic idea what to expect.  However, Fuse varies from those packages in some very significant ways.

 

  • It is entirely about character creation, there is absolutely no animation built in.  Don’t worry, this isn’t a big deal as we shall see shortly.
  • It is by far the easiest to use of the three.  Quite literally anyone could use Fuse successfully.
  • It makes for extremely customizable characters, both in regards to model and textures.
  • It has some of the most confusing pricing you will ever see!  ( Actually, Daz is worse! )
  •  

    Character Creation

     

    Let’s jump right in and you can see what I mean.  On it’s surface Fuse is remarkably simple.  You start of by selecting various body parts, like so:

    image

     

    Basically you go through 4 stages.  The first is to build your character model out of body parts.  The above screen shot shows an assembly with a Zombie head selected and torsos being chosen.  Currently for example, there are 34 different torso shapes to be chosen from, ranging from teen cartoon to adult skinny zombie. 

     

    Here is a fully assemble teen female character for example:

    image

     

    You can mix and match body parts however you’d like.  You may be asking at this point… what about creating your own body parts, can you do that?  Yes, you can, I will cover that shortly!

     

    Character Customization

     

    Now that you’ve assembled a basic character by setting the head, arms, torso and legs to use, it’s time to customize.  Simply click the Customize tab and continue, like so:

    image

     

    If you’ve ever played a video game that gave you an incredible amount of control over your character’s creation, you should have some idea of how the process works.  This however goes into a staggering level of detail, with control over pretty much every single facet of your character.  You’ve also always got the Randomize button, which you can simply keep spamming until it spits out something your like.

     

    In addition to using sliders, you can also use the mouse to interactively sculpt the features you want to change, like here with the nose selected:

    image

     

    Clothing your Character

     

    Next it’s time to cloth your character.  One again you simply click the clothing tab.  By the way, you can go back to any of the previous stages at any time if you require.  Clothing works pretty much the same way as character creation:

    image

     

    For each various body part you can choose from a number of different outfits or styles.  If you are wondering, yes, you can give women beards or dress men in thongs if that’s what floats your boat.  There is a decent selection of models available to get started but no doubt you want to know if you can import your own?  Once again, the answer is yes, and once again, we will get to that shortly.

     

    Texturing Your Character

     

    Now that we’ve got a fully dressed 3d modeled character, it’s time to customize the texturing.  This is an area where Fuse absolutely shines!  They have partnered with Allegorithmics to package in their Substance technology for texturing and it’s powerful stuff.  For example, when setting the characters skin texture, here is how it works:

    image

     

    So you can set a basic base skin color, then rapidly modify it using intuitive sliders like “age”, “eye shadow color”, “lipstick” etc.  Plus you have control over the end texture resolution, a critical requirement for games.  You can generate a texture anywhere from 64x64 to 2048x2048.

     

    It’s the sheer volume of controls available for substances that is most impressive, this is just for the skin component:

     

    Video_2014-11-13_145755

     

    You can configure each and every part of your character, using premades like “jean” and sliders like “dirt level” and “age”.  It makes texturing incredibly simple, although there is no option for placing decals or multi texturing right now.  You do however get a fair bit of control over shader performance:

    image

     

    So, essentially that is the process of creating and texturing a full 3D character.

     

    Now it comes to animation, and this is where things get a bit confusing…  but first…

     

    Getting Your Own Content In

     

    As I mentioned earlier, yes, you can import your own body parts and clothing into Fuse, as well as Substances.  However there is a bit of a gotcha, there always is.

    The process is actually quite simple.  You model and UV map in your favorite 3D application, then export in OBJ format, an ancient and simple 3D file format that pretty much every 3D application supports.  However, you do have to follow strict guidelines available here.

     

    Animating Your Character

     

    Although Fuse doesn’t do animation, it’s exactly what the company that make it, Mixamo, does.  Mixamo offers a cloud based animation service and Fuse can hook directly into it.  Basically to get started, you simply click the Animate button when your character is prepared:

    image

     

    Your character will then by automatically uploaded to Mixamo’s servers.  Advanced warning YOU NEED TO HAVE THE UNITY 3D PLAYER ALREADY INSTALLED!

    Otherwise your file will upload then you will get an error.  Pretty stupid that Fuse doesn’t check for it automatically, but c’est la vie.

     

    I’m going to go fairly light on my coverage of Mixamo, as it’s basically a completely different site and service.  You can see a bit more of it in action in the video if you wish.

     

    The basic process goes like this… when you hit Animate in Fuse, your character is uploaded to Mixamo and automatically rigged.  You can then apply different premade animations to your character ( or none at all if you wish ), then download your character.

     

    Here is Mixamo in action creating an animation sequence:

    image

     

    There are hundreds of animations available, some completely free, some for a fee.  We will discuss money in a moment.  Here again you have decent control over your character and you can sequence multiple animations into a single file.

     

    Next you download your file from Mixamo’s server.  Any file your created will be available, so you can re-download to your hearts content.  You simply go to your My Characters” page and select the character to download:

    image

     

    On the download page, you can select in what format you want the file to be downloaded:

    image

     

    You can come back at any time and select a different format, or use different settings.  Now let’s look at the finished project imported into Blender:

    image

     

    The character texture, with bones showing in x-ray mode.  There we have it… a fully rigged, textured character with a walk cycle.  All told it took me about 5 minutes to create this character.

     

    Oh, and you might be wondering, what if I don’t need animation, can I still use Fuse?  Yes, yes you can.  There is an option to export as OBJ format, which again, is available in pretty much every 3D application available.  Of course, the results wont be rigged.  You have a bit of control over the results, but not a ton.  Sadly I couldn’t locate a place to set a polygon budget for example.

    image

     

    I believe it is the simplest way to get a game usable rigged character into a 3D modeling application.  There are other options, Autodesk has their own Character Generator, there’s Make Human and of course Poser and Daz that I mentioned earlier.  Fuse however just hits that sweet spot between ease of use and power that I appreciate so much.  With the exception of the missing Unity Web Player, I encountered no technical issues at all.

     

    There is however the cost…

     

    The Cost

     

    Cost is an interesting subject and can be a bit confusing when dealing with Fuse.  First off, there are two versions of Fuse available on Steam, Fuse Basic and Fuse.

     

    Fuse Basic is a stripped down version, far less body parts, far less character pieces to work with, less textures, etc.  You can however download it completely free, and I encourage you to do so, if only to see if Fuse performs well on your PC.

     

    However, Fuse has one HUGE advantage over Fuse Basic, and something that makes it an incredible bargain.  If you buy Fuse on Steam, you get two free auto rigs a week.  This means that you can have Fuse rig two characters you send to Mixamos server each week.  Now we are about to see the value of Fuse when we look at Mixamo’s pricing.

     

    The are the “bundle plans” on an annual basis:

    image

     

    And here are the “À la carte” prices:

    image

     

    Suddenly those 2 free auto-rigs a week start becoming a hell of a good deal.  The $100 purchase of Fuse on Steam pays for itself after 2 characters are rigged!

     

    What tier you need ultimately comes back to your individual requirements.  Myself, I move at a snails pace, so I highly doubt I will be working on more than two different character riggings per week, plus I am capable of making my own animations if required.  If you are absolutely spitting out characters or use tons of animations however, one of the bundles may be the way to go.  The economics of Fuse Basic though are always bad, especially if you can find Fuse on sale like I did. 

     

    The Video Version

     

     

    Summary

     

    If you need 3D animated characters, Fuse is certainly worth looking at.  With the ability to import any body parts or props into Fuse, you can make pretty much any character you require, assuming you have the ability.  If you have no 3D modeling skill, the breadth of props available in Fuse probably aren’t enough to do everything you need.  If on the other hand you are a great modeler, but terrible animator, Fuse is absolutely perfect for you.

     

    There are a few things I wish that were different.  I wish you had more control over mesh generation and polygon counts specifically.  All told though, I have never encountered a package that enabled me to create animated and actually game usable models anywhere nearly as easy as Fuse does.  I certainly do not regret my purchase.

    Art


    8. November 2014

     

    Amber have just open sourced Copperlicht, a WebGL 3D JavaScript engine.  Copperlich was previously available for 99 Euro per year.

    Logo

     

    Here is an overview of Copperlicht’s functionality:

    • 3D World editor: CopperLicht comes with a full 3D world editor named CopperCube.
    • Many supported 3D file formats: 3ds, obj, x, lwo, b3d, csm, dae, dmf, oct, irrmesh, ms3d, my3D, mesh, lmts, bsp, md2, stl, ase, ply, dxf, cob, scn and more
    • Built-in Collision detection: Throw a polygon soup into the engine and walk around the 3D world.
    • Lots of 3D graphics features, see below.
    • Incredibly fast: CopperLicht is highly optimized and able to render and animate even huge 3d scenes.
    • Character/Skeletal animation: supports playing back animated meshes with an unlimited amount of joints and an unlimted amount of weights
    • Simple to use: easily understandable SceneGraph API with lots of tutorials and examples in the documentation
    • Binary compilation: Unlike other WebGL 3D Engines, CopperLicht compiles your 3D meshes into a small, binary file which downloads quickly, reducing bandwith usage for your users. Simply import your 3D files into the CopperCube editor and publish it as CopperLicht scene.
    • Totally free: CopperLicht is free to use. And open source. Just download and go!

     

    You may notice the strike through that Copperlicht includes a 3D world editor; this isn’t entirely true with the open sourced version.  There is a commercial editor available named CopperCube, however it is a commercial product

     

    I have to say, I like this move.  You can create a full game using Copperlicht without the editor, while the editor is available on a 14 day trial.  This means people can contribute to a Copperlicht project without paying money, but there is a value add sell that means the developer can eat!  I hope this will result in an increase in popularity for Copperlicht that in turn increases sales for Coppercube, which would be win/win.  I personally would like to see the demo extended to 30 days, or preferably be 14 actual days, not 14 calendar days.

     

    This announcement is quite timely, as I just recently had this conversation on Twitter:

     

    TwitterDiscussion

     

    I feel almost prescient!

     

    This is a slightly different business model, but one I firmly support.  On the whole I think this is a great change.  I have used Irrlicht in the past and was impressed by the engine.  Now I am going to look closer at Copperlight and possibly due a tutorial series on it in the future.  Now that Copperlicht and Coppercube are a bit less intwined, I wonder if Coppercube could move to being more agnostic and be of use to say… Three.js or Turbulenz.

     

    Are you at all interested in hearing more about the Copperlicht engine here on GameFromScratch?

    News


    16. October 2014

     

    GameFromScratch has a long running “A closer look at” series of articles that take a deep dive into a particular game engine.  Hopefully by the end, you the reader will have an idea if this engine is the right fit for you or not.logo

     

    Today we are looking at the Urho3D engine, a game engine that somehow flew below my radar for a very long time.  It started life as Bofh3D but apparently was renamed after a tyrannical fish king ( seriously… and thus the fish in the logo to your right! ) According to Google Translate, Urho is Finnish for “Brave”, while 3D… I hope you know that one by this point!  The 3D is a bit of a misnomer though, as like many modern 3D engines, there is a 2D component as well, so you can just as easily make 2D games if that’s what you want to do.

     

    Let’s start straight away with their own description:

     

    Urho3D is a lightweight, cross-platform 2D and 3D game engine implemented in C++ and released under the MIT license. Greatly inspired by OGRE and Horde3D.

     

    Features

    • Direct3D9 or OpenGL rendering (Shader Model 2, OpenGL 2.0 or OpenGL ES 2.0 required as minimum)
    • HLSL or GLSL shaders + caching of HLSL bytecode
    • Configurable rendering pipeline. Default implementations for forward, light pre-pass and deferred rendering
    • Component based scene model
    • Skeletal (with hardware skinning), vertex morph and node animation
    • Automatic instancing on SM3 capable hardware
    • Point, spot and directional lights
    • Shadow mapping for all light types; cascaded shadow maps for directional lights
    • Particle rendering
    • Geomipmapped terrain
    • Static and skinned decals
    • Auxiliary view rendering (reflections etc.)
    • Geometry, material & animation LOD
    • Software rasterized occlusion culling
    • Post-processing
    • HDR renderingv1.31
    • 2D sprites and particles that integrate into the 3D scenev1.31
    • Task-based multithreading
    • Hierarchical performance profiler
    • Scene and object load/save in binary and XML format
    • Keyframe animation of object attributesnew
    • Background loading of resourcesnew
    • Keyboard, mouse, joystick and touch input (if available)
    • Cross-platform support using SDL 2.0 (currently runs on Windows, Linux, Mac OS X, Android, iOS, and Raspberry Piv1.3)
    • Physics using Bullet
    • 2D physics using Box2Dnew
    • Scripting using AngelScript
    • Alternative script interface using Luav1.3 or LuaJITv1.31 (on Windows, Linux, Mac OS X, Android, and Raspberry Pi)
    • Networking using kNet + possibility to make HTTP requestsv1.3
    • Pathfinding using Recast/Detourv1.23
    • Image loading using stb_image + DDS / KTX / PVR compressed texture support
    • 2D and “3D” audio playback, Ogg Vorbis support using stb_vorbis + WAV format support
    • TrueType font rendering using FreeType, AngelCode bitmap fonts are also supported
    • Unicode string support
    • Inbuilt UI system
    • Scene editor and UI-layout editor implemented in script with undo & redo capabilities
    • Model/scene/animation/material import from formats supported by Open Asset Import Library
    • Alternative model/animation import from OGRE mesh.xml and skeleton.xml files
    • Supported build tools and IDEs: Visual Studio, Xcode, Eclipse, CodeBlocks, GCC, LLVM/Clang, MinGW-W64
    • Supports both 32-bit and 64-bitv1.3 build
    • Build as single external libraryv1.3 (can be linked against statically or dynamically)

     

    The line greatly inspired by Ogre3D seems incredibly accurate to me.  On my initial explorations, that is what it most reminded me of, and that is certainly not an insult.  My nutshell description of Urho3D is:

     

    A cross platform, open source, C++ based, Lua and AngelScript scripted game engine that runs on Windows, Mac and Linux and can target all those plus iOS, Android and Raspberry Pi.

     

    So the question remains, what’s the developer experience like?  Well, let’s find out!

     

    The Source Code

     

    Being open source, Urho3D is available on Github.

    image

     

    I only took a quick browse through the actual code but from what I saw, it’s clean and well written in a modern C++ style.  The project is laid out intuitively, the engine and platforms nicely decoupled and things are pretty much where you would expect them to be.  The code is fairly sparsely commented, but the things that need to be commented, are.  We will touch on the documentation a bit later on.

     

    Getting Started

     

    Getting started is pretty simple.  Download the source code archive, extract it and use CMake to build the project files for your platform of choice.  I was up and running in a matter of minutes, however I already had all of the required development tools installed and configured.  If you’ve never used CMake before you may be in for a bit of a fight and if something goes wrong, CMake starts to feel strangely like black magic.  For me though, it mostly just worked.  A warning though, download the master branch!  The version linked of their main page is outdated to the point that the documentation doesn’t actually work.  They really should update the official release version so that it matches their getting started manual!

     

    Once unzipped, Urho3D looks something like this:

    image

     

    Simply run the sh or bat file appropriate to your platform and you are good to go.  One thing to be aware of up front, Urho3D has samples in both AngelScript and C++, but by default the C++ projects aren’t created by cmake.  If you want them, when calling the script, add –DURHO3D_SAMPLES=1.  Additionally, Lua support isn’t added out of the box, if you want Lua support as –DURHO3D_LUA=1.

     

    So for example, to get started on Windows using Visual Studio 2013, with Lua and C++ sample support, run:

    cmake_vs2013.bat –DURHO3D_SAMPLES=1 –DURHO3D_LUA=1

    Now if you go into the Build directory, you will see Visual Studio ( or XCode, or Makefile, whatever you chose ) projects.

     

    image

     

    Simply open Urho3D.sln in Visual Studio and you are done.

     

    Samples Samples and More Samples

     

    This is one area where Urho3D is well represented.  There are a number of included samples, written in both AngelScript and C++.  Here they are:

     

    image

     

    For C++, each sample is a project within your solution.  In the case of AngelScript however, each is simply a script file to be run.  Once you’ve built the Engine, you should have a tool named Urho3DPlayer ( or Urho3DPlayer_d if you built for debug ).  This is a command line utility, simply run it and pass in the path to a script to run.  The scripts are located under the Bin folder in the directory /Data/Scripts.

    image

     

    They are the sample examples as the C++, except of course implemented as AngelScript.

    From the command line, in the bin folder, running:

    Urho3DPlayer Data\Scripts\11_Physics.as

    Will then load and run the script:

    image

     

    It’s worth noting, I also used the –w switch to run the player in Windowed mode so I could take a screen shot.  Hit ESC to exit.  Oh and Urho3D has annoying behavior of grabbing your mouse cursor, don’t worry when you lose your mouse cursor ( even Windowed ), exit with ESC or alt-tab away and you get your cursor back.  I hate really hate when windowed applications take complete control of my mouse!

     

    The code in the samples is well documented, and they cover a wide variety of topics.  This is most likely going to be your primary learning source for getting up to speed quick.

     

    To get an idea of a Urho3D application’s structure, let’s take a look at one of the samples, 03_Sprites.  When run, it will do this (except in motion that is):

     

    image

     

    Now let’s take a look at the corresponding AngelScript and C++ sources.

     

    03_Sprites.as

     

    // Moving sprites example.
    // This sample demonstrates:
    //     - Adding Sprite elements to the UI
    //     - Storing custom data (sprite velocity) inside UI elements
    //     - Handling frame update events in which the sprites are moved
    
    #include "Scripts/Utilities/Sample.as"
    
    // Number of sprites to draw
    const uint NUM_SPRITES = 100;
    
    Array<Sprite@> sprites;
    
    void Start()
    {
        // Execute the common startup for samples
        SampleStart();
    
        // Create the sprites to the user interface
        CreateSprites();
    
        // Hook up to the frame update events
        SubscribeToEvents();
    }
    
    void CreateSprites()
    {
        // Get rendering window size as floats
        float width = graphics.width;
        float height = graphics.height;
    
        // Get the Urho3D fish texture
        Texture2D@ decalTex = cache.GetResource("Texture2D", "Textures/UrhoDecal.dds");
    
        for (uint i = 0; i < NUM_SPRITES; ++i)
        {
            // Create a new sprite, set it to use the texture
            Sprite@ sprite = Sprite();
            sprite.texture = decalTex;
    
            // The UI root element is as big as the rendering window, set random position within it
            sprite.position = Vector2(Random() * width, Random() * height);
    
            // Set sprite size & hotspot in its center
            sprite.size = IntVector2(128, 128);
            sprite.hotSpot = IntVector2(64, 64);
    
            // Set random rotation in degrees and random scale
            sprite.rotation = Random() * 360.0f;
            sprite.SetScale(Random(1.0f) + 0.5f);
    
            // Set random color and additive blending mode
            sprite.color = Color(Random(0.5f) + 0.5f, Random(0.5f) + 0.5f, Random(0.5f) + 0.5f);
            sprite.blendMode = BLEND_ADD;
    
            // Add as a child of the root UI element
            ui.root.AddChild(sprite);
    
            // Store sprite's velocity as a custom variable
            sprite.vars["Velocity"] = Vector2(Random(200.0f) - 100.0f, Random(200.0f) - 100.0f);
    
            // Store sprites to our own container for easy movement update iteration
            sprites.Push(sprite);
        }
    }
    
    void MoveSprites(float timeStep)
    {
        float width = graphics.width;
        float height = graphics.height;
    
        // Go through all sprites
        for (uint i = 0; i < sprites.length; ++i)
        {
            Sprite@ sprite = sprites[i];
    
            // Rotate
            float newRot = sprite.rotation + timeStep * 30.0f;
            sprite.rotation = newRot;
    
            // Move, wrap around rendering window edges
            Vector2 newPos = sprite.position + sprite.vars["Velocity"].GetVector2() * timeStep;
            if (newPos.x < 0.0f)
                newPos.x += width;
            if (newPos.x >= width)
                newPos.x -= width;
            if (newPos.y < 0.0f)
                newPos.y += height;
            if (newPos.y >= height)
                newPos.y -= height;
            sprite.position = newPos;
        }
    }
    
    void SubscribeToEvents()
    {
        // Subscribe HandleUpdate() function for processing update events
        SubscribeToEvent("Update", "HandleUpdate");
    }
    
    void HandleUpdate(StringHash eventType, VariantMap& eventData)
    {
        // Take the frame time step, which is stored as a float
        float timeStep = eventData["TimeStep"].GetFloat();
    
        // Move sprites, scale movement with time step
        MoveSprites(timeStep);
    }
    
    // Create XML patch instructions for screen joystick layout specific to this sample app
    String patchInstructions =
            "<patch>" +
            "    <add sel=\"/element/element[./attribute[@name='Name' and @value='Hat0']]\">" +
            "        <attribute name=\"Is Visible\" value=\"false\" />" +
            "    </add>" +
            "</patch>";

     

    And now the C++ versions:

    Sprite.h

    #pragma once
    
    #include "Sample.h"
    
    /// Moving sprites example.
    /// This sample demonstrates:
    ///     - Adding Sprite elements to the UI
    ///     - Storing custom data (sprite velocity) inside UI elements
    ///     - Handling frame update events in which the sprites are moved
    class Sprites : public Sample
    {
        // Enable type information.
        OBJECT(Sprites);
    
    public:
        /// Construct.
        Sprites(Context* context);
    
        /// Setup after engine initialization and before running the main loop.
        virtual void Start();
    
    protected:
        /// Return XML patch instructions for screen joystick layout for a specific sample app, if any.
        virtual String GetScreenJoystickPatchString() const { return
            "<patch>"
            "    <add sel=\"/element/element[./attribute[@name='Name' and @value='Hat0']]\">"
            "        <attribute name=\"Is Visible\" value=\"false\" />"
            "    </add>"
            "</patch>";
        }
    
    private:
        /// Construct the sprites.
        void CreateSprites();
        /// Move the sprites using the delta time step given.
        void MoveSprites(float timeStep);
        /// Subscribe to application-wide logic update events.
        void SubscribeToEvents();
        /// Handle the logic update event.
        void HandleUpdate(StringHash eventType, VariantMap& eventData);
    
        /// Vector to store the sprites for iterating through them.
        Vector<SharedPtr<Sprite> > sprites_;
    };

     

    Sprite.cpp

    #include "CoreEvents.h"
    #include "Engine.h"
    #include "Graphics.h"
    #include "ResourceCache.h"
    #include "Sprite.h"
    #include "Texture2D.h"
    #include "UI.h"
    
    #include "Sprites.h"
    
    #include "DebugNew.h"
    
    // Number of sprites to draw
    static const unsigned NUM_SPRITES = 100;
    
    // Custom variable identifier for storing sprite velocity within the UI element
    static const StringHash VAR_VELOCITY("Velocity");
    
    DEFINE_APPLICATION_MAIN(Sprites)
    
    Sprites::Sprites(Context* context) :
        Sample(context)
    {
    }
    
    void Sprites::Start()
    {
        // Execute base class startup
        Sample::Start();
    
        // Create the sprites to the user interface
        CreateSprites();
    
        // Hook up to the frame update events
        SubscribeToEvents();
    }
    
    void Sprites::CreateSprites()
    {
        ResourceCache* cache = GetSubsystem<ResourceCache>();
        Graphics* graphics = GetSubsystem<Graphics>();
        UI* ui = GetSubsystem<UI>();
    
        // Get rendering window size as floats
        float width = (float)graphics->GetWidth();
        float height = (float)graphics->GetHeight();
    
        // Get the Urho3D fish texture
        Texture2D* decalTex = cache->GetResource<Texture2D>("Textures/UrhoDecal.dds");
    
        for (unsigned i = 0; i < NUM_SPRITES; ++i)
        {
            // Create a new sprite, set it to use the texture
            SharedPtr<Sprite> sprite(new Sprite(context_));
            sprite->SetTexture(decalTex);
    
            // The UI root element is as big as the rendering window, set random position within it
            sprite->SetPosition(Vector2(Random() * width, Random() * height));
    
            // Set sprite size & hotspot in its center
            sprite->SetSize(IntVector2(128, 128));
            sprite->SetHotSpot(IntVector2(64, 64));
    
            // Set random rotation in degrees and random scale
            sprite->SetRotation(Random() * 360.0f);
            sprite->SetScale(Random(1.0f) + 0.5f);
    
            // Set random color and additive blending mode
            sprite->SetColor(Color(Random(0.5f) + 0.5f, Random(0.5f) + 0.5f, Random(0.5f) + 0.5f));
            sprite->SetBlendMode(BLEND_ADD);
    
            // Add as a child of the root UI element
            ui->GetRoot()->AddChild(sprite);
    
            // Store sprite's velocity as a custom variable
            sprite->SetVar(VAR_VELOCITY, Vector2(Random(200.0f) - 100.0f, Random(200.0f) - 100.0f));
    
            // Store sprites to our own container for easy movement update iteration
            sprites_.Push(sprite);
        }
    }
    
    void Sprites::MoveSprites(float timeStep)
    {
        Graphics* graphics = GetSubsystem<Graphics>();
        float width = (float)graphics->GetWidth();
        float height = (float)graphics->GetHeight();
    
        // Go through all sprites
        for (unsigned i = 0; i < sprites_.Size(); ++i)
        {
            Sprite* sprite = sprites_[i];
    
            // Rotate
            float newRot = sprite->GetRotation() + timeStep * 30.0f;
            sprite->SetRotation(newRot);
            
            // Move, wrap around rendering window edges
            Vector2 newPos = sprite->GetPosition() + sprite->GetVar(VAR_VELOCITY).GetVector2() * timeStep;
            if (newPos.x_ < 0.0f)
                newPos.x_ += width;
            if (newPos.x_ >= width)
                newPos.x_ -= width;
            if (newPos.y_ < 0.0f)
                newPos.y_ += height;
            if (newPos.y_ >= height)
                newPos.y_ -= height;
            sprite->SetPosition(newPos);
        }
    }
    
    void Sprites::SubscribeToEvents()
    {
        // Subscribe HandleUpdate() function for processing update events
        SubscribeToEvent(E_UPDATE, HANDLER(Sprites, HandleUpdate));
    }
    
    void Sprites::HandleUpdate(StringHash eventType, VariantMap& eventData)
    {
        using namespace Update;
    
        // Take the frame time step, which is stored as a float
        float timeStep = eventData[P_TIMESTEP].GetFloat();
        
        // Move sprites, scale movement with time step
        MoveSprites(timeStep);
    }

     

    EDIT: And the Lua example as well:

    03_Sprites.lua

    -- Moving sprites example.
    -- This sample demonstrates:
    --     - Adding Sprite elements to the UI
    --     - Storing custom data (sprite velocity) inside UI elements
    --     - Handling frame update events in which the sprites are moved
    
    require "LuaScripts/Utilities/Sample"
    
    local numSprites = 100
    local sprites = {}
    
    -- Custom variable identifier for storing sprite velocity within the UI element
    local VAR_VELOCITY = StringHash("Velocity")
    
    function Start()
        -- Execute the common startup for samples
        SampleStart()
    
        -- Create the sprites to the user interface
        CreateSprites()
    
        -- Hook up to the frame update events
        SubscribeToEvents()
    end
    
    function CreateSprites()
        local decalTex = cache:GetResource("Texture2D", "Textures/UrhoDecal.dds")
    
        local width = graphics.width
        local height = graphics.height
    
        for i = 1, numSprites do
            -- Create a new sprite, set it to use the texture
            local sprite = Sprite:new()
            sprite.texture = decalTex
            sprite:SetFullImageRect()
    
            -- The UI root element is as big as the rendering window, set random position within it
            sprite.position = Vector2(Random(width), Random(height))
    
            -- Set sprite size & hotspot in its center
            sprite:SetSize(128, 128)
            sprite.hotSpot = IntVector2(64, 64)
    
            -- Set random rotation in degrees and random scale
            sprite.rotation = Random(360.0)
            sprite.scale = Vector2(1.0, 1.0) * (Random(1.0) + 0.5)
    
            -- Set random color and additive blending mode
            sprite:SetColor(Color(Random(0.5) + 0.5, Random(0.5) + 0.5, Random(0.5) + 0.5, 1.0))
            sprite.blendMode = BLEND_ADD
    
            -- Add as a child of the root UI element
            ui.root:AddChild(sprite)
    
            -- Store sprite's velocity as a custom variable
            sprite:SetVar(VAR_VELOCITY, Variant(Vector2(Random(200.0) - 100.0, Random(200.0) - 100.0)))
    
            table.insert(sprites, sprite)
        end
    end
    
    function SubscribeToEvents()
        -- Subscribe HandleUpdate() function for processing update events
        SubscribeToEvent("Update", "HandleUpdate")
    end
    
    function MoveSprites(timeStep)
        local width = graphics.width
        local height = graphics.height
    
        for i = 1, numSprites do
            local sprite = sprites[i]
            sprite.rotation = sprite.rotation + timeStep * 30
    
            local newPos = sprite.position
            newPos = newPos + sprite:GetVar(VAR_VELOCITY):GetVector2() * timeStep
    
            if newPos.x >= width then
                newPos.x = newPos.x - width
            elseif newPos.x < 0 then
                newPos.x = newPos.x + width
            end
            if newPos.y >= height then
                newPos.y = newPos.y - height
            elseif newPos.y < 0 then
                newPos.y = newPos.y + height
            end
            sprite.position = newPos
        end
    end
    
    function HandleUpdate(eventType, eventData)
        local timeStep = eventData:GetFloat("TimeStep")
    
        MoveSprites(timeStep)
    end
    
    -- Create XML patch instructions for screen joystick layout specific to this sample app
    function GetScreenJoystickPatchString()
        return
            "<patch>" ..
            "    <add sel=\"/element/element[./attribute[@name='Name' and @value='Hat0']]\">" ..
            "        <attribute name=\"Is Visible\" value=\"false\" />" ..
            "    </add>" ..
            "</patch>"
    end

     

    As you can see, the code is clean enough and well enough documented to learn from. Unfortunately there aren't equivalent Lua examples right now.

    EDIT: Ok, my bad.  Fortunately there are in fact Lua examples as well!  They were just very well hidden in the /Bin/Data/LuaScript folder.

     

    Hello World

     

    Urho3D commits a common sin and one that drives me absolutely nuts with game engines.  It’s Hello World, in fact, all of it’s C++ examples are built over a “Sample” class.  This means when the reader wants to start from scratch on their own project, they have to tear through the base class to figure out what goes into a core application.  I get why they do this, so they can focus on the feature they want to show, but at least one example should be as complete as possible with no underlying class to build on.  Fortunately I have done this for you.  The following is basically the “minimum usable” Urho3D application:

     

    TestMain.h

    #pragma once
    
    #include "Application.h"
    
    
    using namespace Urho3D;
    
    class TestMain : public Urho3D::Application {
       OBJECT(TestMain);
    
    public:
       TestMain(Urho3D::Context*);
    
       virtual void Setup();
       virtual void Start();
       virtual void Stop() {}
    
    private:
       void onKeyDown(StringHash,  VariantMap&);
    
    };

     

    TestMain.cpp

    #include "TestMain.h"
    #include "Engine.h"
    #include "Graphics.h"
    #include "Input.h"
    #include "InputEvents.h"
    #include "ResourceCache.h"
    #include "UI.h"
    #include "Font.h"
    #include "Text.h"
    
    using namespace Urho3D;
    
    DEFINE_APPLICATION_MAIN(TestMain)
    
    TestMain::TestMain(Urho3D::Context* context) : Application(context){
    }
    
    void TestMain::Setup(){
       engineParameters_["FullScreen"] = false;
    }
    
    void TestMain::Start(){
       SubscribeToEvent(E_KEYDOWN, HANDLER(TestMain,onKeyDown));
    
       SharedPtr<Text> text(new Text(context_));
       text->SetText("Hello Cruel World!");
       text->SetColor(Color::WHITE);
       text->SetFont(GetSubsystem<ResourceCache>()->GetResource<Font>("Fonts/BlueHighway.ttf"), 42);
       text->SetHorizontalAlignment(HA_CENTER);
       text->SetVerticalAlignment(VA_CENTER);
    
       GetSubsystem<UI>()->GetRoot()->AddChild(text);
    }
    
    void TestMain::onKeyDown(StringHash event, VariantMap& data){
       engine_->Exit();
    }

     

    It creates a windowed Hello World application, displays the text “Hello Cruel World” in white, centered to the screen and waits for any key to be pressed before exiting.

    While basic, it should give you some idea how Urho3D works.  There are times, like when trying to figure out parameters engineParameters takes that you really wish for better reference documentation, but it was fairly simple to get things up and running.  I did have a bit of a struggle with life cycle, when I tried to put more logic into Setup() instead of Start() but otherwise things mostly worked how I expected.   Speaking of documentation…

     

    The Documentation

     

    So what’s the documentation like?  It’s split in to two parts, the documentation that has been written covering the various aspects, tasks and systems in Urho3D.  There is also an auto generated class reference. You can read the documentation here.

     

    As you can see, most of the major systems are covered:

    image

     

    The documentation is well written in clear English, and for the most part covers what you would expect it to.  For an open source project I have to say, the overall documentation level is very good.  The only area I was somewhat let down by was the reference material.

     

    There is an automatically generated class reference available:

    image

    But the details are pretty sparse:

    image

     

    So, for example, if you are hunting down say… what audio formats are supported, this information can be a bit hard to find and may result in you having to jump into the source code.  I do wish there was more implementation specific details in the reference materials.

     

    Perhaps I am nit picking at this point…  working so much in Java lately, JavaDoc has really spoiled me.

     

    In summary, the documentation is solid, great in fact for an open source project.  I would however appreciate more detail in the reference material.

     

    Tools

     

    Part of what makes an engine and engine is the tooling it supports.  Urho3D is no exception.  We already mentioned Urho3DPlayer, but there are several other tools, one of which is actually run in the player.  There is a full blown 3D level editor:

    image

     

    The editor enables you to create and edit several node types:

    image

     

    And provides context appropriate property editing:

    image

     

    It’s not going to win any beauty pageants, but it is a full functioning 3D world editor written entirely in AngelScript.  So if it doesn’t have functionality you want, simply add it.  The code is all available in the Bin\Data\Scripts\Editor folder:

    image

     

    With full code access, you should easily be able to extend the editor to fit whatever type of game you are looking at creating.

     

    In addition to the editor, there are a number of other tools.  There is AssetImporter from the Assimp project, for importing 3D assets.  There is also a tool for importing Ogre3D assets.  PackageTool, for pulling your assets all together, a shader compiler, lightmap generator and more.

     

    Summary

     

    Urho3D is an impressive, well documented, cross platform game engine with clean accessible code and a ton of examples.  There are of course some negatives too.  The tools aren’t nearly as polished as you see in many commercial engines, the reference material could be a bit more extensive and the community isn’t huge.  I can’t speak to performance as I never dove in that deeply.  Is it worth checking out for your own game project?  Well, if control and open source are important to you and you like C++, AngelScript and/or Lua, I would most certainly give it a look. 

     

    What do you think, does Urdo3D look interesting to you?  Would you like to see more in depth tutorials from GameFromScratch.com?  Let me know!

    Programming


    1. October 2014

     

    Version 5 of the CopperCube engine was just released.  In their own words, CopperCube is:

     

    CopperCube is an editor for creating 3D apps, games and 3D websites. Import or create your 3D models, set camera controllers, materials, behaviors, click 'publish' and your app is ready. Create everything from simple model viewers to full 3D games. As WebGL websites, Flash .swfs, Mac OS, Windows, or Android apps. You can do all this without programming.

     

     

    The following are the release notes of the new features in Version 5:

     

    • Terrain support

    The editor now includes a way to create and edit terrain. There is also a terrain generator, completely with trees and grass. Terrain can be drawn with height painting tools directly in the editor, textures can be painted quickly with automatic texture blending into the terrain. There are also tools for placing grass and bushes, and for distributing meshes automatically over the terrain.
    terrain support terrain rendering

    • Physics engine
      It can be switched on for the Windows and Mac OS X target in the publishing settings. There is also a new behavior available named 'Move object by physics engine' for making objects behave, collide and move like objects in the real world. Objects with the 'Collide when moved' behavior will also collide against those then and be able to move them, roll them over etc. There is also a way to react when an object collides with the world, for example to play sounds, and a way to manually apply forces to objects using scripting.
      physics simulation
    • Video Playback in 2D and 3D
      The professional version of CopperCube now includes an action to play back videos on the Windows .exe, WebGL and Flash target. Videos can be played back in 2D and 3D (like on any 3D object in a scene), it is possible to influence playback with actions (play/stop/pause) and to react when the video playback has been finished or playback failed.
      video playback
    • Network communcation
      You can now easily do HTTP requests on all targets, in order to exchange data with game multiplayer servers, PHP/MySQL database backends, or whatever you like to. This feature is available as new JavaScript function named ccbDoHTTPRequest(), but there is also an action for doing this without programming for download from the website. This feature doesn't directly provide multiplayer support for your games, but it is now possible to build this yourself on top of this.
    • Added iOS 8 WebGL support
      Apps created with CopperCube and the WebGL target now also run on Apple devices (iPhone, iPad, ...) with iOS 8.
      running on iphone and ipad
    • Shader programming
      You can create and add your own materials and shaders during runtime now using the JavaScript API. In the documentation, you will find a few examples showing you how to start. Note that this is nothing simple, and not for beginners. You need to know shader programming in order to use this feature.
      shader programming
    • Animation blending
      CopperCube now blends animations when switching between them. It is automatically enabled, but can be turned off or adjusted for every animated model manually in the editor or via script. This also means that you don't need to create perfect animation loops anymore. The engine will now automatically blend non-fitting animation loops together so that they look nice.
    • Attaching nodes to animated meshes
      This is useful for example to let characters carry weapons in their hands, to switch them dynamically, change how they look like, or for example to even attach particle systems to moving parts of an animation. Use the command "Modify Selection -> Attach node to animated joint..." for this.
      attaching to animations
    • Directional light
      This is useful for simulating light sources from a very far distance, like for simulating the sun. Directional light can now be used just as the already supported point lights both with the light mapper as well for dynamic lighting.
      directional light
    • Procedurally generated trees
      There is a new scene node type available which generates a tree (a 3d model of a plant) based on user specified parameters. It is possible to create all kind of tree types from it, be it for example a full grown pine or a dead desert bush. This feature is beta, and not very user friendly yet, but planned to be improved in future versions.
      generated trees
    • Faster Lightmapper, with Mac OS X support
      The built-in lightmapper has been rewritten and is now much faster. Additionally, it now also works with shadows on the Mac OS X version of the editor, wich previsously only produced results with diffuse lighting only.
      lightmapper of coppercube
    • Optimized WebGL performance and compatibility
      Not only did we squeeze all these features into a tiny, 180KB .js file, we also improved the performance again by about 20% in certain areas, and improved compatibility with mobile and/or touch enabled WebGL capable browsers such as Chrome for Android.
    • Custom Icons for Windows Apps
      There is now a new option to select an icon for the windows target. Note that embedding the icon in your app might slow down the publishing process by a few seconds, depending on your operating system. (This feature is not supported in the Mac OS X version of CopperCube)
    • Manual Commands for the AI
      Use the function ccbAICommand() for this, so you can send any "Game actor with Health" to a specific location, command it to attack something, or similar.
    • 15 new prefabs
      15 new prefabs added: 2 new animated characters (a soldier; a sleep walker), 2 weapons to be attached to animated characters: a shotgun and a pistol, 11 high quality, low poly prefabs created by Efe: a classic car, a bicycle, an armchair, an ancient statue, a book, a nightstand, a flowerpot, a lamp, two tables, a television.
      prefabs
    ...and many other changes:

     

    • There is now a new command for converting a static mesh to an animated mesh (without animation). This is useful for ditributing huge amounts of static meshes over the terrain without much memory usage, since instances of animated meshes share their data and are culled more efficiently.
    • New, better looking examples come preinstalled with CopperCube now.
    • The 'object controlled by keyboard' behavior now has a more fine tuned animation playback system
    • The 'object controlled by keyboard' behavior now has the option to 'pause' after jumping, making the jumping feature look more like in some platform games.
    • The gravity value is now set per scene, in the root object of the scene.
    • Jumping in all behaviors is much nicer and more physically correct now. But this also means that you might have to adjust your jump settings in existing projects when upgrading to CopperCube 5.
    • Game AI movement is more smoother now
    • Scripting changes: New functions:
      • ccbCreateMaterial()
      • ccbSetShaderConstant()
      • ccbAICommand()
      • ccbSetPhysicsVelocity()
      The following functions are now also available in the editor:
      • ccbGetCollisionPointOfWorldWithLine()
      • ccbDoesLineCollideWithBoundingBoxOfSceneNode()
      Changed behavior:
      • ccbEndProgram() now closes the window in WebGL and Flash
    • When cloning nodes in the editor, also children will now get unique names and ids, and relinked with the behavior of the parent
    • 3D Editor change: When changing the parent child relation of a node, the position of the node is tried to be kept at the old position
    • 3D Editor change: When moving an object which is the child of a rotated parent object, movement will still move into the direction the arrows are pointing
    • When right-clicking onto a texture in the texture browser, there is now a command to save the texture as file to disk.
    • It's possible to use the mouse wheel in the prefabs window
    • Removed feature: It is no longer possible to target Flash players older than version 11
    • When switching the perspective, orthogonal views now place the camera more nicely.
    • The path tool new works a bit nicer when adding new path nodes.
    • Lots of updates to the documentation.

     

    A trial version is available for both Windows and Mac.

    News


    16. September 2014

     

    Searching for and finding 3D models on the internet can be a daunting task.  There are hundreds of sites with free 3D models, but the quality varies massively and it’s a laborious task separating the wheat from the chaff.  If only there was a search engine for this!  Well, now there is.

     

    Enter Yobi3D.com.  Literally a search engine for 3D models:

     

    image

     

    Simply enter a search term and it brings you thumbnailed search results:

    image

     

    Pick a search result and a 3D WebGL viewer pops up.  ( or your iPad that doesn’t support WebGL crashes! ).

     

    image 

     

    From here you can orbit and zoom the model.  Of course you can also navigate to the source using the link at the bottom.

     

    One immediately obvious question, how do you filter results?  If you are a Blender user, you probably don’t want Max files for example.  There is a way to do this, but unfortunately it’s clunky.  In the search box add “AND extension:filetype” like:

    image

    And it will return only Blender results.

     

     

    Very cool new tool and I hope them well.  There are a few things I would really like to see to make this even better.

    • metadata in the search results.  File type, vertex count, etc. 
    • textures if available
    • animations if available
    • license model released under
    • less clunky UI for specifying model format.

     

    Hopefully we will see improvements over time.  All told though, already a very useful tool for people looking for 3D models.

    News


    GFS On YouTube

    See More Tutorials on DevGa.me!

    Month List