Subscribe to GameFromScratch on YouTube Support GameFromScratch on Patreon

23. January 2017

 

A few days ago (sorry, computer issues on this end), Godot 2.1.2 was released.  Primarily a maintenance release while Godot 3.0 continues development, there is actually a fair bit packed into this particular release.  The biggest feature in this release is IP v6 support, a recent requirement to get published on the Apple Store.  Features of this release include:

HIGHLIGHTS

This release is quite important for Apple developers, as it brings IPv6 in the networking API, which is now a requirement for applications on the Apple Store. It also fixes a regression from 2.1.1 in the OSX binaries, which had unwillingly set the minimum required OSX version too high.

Another major change is that a bug was fixed in the initialization of most audio drivers which caused an audio latency of about ~200 ms, quite annoying for games which need a precise timing for samples.

  • Networking: IPv6 support and many bug fixes and enhancements
  • Audio: Fix ~200 ms audio latency bug due to misinitialization of some drivers
  • GDScript: Ternary operator (a if cond else b)
  • 2D: Easy API for 2D split screen (with demo)
  • OSX: Fix minimum supported version when compiling with recent Xcode, now 10.9 (regression in 2.1.1)
  • Dozens of bug fixes
  • Many class reference documentation updates
  • Editor translation updates

OTHER NOTABLE CHANGES

The full list of changes is of course lengthier, as it contains 112 commits made since 2.1.1-stable (excluding merge commits). Here's a selection of some of the most interesting ones for end users:

  • Linux/X11: Fix crash when neither ALSA nor Pulse are installed
  • Web: Fixes and improvements for WebAssembly/asm.js
  • Editor: Fix Script Editor drawing over dialogs
  • Editor: Ability to change visibility when ancestor node is hidden (with proper visual feedback)
  • Editor: Add bucket fill preview in TileMap
  • Editor: Add favorites and recent history to create dialog
  • GDScript: Named colors in the Color API
  • 2D: Fix Particle2D initial size randomness property having no effect
  • 2D: Add the finished signal to AnimatedSprite
  • 2D: Add Node2D's set_global_rot, set_global_rotd, set_global_scale and corresponding getters
  • GUI: Make deselect work for TreeItem in SELECT_SINGLE mode and emit item_selected
  • GUI: PopupMenu upgrade: Hide on item selection
  • GUI: Flat button and and styleboxes for ButtonArray
  • Libraries: Embedded library updates: libpng 1.6.28, zlib 1.2.11, opus 1.3 and opusfile 0.8, webp 0.5.2

 

You can read more details on the Godot blog.  The new release is available for download here.  Of course, if you are new to Godot and want to learn it, be sure to check out our complete tutorial series available here.

GameDev News

20. January 2017

 

Vulkan is the successor API to OpenGL and takes things a lot closer to the GPU.  The flipside to this, a lot more is left to the developer to implement.  nVidia have release VkHLF, the Vulkan High Level Framework, to help developers deal with some of the grunt work involved with using Vulkan.  Unlike Vulkan-HPP, VkHLF does add overhead to your code, so there is a performance cost to be paid.  Here is the description of VkHLF taken from the Github readme:

Vulkan High Level Framework

VkHLF is an experimental high level abstraction library on top of Vulkan. It adds features like transparent suballocation, resource tracking on the CPU & GPU and simplified resource creation while staying as close as possible to the original Vulkan API. In contrast to Vulkan-Hpp, which was carefully designed to be a zero-overhead C++ abstraction for Vulkan, this library adds significant higher-level functionality. Even so, it has been designed for high-performance, but it can cost performance relative to native Vulkan if not employed with the intended usage patterns.

Since this project is in its early stages and under heavy development expect bugs and interface changes for a while. It should not be used for production code yet!

 

As the last line says, this is an early stage project and should not be used for production code.  You can check out some samples here.  Even though it helps with some of the complexity, the Hello Vulkan example is still nearly 400 lines of code!

GameDev News

18. January 2017

 

Today marked the release of two important Haxe gamedev libraries, OpenFL and Lime.  Lime is a low level API similar in scope and function to SDL or SFML, providing access to the underlying hardware.  OpenFL is layered on top of lime and attempts to provide a Haxe version of the Flash APIs, including gaming APIs.

 

Changes to OpenFL 4.5.3:

  • Updated for Lime 3.6
  • Updated AGALMiniAssembler to a fresh port of Adobe's last release
  • Added missing Event.FRAME_CONSTRUCTED event
  • Added Dictionary<Object, Object> support
  • Improved support for textField.setTextFormat
  • Updated preloader to use Event.UNLOAD instead of Event.COMPLETE to unload
  • Updated SWFLite library to preload with the parent application
  • Fixed support for slashes in SharedObject names
  • Fixed support for preventing default on keyboard events
  • Fixed a regression in displaying stack traces on crash errors
  • Fixed text measurement on IE 11
  • Fixed return value when scaleX or scaleY is negative
  • Fixed issues where new ByteArray may have values other than zero
  • Fixed an issue with SWFLite assets when using the "generate" option
  • Fixed a possible null crash when updating object transforms
  • Fixed support for garbage collecting Sound when SoundChannel is finished
  • Fixed problems with using textField.appendText
  • Fixed the default template for HTML5 when multiple projects are embedded
  • Fixed wrong colors when values were larger than expected
  • Fixed an issue with needing clearRect on CocoonJS

Changes to Lime 3.6.0:

  • Moved "lime.audio" to "lime.media"
  • Added Vorbis bindings under "lime.media.codecs.vorbis"
  • Added lime.ui.ScanCode, with conversion support to/from KeyCode on native
  • Added tool support for the "--no-output" argument
  • Migrated from NFD to tinyfiledialogs for better dialog support
  • Made window.close cancelable on desktop platforms
  • Updated libjpeg to 9b
  • Updated howler.js to 2.0.2
  • Improved support for Haxe 3.4
  • Improved support for progress events while preloading
  • Fixed force install when deploying to Android (API 16+ devices)
  • Fixed an invalid state when returning from background on Android
  • Fixed playback of a single audio buffer multiple times on HTML5
  • Fixed initial volume level in AudioSource on HTML5
  • Fixed a regression in the default architecture list for iOS
  • Fixed merging of multiple tags in project files
  • Fixed a possible crash when retrieving OpenGL strings
  • Fixed the default template for HTML5 when multiple projects are embedded
  • Fixed support for non-preloaded assets on HTML5
  • Fixed support for image.copyChannel on HTML5 when using WebGL
  • Fixed support for command-line arguments with "lime rebuild"

 

You can read more about both releases here.

GameDev News

18. January 2017

 

In our previous tutorial we covered lighting in our ongoing Babylon Tutorial Series but the objects in our game are still remarkably drab.  A big part of this is the lack of materials applied to them.  In this tutorial we are looking at using the StandardMaterial which handles all the grunt work for you.  You can think of StandardMaterial as a container for several different kinds of textures (diffuse, opacity, etc. ) that can be applied to an object.  It also has some built in attributes such as diffuse (color), emissive (self lighting) and more.  Let’s start straight away with an example that we covered in a previous tutorial.  Applying a simply wireframe to our cube:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="../Common/Lib/babylon.max.js"></script>

    <style>

        #canvas {
            width:100%;
            height:100%;
        }
    </style>
</head>
<body>
<canvas id="canvas"></canvas>
<script>
    window.addEventListener('DOMContentLoaded', function(){
        var canvas = document.getElementById('canvas');

        var engine = new BABYLON.Engine(canvas, true);

        var createScene = function(){
            var scene = new BABYLON.Scene(engine);
            scene.clearColor = new BABYLON.Color3.White();
            var box = BABYLON.Mesh.CreateBox("Box",4.0,scene);
            var camera = new BABYLON.ArcRotateCamera("arcCam",
                    BABYLON.Tools.ToRadians(45),
                    BABYLON.Tools.ToRadians(45),
                    10.0,box.position,scene);

            camera.attachControl(canvas,true);

            var material = new BABYLON.StandardMaterial("material1",scene);
            material.wireframe = true;
            box.material = material;

            return scene;
        }

        var scene = createScene();
        engine.runRenderLoop(function(){
            scene.render();
        });

    });
</script>
</body>
</html>

 

When you run it:

image

 

Simple enough.  We create a StandardMaterial, passing in it’s identity and the scene to create it in.  We set the materials wireframe property to true, then apply the material to our object’s material property.  Note each object can only have a single material, although a compound material exists if you need to mix multiple materials together.  Now let’s look at a slightly more colourful example, this time using more of the built in properties of StandardMaterial.

 

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="../Common/Lib/babylon.max.js"></script>

    <style>

        #canvas {
            width:100%;
            height:100%;
        }
    </style>
</head>
<body>
<canvas id="canvas"></canvas>
<script>
    window.addEventListener('DOMContentLoaded', function(){
        var canvas = document.getElementById('canvas');

        var engine = new BABYLON.Engine(canvas, true);

        var createScene = function(){
            var scene = new BABYLON.Scene(engine);
            scene.clearColor = new BABYLON.Color3.White();
            var box = BABYLON.Mesh.CreateBox("Box",4.0,scene);

            var camera = new BABYLON.ArcRotateCamera("arcCam",
                    BABYLON.Tools.ToRadians(45),
                    BABYLON.Tools.ToRadians(45),
                    10.0,box.position,scene);

            camera.attachControl(canvas,true);

            var light = new BABYLON.PointLight("pointLight",new BABYLON.Vector3(
            5,5,0),scene);
            light.diffuse = new BABYLON.Color3(1,1,1);



            var material = new BABYLON.StandardMaterial("material1",scene);
            material.diffuseColor = BABYLON.Color3.Blue();
            material.emissiveColor = BABYLON.Color3.Red();

            material.specularColor = BABYLON.Color3.Red();
            material.specularPower = 3;
            material.alpha = 1.0;
            box.material = material;

            var plane = BABYLON.Mesh.CreatePlane("plane", 10.0, scene, false, 
            BABYLON.Mesh.DOUBLESIDE);
            plane.material = new BABYLON.StandardMaterial("material2",scene);
            plane.material.diffuseColor = new BABYLON.Color3.White();
            plane.material.backFaceCulling = false;
            plane.position = new BABYLON.Vector3(0,0,-5);

            return scene;
        }

        var scene = createScene();
        engine.runRenderLoop(function(){
            var material = scene.getMeshByName("Box").material;
//            material.alpha -= 0.01;
//            if(material.alpha < 0) material.alpha = 1.0;
            scene.render();
        });

    });
</script>
</body>
</html>

Running this example results in:

image

 

Here you can see we’ve set the diffuse, emissive and specular values of the cube.  I also created a plane so you can see the emissive value of our cube has no effect on it.  The diffuse property can be thought of as the colour in the traditional sense.  Emissive on the other hand is a value for an internal light of the material, there aren’t actually that many emissive parallels in the real world, but some mosses and a few creatures have an emissive property to them.  Specular color determines how external light sources interact with the surface.  If you look at the commented code in the main loop you will also see commented code affecting the alpha channel of the material.  Alpha can be thought of transparency, with a value of 1 being fully opaque, while 0 is fully transparent.

What the majority of people think of when they work with materials is textures.  Textures are simply images that are applied the surface of an object like virtual wallpaper.  There are different types of textures as well, some effect the color of a surface, others affect the transparency or normals.  Here is an example:

<script>
    window.addEventListener('DOMContentLoaded', function(){
        var canvas = document.getElementById('canvas');

        var engine = new BABYLON.Engine(canvas, true);

        var createScene = function(){
            var scene = new BABYLON.Scene(engine);
            scene.clearColor = new BABYLON.Color3.White();
            var box = BABYLON.Mesh.CreateBox("Box",4.0,scene);
            var camera = new BABYLON.ArcRotateCamera("arcCam",
                    BABYLON.Tools.ToRadians(45),
                    BABYLON.Tools.ToRadians(45),
                    10.0,box.position,scene);

            camera.attachControl(canvas,true);

            var light = new BABYLON.PointLight("pointLight",new BABYLON.Vector3(
            0,10,0),scene);
            light.parent = camera;
            light.diffuse = new BABYLON.Color3(1,1,1);


            var material = new BABYLON.StandardMaterial("material1",scene);

            material.diffuseTexture = new BABYLON.Texture("gfs.png",scene);
            material.bumpTexture = new BABYLON.Texture("gfs_normal.png",scene);
            material.roughness = 0.5;
            box.material = material;



            return scene;
        }

        var scene = createScene();
        engine.runRenderLoop(function(){

            scene.render();
        });

    });
</script>

 

And when you run it:

image

 

This example uses two different textures, a diffuse texture:

gfs

 

And a normal map:

gfs_normal

 

For more details on Normal Maps, check this video on Normal Map 101.  Somewhat confusingly, BabylonJS refers to normal maps as bump textures.  This only scratches the surface of the material and texture options available, you also have options like ambient, opacity, reflection, light and specular textures, but you will find they almost all work exactly the same way.

Programming , , ,

17. January 2017

 

Microsoft have just released a beta version of PIX, a performance tuning and debugging tool aimed at game developers.  Previously only available on XBox consoles, PIX is now available for Windows machines for games running Direct X 12.pixscreenshot

 

About PIX:

PIX on Windows provides five main modes of operation:

  • GPU captures for debugging and analyzing the performance of Direct3D 12 graphics rendering.
  • Timing captures for understanding the performance and threading of all CPU and GPU work carried out by your game.
  • Function Summary captures accumulate information about how long each function runs for and how often each is called.
  • Callgraph captures trace the execution of a single function.
  • Memory Allocation captures provide insight into the memory allocations made by your game.

For best results we recommend running PIX on:

  • Windows 10 build 14393 (Anniversary Update, aka RS1) with latest updates
  • 32 GB RAM
  • A Direct3D 12 GPU with the latest available graphics drivers.  PIX will not work correctly with older drivers!

See the requirements page for more information.

 

The beta is free and is available for download here.

Month List

Popular Comments