Friday, September 23, 2016

A bit of Unreal Engine and the Benefits of Source Code

Several years ago, I looked into Unreal Development Kit for use in my game programming courses. At the time, you had to know C++ to get the most of it, and my students generally didn't know C++, so I invested hardly any time in pursuing UDK. I had heard in Spring 2015 how Epic made Unreal Engine 4 completely free for developers, including making the source available. It wasn't until about two weeks ago that I was inspired to take a look at UE4. Turns out, it is extremely easy to access the source and build it on Linux, and so I've been tinkering with a project for two weeks or so. I have been keeping notes about my attempts to learn UE4, and I may blog about that more later.

This story is about how I got some core gameplay working and decided it was time to slap a HUD on the game. I checked a few pages of documentation and proceeded to create my first HUD blueprint. Upon trying to open it, the editor crashed. That's pretty uncommon, so I restarted it and tried again, and it crashed again. That's really uncommon, so I restarted again,  but I asked Google about it while UE4 was starting up. Turns out it's a known bug in the latest release. However, someone posted a workaround, which is to revert a specific commit from the repository.

I've never actually done that before, but a little bit of searching revealed that it was pretty easy. I didn't actually clone the whole UE4 project history, only the latest release, but I was able to get the patch for the commit by appending ".patch" to the github URL. (That is, it's https://github.com/EpicGames/UnrealEngine/commit/8fba9bbdc3cc4105d7c3de24adc94f7304c7d90b.patch, although you need to sign in and agree to Epic's terms to get source access; note that you can do this with any commit URL on github, which I did not know before.) I saved that to a file and reversed the commit via:
git apply -R

Couldn't be easier! Rebuilding the project via 'make' took just a minute or so, much less than the full build. Now, I can edit HUD widgets! I am still not good at it, but hey, we have to take this one step at a time.

No comments:

Post a Comment