WaveEngine 2.3.1 to 2.4

This article is a brief guide to solving the majority of problems that you will find when you upgrade your game project from WaveEngine 2.3.1 version to 2.4.

Although WaveEngine has an upgrade tool that runs when you open an old game project with the current WaveEditor 2.4, you can find some issues listed below.

An important point to bear in mind is that Model, ModelRenderer and MaterialsMap components are deprecated, so you should begin to use FileMesh, MeshRenderer and MaterialComponent respectively. For more details, you can read the following article.

TaskSchedule

WaveEngine 2.3.1

  
WaveServices.TaskScheduler.CreateTask(preloadAction);

WaveEngine 2.4

  
WaveBackgroundTask.Run(preloadAction);

WaveEngine 2.3.1

  
WaveServices.Dispatcher.RunOnWaveThread(() =>

WaveEngine 2.4

  
WaveForegroundTask.Run(() =>

Network extension

WaveEngine 2.3.1

  
networkService.HostMessageReceived

WaveEngine 2.4

  
networkService.MessageReceivedFromClient

WaveEngine 2.3.1

  
networkService.ClientMessageReceived

WaveEngine 2.4

  
networkService.MessageReceivedFromHost

Find Entities

WaveEngine 2.3.1

  
entity.FindAllChildrenByTag("Enemies");

WaveEngine 2.4

  
entity.FindChildrenByTag("Enemies", true);

 

Using Wave Services from Visual Editor.

In WaveEngine the use of Services can be very useful when developing your applications / games. And, as you can create and register your own services you can add cross-scene and global elements that provide useful logic, like score managers,  entry points to native libraries, and much more. However, until now, Visual Editor didn’t allow you to register your own services, so you had to do that from code. That could cause problems: Creating components that use custom services could be tricky to debug in our Visual Editor, or depending on your code, it may directly provoke malfunctions in your scene.

Luckily, WaveEngine 2.40 has introduced the possibility of registering and setting up your custom services, as well as some Wave Extension services.

Continue reading Using Wave Services from Visual Editor.

Build a Simple OpenVR application

OpenVR is an API and runtime that allows access to VR hardware from multiple vendors without requiring applications to have specific knowledge of the hardware they are targeting. This repository is an SDK that contains the API and samples. The runtime is under SteamVR in Tools on Steam.

This article describes the necessary steps you should follow to build, load, and run a simple WaveEngine application on the OpenVR platform.

Continue reading Build a Simple OpenVR application

New async/await features

We have improved the async/await support in WaveEngine 2.4.0 by replacing our Dispatcher and TaskScheduler services with a custom implementation of .Net TaskScheduler and creating some useful helpers.

Porting project

The biggest change is the substitution of Dispatcher and TaskScheduler services. The new way to execute code in the foreground or background threads is by using the new helper methods from WaveForegroundTask and WaveBackgroundTask static classes.

To port current projects using the new classes, we need to change the following:

  • If you are using WaveServices.Dispatcher, you must replace it to use WaveForegroundTask.

  • If you are using WaveServices.TaskScheduler, you must replace it to use WaveBackgroundTask.

Both new ways to execute code return a .Net Task, which integrates easily with async .Net code.

Foreground and Background threads

Before we start to review the new included features, it is good to know these details:

  • When a task is executed in the Foreground thread, like with the Dispatcher service, it is executed in the next update cycle.
  • With the Background thread, the tasks are executed sequentially in a specific thread that can access the graphic resources. This allows us, for example, to load textures. The old TaskScheduler executes the code in a .Net thread and without taking concurrency issues into account when accessing the graphic context. In comparison, this new service ensures that each task is executed in the same thread and sequentially.

ConfigureWaveAwait

One useful helper introduced in the new WaveEngine version is the ConfigureWaveAwait extension method.
It allows us to configure how the await continuation is handled. Just as the .Net ConfigureAwait extension method allows us to configure if we want that the continuation of the await is executed on the captured context, the method ConfigureWaveAwait allows us to configure where the await continuation is executed: in the Foreground or the Background thread.

A simple way to test this new method is to load an image from a URL into a sprite:

The WaveTaskContinueOn enum also includes other options. The Default option acts as if the ConfigureWaveAwait has not been used, and the ThreadPool option acts as if the ConfigureAwait(false) from .Net has been used.

Async/await and GameActions

With the inclusion of GameActions, WaveEngine has acquired an excellent way to define a flow of actions that is integrated perfectly with the common scenarios in a game (like animations, play sounds, wait for a condition, etc.).

In this release, we have included the AsTask extension method that simplifies the way that .Net Tasks and GameAction interact with each other.

A simple sample using all of these new features:

I hope you find it useful when you want to use async code in your game. It is the first step and we will work to include new async APIs and features in next releases.

NinePatch native support

WaveEngine 2.4.0 includes official native support for NinePatch textures (also known as 9-slice). To know more about what that kind of textures is, read our previous post about it.

As this version allows you to add textures and mark them as “NinePatchType: FromTexture”. This option will be automatically selected if your texture has the extension “*.9.png”.

When this mode is selected, the exporter will extract the stretch and content regions from the texture and remove them from the final asset. Keep it in mind if you need power of two textures (e.g., if your final texture must be 256×256, the source image size must be 258×258)

Continue reading NinePatch native support

New OpenGL adapter on Windows

In WaveEngine 2.3.1 we have added a new adapter on Windows for OpenGL, this allows WaveEngine developers to run their games using DirectX and OpenGL on Windows. This will be really handy to adapt their assets (like shaders or textures) faster to our OpenGL platforms (Linux, MacOS, iOS and Android).

Continue reading New OpenGL adapter on Windows

New serializer using Protobuf-NET

In Wave Engine 2.3.1 we have started to use Protobuf-NET as the default serializer in all game description files (scenes, prefabs, materials, etc…).

Protobuf-NET is a contract based serializer for .NET code, that happens to write data in the “protocol buffers” serialization format engineered by Google.

The inclusion of Protobuf-NET gives us the following advantages:

  • Performance Boost: Reduce app startup time and other serialization related actions up to 5X  (scene navigations, prefab instantiations …)
  • Reduce app package size
  • Binary files: Avoid to deploy plain xml files in app packages
  • Support DataContract attributes: You don’t need to change your components code

Continue reading New serializer using Protobuf-NET

What’s new in Wave Engine 2.3.1

Wave Engine 2.3.1 has been released today.  This version adds some important features that we think our community will enjoy, like binary scene serialization and OpenGL support in Windows. Let’s have a look in detail.

Bokeh lens sample

Continue reading What’s new in Wave Engine 2.3.1

Appear and disappear effect in WaveEngine

In this article, I’m going to show how to create a cool effect to make the NPCs in your game appear or disappear. One of the issues that you need to resolve when you kill an enemy in your game is how to hide it from your scene. Unless, of course, you want to pile up enemy bodies.

We are going to create a custom shader in WaveEngine for our aim. If you do not already know it, we recommend reading this article before you start.

Follow the steps to create the project effect.

Continue reading Appear and disappear effect in WaveEngine