How to Create a Circle Crosshair in Unreal Engine

This tutorial shows you how to create a circular crosshair using a widget blueprint with a material. As always, there are many methods available but this one has some key advantages:

  • Material parameters let you modify the crosshair in realtime. In this tutorial we will use a material parameter to optionally fill the circle.
  • No texture manipulation needed with external software.
  • The colour of the crosshair can be easily changed, both in the editor and during runtime.

This is what the final crosshair will look like. I’ve wired up the “F” key to fill the crosshair for demonstration purposes, but my game will ultimately fill the inside when the player is aiming at an interactable object.

Read More →

Ethics in Software Engineering

I’d like to start by first talking about software engineering itself, and whether it can legitimately be called engineering. The Oxford English Dictionary defines “engineering” as:

The branch of science and technology concerned with the development and modification of engines (in various senses), machines, structures, or other complicated systems and processes using specialized knowledge or skills, typically for public or commercial use; the profession of an engineer. Freq. with distinguishing word.

By this definition I believe it’s fair to describe the design and creation of software as “software engineering” and I’m going to proceed with the rest of this post on that basis.

Read More →

JavaScript snippet: Remove base URL from link

I needed this function this morning so I thought I’d share it in case someone else does too.

function RemoveBaseUrl(url) {
    /*
     * Replace base URL in given string, if it exists, and return the result.
     *
     * e.g. "http://localhost:8000/api/v1/blah/" becomes "/api/v1/blah/"
     *      "/api/v1/blah/" stays "/api/v1/blah/"
     */
    var baseUrlPattern = /^https?:\/\/[a-z\:0-9.]+/;
    var result = "";
    
    var match = baseUrlPattern.exec(url);
    if (match != null) {
        result = match[0];
    }
    
    if (result.length > 0) {
        url = url.replace(result, "");
    }
    
    return url;
}