biq
Today’s impossible, will be tomorrow’s reality. https://think-biq.com
Image for post
Image for post
Safety first, everyone.

Intro

While intergrating native platform C APIs (e.g. on windows) into a third-party C++ application, I found myself having to make sure that query functions, that allocate and fill results of different data types, are called with the right paramters. And the inquired data is also properly disposed of after the call. This, and the fact that saftey is on the forefront of the collective unconcious, served as the inspiration for this post and the publishing of a small demo, highlighting the architecture proposed in this article. Hope you enjoy reading.

Setup

The goal was, to make the abstraction able to select the appropriate data for the query call on the basis of a type indicated by an enum value. The desired usage of the abstraction should look like the…


Image for post
Image for post
Just imagine she is searching for the right strings.

Intro

There are things, that come up time and time again. One of those things is creating a string version of Enum values in Unreal Engine. For this and other cases, we started to condense some of our utility and helper functions into a module. This module can then be used as part of a plugin, or as a standalone game module. In this article, I want to highlight our approach for to stringify enum values.

Setup

Imagine we want to log the value of an enum type called EWlanNotificationMSM. The API would look like this.

Now press button ‘Make implementation plz!’

Let’s make this happen. …


Image for post
Image for post
Makes sense to show something Apple related here, right.

Intro

Going directly to source is sometimes the right move. On macOS that would be the core libraries using Objective-C. In this example, we use CoreWLAN to ask for information on the current wlan interface connection. You can find the complete source on github.

Setup

We have a makefile at project root level, organise our sourcefiles in a directory called src and will produce binaries in a directory called bin.

Let’s start by creating a makefile, which lets us manage building the project.

WlanInfo.make

In the make target build, the first step is to create a dynamic library called libwlaninfo via the CXX compiler, which we have specified as clang. The -stdlib=libc++ flag ensures that the compiler links against libc++ (heavily favoured by Apple) and -std=c++11 tells the compiler to use the c++11 standard. Next we declare this operation to produce a dynamic library by specifying -shared. To get access to Apple’s core library, we have to link the appropriate libraries, which in our case is Foundation and CoreWLAN. The -fpic ensures that the library has relative address management. Finally we specify the Objective-C++ source file (indicated by the .mm extension) and tell the compile to put the output file in the bin directory. The next step is to compile our program entry (via the main function) contained in Main.cpp, …


Image for post
Image for post
The title picture, selected to impress you with random code.

Intro

Structuring the data in your solutions is a vital part of success. Epic Games has made a quite convenient to integrate custom structs into Unreal Engine’s infrastructure. In this article, we take a look at how we can achieve integration of a custom struct into the Engine’s hashing system. This can be useful for comparisons and more excitingly, using your struct as a key value in a TMap instance.

Setup

First let’s define our minimal data structure. We have three include statements, of which the third is of particular noteworthiness. The file HashMeIfYouCan.generated.h is an auto generated header, containing meta information gathered by the Unreal Header Tool. It is convetion, to set up your Engine Objects, with a consistent name for the file and type. In this case our type is called FHashMeIfYouCan. The F prefix is Unreal Engine’s (mandatory) naming convention for any engine struct. Notice also that we annotate the struct definition with Unreal Engine’s reflection and type system macros. We provide a BlueprintType struct specifier to ask for blueprint exposure. At the top of the structure body definition sits a bit of boiler plate code generation through the GENERATE_BODY macro, which generates all functionality needed to make your struct usable by the engine. …


Intro

This is the second installment of the UE4 custom shader development series, where we have a look at how to use custom shader code in your materials, as well as build and reference a resuable codebase. In the first part we discussed setting up the environment to house our shaders in a plugin.

Preface

Custom shader code will be embedded in larger framework, autogenerated by Unreal Engine’s shader compiler. The way this is presented to the user of the engine’s material editor, is the Custom Expression node. …


Image for post
Image for post

Intro

As part of an ongoing series about developing custom shaders for plugins in Unreal Engine, we start off by looking at how we setup the environment.

Preface

Unreal Engine’s Material and Shader System is very powerful and fun to work with. If you find yourself in need of some advanced features, or having to extend the default shaders work, you have to dig into the way UE loads and processes it’s custom shader source abstraction. UE shaders come in two varieties, .ush and .usf files. These stand for unreal shader header and unreal shader file respectivly. They are really no different from each other, except that ush files are supposed to contained shared definitions to be included, and usf files actual shading work. The core engine comes with a lot of predefined shader source. …


Image for post
Image for post

Unreal Engine 4.21 ships with version 2018.1.1 of Autodesk’s FBXSDK. It’s used when importing or exporting FBX 3D data into your project using Unreal Editor. Sometimes it may be necessary to load or save 3D meshes at runtime. It’s mostly pretty straight forward to integrate third-party software into your packaged builds, but linking with the shipping FBX tends to be a bit more involved.

The shipped version of the SDK coming along with UE4 is located under $UE_PATH/Engine/Source/ThirdParty/FBX in form of an engine module. Adding the dependency is usually done in the build script, e.g. in YourModule.Build.cs

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store