Skip to main content

rubenwardy's blog

Posts

The cover of "Devkit CLI: Upload your game to Steam Deck from your dev computer"

Devkit CLI: Upload your game to Steam Deck from your dev computer

Steam Deck is a new portable gaming console from Valve. The Deck is a very open platform as it’s a full Linux PC, making it very easy to use third-party games and stores. All Decks can act as a devkit machine, and come with devkit tools preinstalled. There was a Steam Deck Devkit edition, but that was a preproduction version of the hardware to allow game developers to test their games.

This article will show you how to upload and run your games on the Steam Deck from your development computer, using a VSCode task or a script you can use in any editor. Whilst you could develop on the Deck directly, it would require setting up a new dev environment. Being able to develop on your computer and test on the Deck allows you to reuse your current dev environment.

Read more of "Devkit CLI: Upload your game to Steam Deck from your dev computer"

The cover of "Steam Deck is Awesome"

Steam Deck is Awesome

My Steam Deck arrived two months ago, and I’ve been having a blast ever since. I’m not much of a gamer; RimWorld and Skyrim are the only two games I’ve spent more than 100 hours in. I find it hard to play a game without wanting to do game dev instead. But with the Deck, I’ve been playing the games that have been on my play list for a while.

This article contains my thoughts about the Steam Deck. It’s not meant to be a review applicable to everyone; I’m not your average user nor do I claim to be. I recommend reading a wide range of reviews before buying something expensive.

Read more of "Steam Deck is Awesome"

The cover of "Creating worker NPCs using behavior trees"

Creating worker NPCs using behavior trees

I’m a huge fan of RimWorld, a base building game where you manage a group of colonists. Rather than directly controlling the colonists, you place blueprints for buildings, mark trees for cutting, and animals for hunting. NPCs will then decide what to do automatically, based on their skills and priorities.

I’ve made two games recently with similar mechanics. The first was Ruben’s Virtual World Project (RVWP), a hybrid basebuilder/topdown shooter. The second was Tin Mining, a mining sim created as an entry to Ludum Dare 48. Both of these games allowed placing building plans that NPC workers would then build out.

In this article, I will explain how I implemented the NPC AIs, and the problems I faced.

Read more of "Creating worker NPCs using behavior trees"

The cover of "ChatGPT: An AI that can write Minetest mods... kinda"

ChatGPT: An AI that can write Minetest mods... kinda

OpenAI’s GPT-3 is a powerful new Artificial Intelligence model that uses deep learning to produce human-like text. It was trained on a large body of text, with sources including websites, Wikipedia, and books. It doesn’t just understand natural language, it can also work with programming languages.

This topic is especially relevant with the recent introduction of GitHub Copilot. Copilot is an “AI pair programmer” for your IDE that suggests code and entire new functions. It’s based on same technology as GPT-3, but with a model derived from GPT-3 and optimised for code called Codex. This article will use GPT-3 and Codex, as I wasn’t able to get GitHub Copilot, but the results will be identical.

In this article, I will ask GPT-3 to write Minetest code and explore how much it knows about modding, creating simple and advanced Minetest mods. I will finish by using it to convert Minecraft mods to Minetest.

Read more of "ChatGPT: An AI that can write Minetest mods... kinda"

The cover of "Developing ContentDB"

Developing ContentDB

In 2018, I had the opportunity to create a web app for University coursework, as a solo project. I chose to create a package repository for Minetest, an open-source project I help maintain.

Minetest is an open-source game engine with millions of downloads and thousands of weekly players. The project has a very active modding community, and many available games to run. There was one big issue - you had to manually install mods and games by unzipping their files into a directory. This was a very poor user experience.

Read more of "Developing ContentDB"

The cover of "Tin Mining - Ludum Dare 48 post-mortem"

Tin Mining - Ludum Dare 48 post-mortem

In April 2021, I participated in my first game jam, Ludum Dare 48. Ludum Dare is a popular online game jam; this event received over 3800 submissions. The theme was “Deeper and Deeper,” and I created a game where you manage a tin mine.

The year is 1790, and the Cornish tin industry is booming. You are a businessperson who has just secured investment to build a mine. The area is known to be rich in tin, which is in high demand.

Rather than controlling your workers directly, you drag out plans for tiles to be mined and built. The workers will mine tunnels and build where ordered. They will carry mined resources to the surface to be sold.

Read more of "Tin Mining - Ludum Dare 48 post-mortem"

The cover of "Securing Markdown user content with Mozilla Bleach"

Securing Markdown user content with Mozilla Bleach

Markdown is a common choice for rich text formatting due to its readability and ease-of-use. Unlike a lot of markup, it aims to match natural text. It’s even easy for beginner users, and there are WYSIWYG editors available.

We will be using the Python Markdown library to convert Markdown to HTML. Markdown doesn’t have a well-defined standard. The library aims to comply with what little is defined by the Markdown syntax specification, meaning that it is also often stricter than other parsers.

Read more of "Securing Markdown user content with Mozilla Bleach"

The cover of "ForumMate: My return to Android app development"

ForumMate: My return to Android app development

I worked as an Android developer just over two years ago, creating native apps for clients using Java and Kotlin. During that time, Kotlin was gaining prominence and had just been made official by Google. Google also introduced Architecture Components that year, later renamed to JetPack. Since then, the Android ecosystem has changed significantly, with Kotlin and JetPack gaining significant maturity and development. Out with Realm, Activities, and Model-View-Presenter (MVP), in with Room, fragment-based architecture, and MVVM. Data-binding and MVVM are pretty awesome and breathe a whole new life into Android app development.

Read more of "ForumMate: My return to Android app development"

The cover of "Extending sol3's implicit type conversion"

Extending sol3's implicit type conversion

Many APIs in my game push Vector3s to and from Lua. It’s such a common operation, that most of my functions used to look like this:

sol::table add(sol::table tPos) {
    Vector3f pos = TableToPos(tPos);

    // do something
    return PosToTable(pos);
}

One of the benefits of sol is that it is able to bind Lua arguments to C++ function arguments, converting types implicitly. Having to convert from a table to a vector ourselves is quite annoying. It would be much nicer to have sol do it for us. Luckily, sol allows you to customise how types are retrieved and pushed to Lua using Customisation Points.

When trying to convert a type from Lua to C++, sol will call certain templated functions. We will be customisating sol’s behaviour using a technique called template specialization, which allows us to specialise a specific instance of the templated functions and structs. By the end of this article, we’ll be able to use Vector3 directly when using sol, allowing the above code to be turned into this:

Vector3f add(Vector3f pos) {
    // do something

    return pos;
}

Read more of "Extending sol3's implicit type conversion"

Android: Complete, generic data-binding RecyclerView adapter

Data binding greatly reduces the amount of code you need to connect user-interfaces with ViewModels. It keeps Activity and Fragment code small, and makes it easier to manage lifecycles.

<EditText
    android:id="@+id/username"
    android:layout_height="wrap_content"
    android:layout_width="match_parent"
    android:text="@={viewModel.username}"/>

I discovered that there was no attribute to bind the elements in a RecyclerView, due to the fact that a RecyclerView needs an adapter to be able to create element views. It would also be nice to automatically use data binding to create the viewholders. There are a number of guides to do both of these halves, but I now present the code to do the whole.

Read more of "Android: Complete, generic data-binding RecyclerView adapter"

The cover of "A Comparison of SFML GUI Libraries: TGUI vs SFGUI vs ImGui"

A Comparison of SFML GUI Libraries: TGUI vs SFGUI vs ImGui

SFML is an excellent library that can be used to create 2D games and similar applications in C++. It’s an abstraction over OpenGL and various system APIs, presenting a consistent and easy-to-use interface.

Providing a Graphical User Interface (GUI / UI) API is out of scope for SFML. GUIs are complicated, and there’s no single good way to implement them. The S in SFML stands for Simple but GUI code rarely is.

There are many different options to choose from when making GUIs. This article is an in-depth comparison of the options for making GUIs in SFML, discussing their pros and cons.

Read more of "A Comparison of SFML GUI Libraries: TGUI vs SFGUI vs ImGui"

Getting rid of YouTube Music's "Are you still listening?" dialog

YouTube Music is a great way to listen for music for free, and with no adverts if you use an adblocker. There is one annoying problem however: after listening for a while, Youtube will keep pausing the music to show a dialog which says “Are you still listening?”. This article will show how to automatically confirm the dialog.

Read more of "Getting rid of YouTube Music's "Are you still listening?" dialog"

C++: Self-registering functions using macros for test libraries

Google’s C++ testing library has a nice syntax for registering tests, without needing to remember to add the tests to some central index. This article will show how to use macros to allow the creation of tests using only the following code:

Test(IntegerComparisonTest) {
    int a = 3;
    assert(a == 3);
}

Read more of "C++: Self-registering functions using macros for test libraries"