tweex[dot]net

The square root of rope is string

Minor Update

It’s exactly 9 years to the day that I announced that this site had been migrated to Webfaction, so it’s rather fitting that today I announce that is has been migrated again, this time to Hosting UK. As you could probably tell from the previous announcement, I had grander plans for my little VPS than ever actually materialised. The end result was that I was basically paying $12/mo (~£9.50/mo at the current exchange rate) to host a static website, which was massive overkill, so I’d already been thinking about moving and the recent GoDaddy purchase spurred me on to actually do it.

[UE4] Localising your game

Back to Localisation Overview. Introduction Localisation is something that people often don’t think about until the end of their project, which is why the UE4 localisation system aims to stay out of your way as much as possible. Basically, you’ll be fine as long as you use FText and its associated functions for your user-facing text (with some caveats about text formatting and shipping with the correct internationalisation support - both of which were covered in the previous post).

[UE4] Localisation and Internationalisation

Back to Localisation Overview. Introduction Localisation and Internationalisation (L10N and I18N) are two concepts that often get lumped together as simply “localisation” (and even I’m guilty of that), but they are in fact two distinct things, and UE4 handles them in different ways. The localisation system is UE4 is all home grown and centered around our ‘text’ type, whereas our internationalisation support makes use of the International Components for Unicode (ICU) library.

[UE4] Localisation Overview

Preface The last time I really updated this blog was when I was between jobs, having just been made redundant due to the closure of Blitz, and still having a few weeks before I started my new job at Pitbull as a contractor working on the Unreal Engine. The job at Pitbull eventually became a job at Epic, when Epic bought Pitbull and recreated the company as Epic Games UK.

Migration to Hugo

tl;dr This blog has been migrated from Wordpress to Hugo (a static site generator). As with the previous migration (from tumblr to Wordpress) the comments have been lost (although there were only 2), and you’ll need to update your RSS feed link to this. I have a few reasons for this; one being that I’m already paying for a webhost (so I might as well make use of it), and another being that a website of purely static content is lightweight and fantastically secure.

[C++] A safer array size macro

Introduction Array size macros in C++ are typically ported from C, and so often end up looking something like this. #define ARRAY_SIZE_UNSAFE(A) (sizeof(A)/sizeof(*(A))) This will work, however it has no type safety, so you can pass it both an array or a pointer to an array. This post shows how templates can be used in C++ to create a safer array size macro (this is the same technique that _countof uses in MSVC).

[C++] An exercise in optimisation #1 - ImmutableString

Introduction This post outlines a problem I had to solve regarding using a string as a key for a hash table, and the steps that were taken to optimise the problem by applying the solution of an immutable string type. I may make this into a series if I can find interesting enough examples that I can suitably simplify the code for. The Problem I was creating a key -> value pair map for use with a C++ serialisation system; the keys had to be strings as they were used as identifiers for JSON, and around 99% of the time the key would be a string literal.

[C++] Bit-flags

Introduction Bit-flags are used in C and C++ to save memory by allowing you to pack multiple boolean variables into a single integer variable. While they are very good at this, the syntax for using them isn’t exactly the easiest to read, so I thought I’d share a trick we use at work to deal with bit-flags. The Code struct Flags8 { union { uint8_t allFlags; struct { bool flag1 : 1; bool flag2 : 1; bool flag3 : 1; bool flag4 : 1; bool flag5 : 1; bool flag6 : 1; bool flag7 : 1; bool flag8 : 1; }; }; }; The code above shows a struct containing a union between an 8-bit unsigned integer, and another struct containing a series of bit-wide booleans (that’s what the : 1 does).

Introduction to premake4

Introduction A while back I wrote a blog post based on my experiences using the CMake build system. The conclusion from this was that I found CMake to be a useful tool, but pretty painful to work with due to it using a custom scripting language and being quite lacking in the documentation and support departments. In short, it was something I tolerated rather than enjoyed using. These issues meant I was open to alternatives, but I never looked for any until I read an AltDevBlogADay post on meta build systems which mentioned premake.

Tune drop

While we wait for my muse to kick in for some non-meta blog posts, here’s some tunes that I’ve found/been shown recently that are really worth sharing. The first one is Portal 2 related (and probably spoilerish); there’s a song in the game called “Exile Vilify” and someone took that, mixed it with some rain, and put it all on a website. The result is quite impressive, as I’ve found myself listening to this for hours while working and not even realised it’s looped.