Subscribe to GameFromScratch on YouTube Support GameFromScratch on Patreon

31. October 2016

 

The following is a recap of major events in the world of game development for the week ending October 31st, 2016.  I do a weekly video recapping the news available here with this week’s video embedded below.  This post is a collection of links mentioned in the recap.

 

 

The Video

GameDev News

31. October 2016

 

LWJGL, the Light Weight Java Game Library, is a low level game framework for Java layered over top of libraries such as OpenGL, CL, AL and Vulkan.  It has been used by a number of game engines including LibGDX and jMonkeyEngine to provide performant cross platform 3D support in Java.  LWJGL just released version 3.1, updating several of the underlying bindings, making various improvements and several bug fixes.

 

From the release notes:

Bindings
  • Bindings have been split into modules and are available as separate artifacts. (#100)
    • The download configurator on the website can be used to customize LWJGL builds and Maven/Gradle projects.
  • Added LMDB bindings.
  • Added Nuklear bindings. (#101)
  • Added Tiny File Dialogs bindings.
  • Added bgfx bindings. (#240)
  • Added support for new EGL, OpenCL, OpenGL, OpenGL ES and Vulkan extensions.
  • Updated all bindings to latest versions.
  • Vulkan javadoc is now almost identical to the Vulkan man pages, with links to the online Vulkan specification.
Improvements
  • Generator: Removed buffer object binding checks. (#197)
  • Generator: Added support for mapping byte/short parameters to int.
  • Generator: Added support for va_list parameters.
  • Generator: Reduced bytecode size of generated methods.
  • Generator: The Vulkan bindings are now automatically generated.
  • Optimized strlen methods used internally by LWJGL.
  • Optimized misaligned memSet and memCopy.
  • Added support for stack allocations with custom alignment.
  • Removed allocation functionality from read-only, externally managed structs.
  • Improved library loading diagnostics and added Configuration.DEBUG_LOADER option.
  • Libraries extracted by the SharedLibraryLoader are now locked to avoid conflicts with other processes (e.g. antivirus software). (#225)
  • Simplified javadoc of unsafe versions.
Fixes
  • Callback instances are now tracked when the DEBUG_MEMORY_ALLOCATOR option is enabled.
  • Fixed realloc tracking in the debug allocator.
  • Shared libraries that ship with LWJGL are now always preferred over system libraries.
  • Fixed return type of functions that return pointer to boolean.
  • stb_image: Fixed result auto-sizing of stbi_load* functions.
  • Functions that deallocate memory no longer have Java array overloads.
  • Fixed memSet bugs.
  • Fixed Java array overload generation for functions with multiple auto-size-result parameters.
  • Fixed custom checks in Java array overloads.
  • Fixed lookup of Critical JNI natives on Windows x86.
  • Disabled Critical JNI natives for functions affected by JDK-8167409 on Linux & MacOS.
Breaking Changes
  • xxHash: Added support for stack allocation of streaming hash state. Opaque handles have been replaced by the XXH*State structs.
  • NanoVG: Dropped version suffixes from NanoVGGL classes.
  • Mapped more integer parameters and return values to Java booleans, that were missed while working on #181.
  • Dropped VKUtil class and moved the version macros to VK10.

The LWJGL project is open source and available on Github here.

31. October 2016

 

Cocos Creator is an open source JavaScript powered game engine and editor built on top of the Cocos2d-x framework.   For more details of how Cocos Creator works, check out this hands-on video showing an earlier version in action.  Cocos Creator just released a new version, 1.3, bringing several new features including rich text support, a new audiococos engine and Dragon Bones animation file support.  On gotcha of this release however is that 32bit Windows support for the editor has been dropped.

 

From the release announcement in the Cocos2d-x forums:

 

Cocos Creator 1.3.0 released!

We are excited to release version 1.3.0 of Cocos Creator. Cocos Creator is a new, unified, development tool that handles every step in the game development process.

This version offers an incredible performance increase for both Web and native platforms. There are 6 major features and numerous small changes in this version that will help Creator meet the needs of more and more types of projects! The following is the highlight of this update:

  • Rich text support
  • Dragon Bones skeleton animation support
  • Prefab automatic synchronization
  • Automatically packaging textures to Atlas
  • Added UI controls: PageView, Toggle, ToggleGroup, Slider
  • New AudioEngine

Important upgrade instructions

  • The Windows version now uses use a 64-bit architecture, there is no longer support for 32-bit Windows systems. The advantage is that the editor can deal with a large number of image resources and improve the efficiency by at least 5 times, but also to support the emerging image format Webp.

GameDev News

31. October 2016

 

With the Microsoft Hololens one step closer to being an actual consumer product (and an affordable one to boot!) Unity have stepped up their holographic development support. The current development iteration times have been a bit painful using the Hololens devkit, so this new approach should hopefully speed things up a great deal.

Holographic Emulation is a new feature that vastly reduces iteration time when developing holographic applications in Unity. Developers creating applications for Microsoft HoloLens will immediately benefit by being able to prototype, debug, and iterate on design directly from the Unity Editor without getting bogged down by long build and deploy times. Holographic Emulation works in two different modes: Remoting and Simulation.

holographicremotinganim-2-50

Holographic Remoting allows you to run your application directly from the Editor after connecting to a Windows Holographic device (Microsoft HoloLens). The application will behave as if it were deployed to the device (with full sensor data and positioning), but will actually be running on the host machine. The Game view window will also allow you to see what is being rendered on the device (absent, of course, anything that the wearer of the device sees from the real world).

Holographic Simulation goes one step further, allowing you to run on a simulated device directly in the editor — in other words, no physical device is necessary. This is a great option for development when you have a limited number of devices to share among your team, or you want to get started early with holographic development before getting physical hardware.

 

You can read a great deal more about the new Emulation options at this blog post here.

GameDev News

28. October 2016

 

Unity have released another patch, this one 5.4.2p2. Contains fixes in the areas of graphics, particles, physics and iOS. Details from the release notes:

Improvements

  • IL2CPP: Android - improved building performance.
  • iOS : Exposed ReplayKit streaming APIs to user scripts.

Bugs

  • (818174) - Android: Fixed a case of audio stutter when launching Android player from a notification on the lockscreen.
  • (826047) - Animation: Fixed erroneous "Playable was not Disposed" being displayed.
  • (824009) - Asset Bundles: Fixed the assetBundle property of AssetBundleCreateRequest so that it stalls instead of returning null when the bundle is not yet ready
  • (808412) - Collaborate: Fixed a bug where double-click on "Show differences" icon for a local change in Collaborate toolbar cause a crash.
  • (832097) - Editor: Fixed an issue with addition of duplicate references of auxiliary platform-specific editor DLLs to editor C# project.
  • (793204](https://issuetracker.unity3d.com/product/unity/issues/guid/793204/)) - Editor: Fixed the errors when capturing screen or sending images to remote.
  • (807375) - Editor: Fixed the icon quality regression caused by unnecessary scaling step.
  • (814484) - Editor: Improved performance of SetParent in deeply nested UI panels.
  • (832292) - Graphics : Updated shader macros to support lod + sampler variations for texture cubes and arrays.
  • (808298) - Graphics: Fixed a crash in CommandBuffer.DrawRenderer because of a NULL or inactive camera.
  • (825082) - Graphics: Nullify RECT in case GetClientRect fails so we don't have trash in RECT.
  • (840596) - IL2CPP: A call to GetCurrentMethod in a generic method should return the generic method definition, not the inflated generic instance method.
  • (837974) - IL2CPP: Fixed generated C++ code not compiling when calling Math.Abs on an unsigned integer.
  • (838259) - IL2CPP: Return an empty array from GetGenericArguments when it is called on a MethodInfo object from a non-generic method. Previously the runtime incorrectly threw an assert in this case.
  • (820692) - iOS: Fixed a performance regression by resizing the constant pool adaptively on Metal.
  • (820885) - iOS: Fix a race condition when changing resolution on startup on Metal.
  • (820938) - iOS: Fix bug in retrieving of certain values of IScore larger than 32 bits.
  • (808537) - iOS: GameCenterPlatform.ShowLeaderboardUI now shows the specific leaderboard when requested (note, the symptoms are still observable on iOS 8.4 and 9.x due to a bug in the OS itself).
  • (801369) - iOS: ILeaderboard.LoadScores now does callback if SetUsersFilter is called.
  • (815816) - Kernel: Fixed local scale of duplicate game object not matching original local scale of game object if parent has rotation set.
  • (829178) - OSX: Fixed a crash on startup when OpenGL2 is used.
  • (825180) - Particles: Don't allow prewarm on non-looping systems.
  • (833513) - Particles: Fixed a crash when using uninitialised curves.
  • (837680) - Particles: Fixed an issue when rendering during OnPreRender using RenderWithShader.
  • (819881) - Particles: Prevent restarting particle system when parent transform moves in the editor.
  • (833737) - Physics 2D: Ensure that BoxCollider2D.Cast correctly detects a multi-edge EdgeCollider2D.
  • (820300) - Physics 2D: Ensure that BoxCollider2D/PolygonCollider2D with large vertex but small area is created correctly.
  • (830078, 819705) - Shaders: Fixed some cases of unsupported shader variants leading to a crash.
  • (829326, 818524) - Trails: Fixed an occasional TrailRenderer crash when using Clear script API.
  • (826310) - UI: Fixed an issue where the Disabled Trigger animation was triggered on hovering over a Button when this was not Interactable.
  • (834148) - UnityWebRequest: DownloadHandlerAssetBundle will become done once download finishes.
  • (834583) - UnityWebRequest: Fixed a crash when downloaded asset bundle had zero size.
  • (837783) - Windows: Fixed potential lock when in fullscreen exclusive mode and minimising/maximising screen.

As always, the patch can be downloaded here.

GameDev News

Month List

Popular Comments

PlayStation Mobile SDK Tutorial: Handling updates in GameEngine2D
Subscribe to GameFromScratch on YouTube Support GameFromScratch on Patreon


11. May 2012

 

In the last tutorial Working with Sprite Sheets I said that I would cover updating your scene in an upcoming tutorial. This is that tutorial.

 

In this tutorial we are going to cover three different ways that you can update your scene.  As you saw earlier it is possible to update things directly inside your game loop, either directly or using a timer.  However GameEngine2D has a number of superior scheduling options built in, and we will look at 3 different options.  The first is using a Node’s Schedule method, the second is to derive from Node and override Update() and using the Scheduler singleton.  The last is to declare a ActionBase derived object, to create a re-usable updater.  We are going to create 3 bouncing smiling faces, each controlled by a different system.

 

 

We are going to start with the following basic skeleton:

 

using System; using System.Collections.Generic; using Sce.Pss.Core; using Sce.Pss.Core.Environment; using Sce.Pss.Core.Graphics; using Sce.Pss.Core.Input; using Sce.Pss.Core.Imaging; // for Font using Sce.Pss.HighLevel.GameEngine2D; using Sce.Pss.HighLevel.GameEngine2D.Base; namespace Updating { public class AppMain { public static void Main (string[] args) { Director.Initialize(); Scene scene = new Scene(); scene.Camera.SetViewFromViewport(); Director.Instance.RunWithScene(scene); } } }

 

That is about as stripped down a functional program as you can make.  Be sure to add a reference to GameEngine2D.  The Imaging using statement is needed for the Font object that we will use later.  Nothing here should be new to you if you have gone through the earlier tutorials.

 

 

Alright, lets get started using the Schedule method.  First a quick explanation of how Update() works.  Remember in earlier tutorials when you called Director.Instance.Update()?  Well this triggers off a chain reaction of events.  This results in the current scene ( the one specified in the RunWithScene call ) having it’s Update call, which in turn results in all the (registered)Nodes in the Scene having their Update() methods called.  This process happens once per frame. Schedule() marks the node to be called during update, and provides a method to be called when the update occurs.  In this case we are going to declare that method using a Lambda.  Let’s take a look:

 

First off, we declare our sprite:

Texture2D texture = new Texture2D("/Application/smile.png",false); TextureInfo ti = new TextureInfo(texture); SpriteUV sprite = new SpriteUV(ti); sprite.Quad.S = new Vector2(128,128); sprite.Position = scene.Camera.CalcBounds().Center; sprite.Position = new Vector2(sprite.Position.X - 256,sprite.Position.Y); sprite.CenterSprite();

 

Everything here you’ve seen before.  The position is all relative to the middle of the screen.  We will be rendering 3 sprites, this one will be positioned off to the left. Now for the new stuff:

 

bool goingUp = true; sprite.Schedule( (dt) => { if(goingUp) { sprite.Position = new Vector2(sprite.Position.X, sprite.Position.Y + 3); if(sprite.Position.Y >= 390) goingUp = false; } else { sprite.Position = new Vector2(sprite.Position.X, sprite.Position.Y - 3); if(sprite.Position.Y <= 64) goingUp = true; } });

 

Schedule takes a (lambda) function that is called every time Update() is called.  dt is the elapsed time since Update() was last called, although we aren’t using it this time.  Our actual method is pretty straight forward, we have a bool that determines which direction we are going.  We add 3 to our Y direction until we get near the the top of the screen, then flip direction.  Otherwise we are going down, by decrementing by 3 until we get to the bottom.  ( 64 is half of our sprite height ).  The Schedule() method is probably the simplest way to update a Node ( SpriteUV is derived from Node ) object.

 

Next we look at handling updates by deriving from Node ( actually, SpriteUV again ) and overriding the Update() method.  Create a new class, I am calling mine BouncingSmile.cs but you can call it whatever you want.  Enter the following code:

 

 

using System; using Sce.Pss.Core; using Sce.Pss.Core.Graphics; using Sce.Pss.HighLevel.GameEngine2D; using Sce.Pss.HighLevel.GameEngine2D.Base; namespace Updating { public class BouncingSmile : SpriteUV { private bool _goingUp; public BouncingSmile () { Texture2D texture = new Texture2D("/Application/smile.png",true); this.TextureInfo = new TextureInfo(texture); this.Quad.S = new Vector2(128,128); _goingUp = true; } public override void Update (float dt) { if(_goingUp) { this.Position = new Vector2(this.Position.X, this.Position.Y + 3); if(this.Position.Y >= 390) _goingUp = false; } else { this.Position = new Vector2(this.Position.X, this.Position.Y - 3); if(this.Position.Y <= 64) _goingUp = true; } } } }

 

As you can see, the Update() method is basically identical to our lambda method earlier.  Otherwise we are basically just handling the creation of our sprite, just like we did back in the Hello World sample.

 

Now that we have a class with an Update() method defined, lets go back to AppMain.cs and put it to use.

 

BouncingSmile bs = new BouncingSmile(); bs.Position = scene.Camera.CalcBounds().Center; bs.CenterSprite(); Scheduler.Instance.ScheduleUpdateForTarget(bs,1,false);

 

We declare our BouncingSmile object object ( whose constructor took care of creating it’s Sprite ), then position it in the middle of the screen.  Finally we register our object so that it’s Update method is going to be called.  We do this using the Scheduler singleton.  ScheduleUpdateForTarget results in the target ( bs ) having it’s Update() called every frame.  In addition to the target to update, you pass in the priority ( how early in the Scheduler’s update phase it will be called ) and whether or not to start paused.  The end result of this is virtually identical to the earlier Schedule() method.  Our next method is much different however.

 

We are now going to create another class, this one called BounceAction.cs.  Create it, then add the following code:

 

using System; using Sce.Pss.Core; using Sce.Pss.HighLevel.GameEngine2D; using Sce.Pss.HighLevel.GameEngine2D.Base; namespace Updating { public class BounceAction : ActionBase { private bool goingUp; public BounceAction () { goingUp = true; } public override void Update (float dt) { base.Update (dt); if(goingUp) { this.Target.Position = new Vector2(this.Target.Position.X, this.Target.Position.Y + 3); if(this.Target.Position.Y >= 390) goingUp = false; } else { this.Target.Position = new Vector2(this.Target.Position.X, this.Target.Position.Y - 3); if(this.Target.Position.Y <= 64) goingUp = true; } } } }

 

We are creating a new class derived from ActionBase.  Actions are exactly what they sound like, runnable events.  ActionBase is the very base class of action types available.  Unlike our earlier examples, BounceAction isn’t actually tied to any single object, it can be applied to any Node derived object, making it very easy to create reusable/retargetable actions.  Once again, the code looks virtually identical to our prior examples. 

 

Now head back to AppMain.cs and add the following code:

 

Texture2D texture2 = new Texture2D("/Application/smile.png",false); TextureInfo ti2 = new TextureInfo(texture); SpriteUV sprite2 = new SpriteUV(ti); sprite2.Quad.S = new Vector2(128,128); sprite2.Position = scene.Camera.CalcBounds().Center; sprite2.Position = new Vector2(sprite2.Position.X + 256,sprite2.Position.Y); sprite2.CenterSprite(); BounceAction ba = new BounceAction(); ActionManager.Instance.AddAction(ba,sprite2); ba.Run();

 

The majority of that code is just us creating another sprite object.  The key part are the last three lines.  What we are doing here is creating a BounceAction, then registering it with the ActionManager singleton, applying it to our new sprite.  Finally we trigger our action to actually run.  Just like the Scheduler singleton, ActionManager is called once per frame.  The power of using ActionManager is that the action isn’t tied to the thing being acted upon.  There are some powerful things you can do with ActionManager, like queuing up actions up, or blending between actions, etc…

 

 

So there were three different different ways to handle updates with your PS Suite GameEngine2D node objects.  In a moment I will post the completed source for AppMain.cs.  There is however one new concept in the following code, Labels.  In the comments for my earlier Hello World example, I said there were better ways to actually display Hello World on screen, and that way is using the Label class.

 

In order to make a Label, you first need a Font, which in turn needs a FontMap texture. 

 

Font font = new Font(FontAlias.System,16,FontStyle.Bold); FontMap fontMap = new FontMap(font,512);

 

Then it is just a matter of creating your Label:

Label label1 = new Label("Derived from Node",fontMap); label1.Position = new Vector2(0,0);

 

Then add it to the scene to be displayed:

scene.AddChild(label1);

 

And that… is the easiest way to display text on screen.

 

Alright, now lets put everything together.

 

using System; using System.Collections.Generic; using Sce.Pss.Core; using Sce.Pss.Core.Environment; using Sce.Pss.Core.Graphics; using Sce.Pss.Core.Input; using Sce.Pss.Core.Imaging; // for font using Sce.Pss.HighLevel.GameEngine2D; using Sce.Pss.HighLevel.GameEngine2D.Base; namespace Updating { public class AppMain { public static void Main (string[] args) { Director.Initialize(); Font font = new Font(FontAlias.System,16,FontStyle.Bold); FontMap fontMap = new FontMap(font,512); Scene scene = new Scene(); scene.Camera.SetViewFromViewport(); //Center sprite BouncingSmile bs = new BouncingSmile(); bs.Position = scene.Camera.CalcBounds().Center; bs.CenterSprite(); Label label1 = new Label("Derived from Node",fontMap); label1.Position = new Vector2(bs.Position.X - 80, bs.Position.Y + 200); Scheduler.Instance.ScheduleUpdateForTarget(bs,1,false); //Left sprite Texture2D texture = new Texture2D("/Application/smile.png",false); TextureInfo ti = new TextureInfo(texture); SpriteUV sprite = new SpriteUV(ti); sprite.Quad.S = new Vector2(128,128); sprite.Position = scene.Camera.CalcBounds().Center; sprite.Position = new Vector2(sprite.Position.X - 256,sprite.Position.Y); sprite.CenterSprite(); bool goingUp = true; sprite.Schedule( (dt) => { if(goingUp) { sprite.Position = new Vector2(sprite.Position.X, sprite.Position.Y + 3); if(sprite.Position.Y >= 390) goingUp = false; } else { sprite.Position = new Vector2(sprite.Position.X, sprite.Position.Y - 3); if(sprite.Position.Y <= 64) goingUp = true; } }); Label label2 = new Label("Using lambda",fontMap); label2.Position = new Vector2(sprite.Position.X - 60, sprite.Position.Y + 200); //Right sprite Texture2D texture2 = new Texture2D("/Application/smile.png",false); TextureInfo ti2 = new TextureInfo(texture); SpriteUV sprite2 = new SpriteUV(ti); sprite2.Quad.S = new Vector2(128,128); sprite2.Position = scene.Camera.CalcBounds().Center; sprite2.Position = new Vector2(sprite2.Position.X + 256,sprite2.Position.Y); sprite2.CenterSprite(); BounceAction ba = new BounceAction(); ActionManager.Instance.AddAction(ba,sprite2); ba.Run(); Label label3 = new Label("ActionBase",fontMap); label3.Position = new Vector2(sprite2.Position.X - 50, sprite2.Position.Y + 200); scene.AddChild(sprite); scene.AddChild(bs); scene.AddChild (sprite2); scene.AddChild(label1); scene.AddChild(label2); scene.AddChild(label3); Director.Instance.RunWithScene(scene); } } }

 

And here is our finished application:

smilebounce

 

As always, you can download the entire project here. Oh, and this time I actually remember to test it on my Vita! Smile

Programming , , ,

blog comments powered by Disqus

Month List

Popular Comments