Kirsle.net logo Kirsle.net

Welcome to Kirsle.net!

This is the personal homepage of Noah Petherbridge, and it's where I keep my web blog and various creative projects.

I blog about anything I find interesting, and since I have a lot of varied interests, my blog entries are kind of all over the place. You can browse my tags to sort them by topic and see which ones I frequently write about, or the archive has a complete history of my posts, dating back to 2008!

Besides my blog, I have pages for my creative projects, which are linked to on the navigation bar.

I write a lot about Linux and Android, Minecraft, and I like to rant about stuff. Generally anything that makes me curious. Also check out my Bookmarks for all sorts of cool websites about various topics I'm interested in.

For the geeks: this website respects your privacy and doesn't run any third party ads or analytics. This site speaks HTTP and doesn't require any JavaScript to work.

Go UI Toolkit and Other Libraries
May 1, 2020 by Noah

As I've been working on my videogame (codenamed Project: Doodle), I created a few Go libraries that I'm releasing as open source software that can be used to create other, unrelated applications (other games, other kinds of graphical programs, etc.)

These libraries are still in "early development" (meaning I may change their API around a bit as I refactor and add new features) but they are generally stable and I'm good about documenting changes in the code, if you wanna play around with these and aren't afraid of occasional breakages.

This is just a quick blog post letting people know about these libraries. I'll probably post again when these libraries reach a stable "1.0" state, where their API won't change and they'll have a degree of stability guaranteed to them.

I'm generally using GitHub as a mirror for these libraries and will accept issues and pull requests filed on GitHub (I wouldn't expect or want anybody to sign up an account on my local Gitea instance).

render: A Rendering Engine (SDL2, HTML Canvas)

render example screenshot

I decided early on for my game that I would be using libSDL for my game's graphics, audio, controller inputs and so on -- at least to start out with. I didn't want my game to rely on SDL though: I needed the flexibility to swap it out for OpenGL or Vulkan or Metal or any other back-end driver as needed to expand my game to future platforms.

So I created go/render as a "rendering engine library" for 2D graphics in Go. It presents an API interface for drawing pixels to the screen which can be implemented by various back-end "drivers" that do the real work.

Currently it supports SDL2 for desktop applications (Linux, macOS and Windows) as well as a WebAssembly driver that uses the HTML Canvas API. (I have a build of my game to WebAssembly, but WASM performance is not great yet.) Examples are included in the git repo for both desktop and WASM applications.

ui: A User Interface Toolkit (SDL2, HTML Canvas)

ui toolkit screenshot

My game also required a UI toolkit for easily adding buttons, panels, windows and basic user interface controls to the game.

There were a handful of options I could've gone with: desktop UI toolkits like Gtk+ or Qt could've wrapped around my SDL surface and provided menu bars and button toolbars, but I wanted to minimize my inclusion of C or C++ libraries with my Go application. I was fortunate that go-sdl2 provided clear documentation how to cross-compile my program for Windows, and I didn't wanna push my luck bringing in yet more C libraries that might've made my game harder to ship. This also ruled out some potential SDL2-based C libraries for UI controls as well.

So I created my own UI toolkit in Go, and it uses my go/render library as its graphics back-end: meaning my UI toolkit can work for SDL2 desktop applications and as WebAssembly applets.

The library's API is inspired by the Tk GUI toolkit which I had prior experience with in Perl and Python (see my Tk blog posts).

It currently supports widgets such as Labels, Buttons, Checkboxes, Tooltips and (virtual) Windows (with title bars that can be dragged around and closed). The Frame widget allows easy arrangement of child widgets using Tk-style Pack and Place controls.

Future planned widgets include: menus and menu bars, tabbed frames, text input boxes, scrollbars and sliders (in roughly that order).

audio: A Simple Audio Engine

The newest library implements a simple audio engine for playing music and sound effects. My game needed these, and doesn't have any fancy requirements yet, so this library provides the basics for loading music (.mp3 and .ogg) and sounds (.wav) and playing, pausing and stopping them.

Currently it only supports the SDL2 (Mixer) driver. This module is independent from go/render and you can mix and match (or not) that library.

Future planned features include: adding WebAssembly support (Web Audio API), maybe branch out to other back-end drivers as needed.

Tags: 0 comments | Permalink
Project: Doodle v0.1.0
April 13, 2020 by Noah

Here is another alpha release of the game I've been working on, codenamed Project: Doodle.

Doodle v0.1.0 Screenshot

About Project: Doodle

Doodle is a "drawing-based maze game" where you can draw your own levels freehand and then play them as a 2D platformer game. You can drag premade "doodads" such as buttons, doors and keys into your level to add some interaction to it.

The game is being designed to be very friendly for custom content: you can create your own doodads and program their behavior in JavaScript, and eventually, when you share your levels with others you can bundle the custom doodads, wallpapers and other assets with the level file to enable others to easily play your custom map without needing to go hunt down all the custom assets you used.

The game comes with the "doodad.exe" command-line program which helps in creating custom doodads; it's the tool I used to create the default ones that come with the game.

Downloads

The game is free to download in its alpha versioned form.

Note: the program isn't signed yet for Windows and Mac so you may need to click through some warning dialogs. This is an early alpha release and I'll get the signatures sorted out eventually in future releases.

Mac users: let me know if the performance is okay. I only tested running it in the QEMU virtual machine I built it in, and it got < 30 frames per second there (hit F3 key in-game to see the FPS). Linux binaries and Windows (in Wine) ran at full 60 FPS for me.

Changes

New doodads:

  • Start Flag: drag this into your level to set where the player character will spawn. There should only be one per level.
  • Crumbly Floor: a rocky floor that breaks and falls away after a couple seconds when the player (or other mobile doodad) walks onto it.
  • State Blocks: blue and orange blocks that toggle between solid and passable when the corresponding ON/OFF button is touched.

New features:

  • An inventory overlay now appears in Play Mode when the player character picks up one of the colored keys.
  • While editing a level, you can click the new "Options" button in the top menu to open the level settings window (like the one you see when creating a new level): to change the wallpaper image or the page type.

Other changes:

  • Added better platforming physics to the player character: acceleration and friction when walking.
  • The colored Locked Door doodads have been re-designed to be shown in a side-view perspective and have an open and closed state in either direction.
  • Tooltips added to various buttons in the Editor to show names of doodads and functions of various buttons.

Cheat Codes

In case you happen to clip out of bounds in the game and fall to the bottom of the map, press the Enter key to open the in-game developer console and type in cheats like these:

  • import antigravity turns off gravity for the player character; arrow keys freely move you in any direction.
  • ghost mode turns off collision detection for the player, allowing you to pass through walls, floors and solid doodads.

The README.md contains more.

Tags: 0 comments | Permalink
Evolution of Web Development
March 13, 2020 by Noah

In this blog post, I'll recount my experience in web development over the last 20 years and how the technology has evolved over time. From my early days of just writing plain old HTML pages, then adding JavaScript to those pages, before moving on to server-side scripts with Perl (CGI, FastCGI and mod_perl), and finally to modern back-end languages like Python, Go and Node.js.

Note that this primarily focused on the back-end side of things, and won't cover all the craziness that has evolved in the front-end space (leading up to React.js, Vue, Webpack, and so on). Plenty has been said elsewhere on the Internet about the evolution of front-end development.

I first started writing websites when I was twelve years old back around the year 1999. HTML 4.0 was a brand new specification and the common back-end languages at the time were Perl, PHP, Coldfusion and Apache Server Side Includes.

Read more...

Tags: 6 comments | Permalink
Progress Report: Degoogling
January 16, 2020 (updated January 16, 2020) by Noah

A couple of years ago I started the progress of slowly de-googling my life: lessening my reliance on Google services, moving my data to my own servers and limiting what data Google can collect about me going forward as well as deleting the data they already have.

In this blog post I'll talk about the Google services I used to use and the solutions I found for replacing them. The full list of Google services I used to use and have found alternatives for include:

  • Gmail: hosting my @kirsle.net email addresses elsewhere.
  • Contacts & Calendar: Nextcloud provides my cross-device sync for these.
  • Drive: Nextcloud holds my files in the "cloud" (my home PC available on the go).
  • Photos: I moved all mine to my Nextcloud.
  • Search: DuckDuckGo.

Also check out some of my personal notes I've been taking as I went:

Read more...

Tags: 2 comments | Permalink
A drawing-based maze game
July 9, 2019 (updated July 18, 2019) by Noah

I've been working on a videogame the past couple of years, off and on. It's called...

...for now. I have a better name picked out for it, but I'm going to be callling it Project: Doodle (while it's in alpha) so that the finished version will be distinct from the alpha versions, of which it may end up looking nothing like!

The theme of Doodle is centered around hand-drawn, side-scrolling platformer type mazes. You can draw your own levels using freehand and basic drawing tools, color in some fire or water, and drag in pre-made "Doodads" like buttons, keys and doors to add some interaction to your level.

Read more for a screenshot, more information and alpha version download links (Linux, Windows and Mac OS).

Read more...

Tags: 0 comments | Permalink
Ask Me Anything
December 24, 2018 by Noah

I added a new feature to my Go blog app that sort of automates a Tumblr-style "Ask Me" feature, which I found useful for other blogs I run on this codebase.

So Kirsle.net has gained an ask me anything page. It's like a Contact Me form except your question will become a blog post with my answer attached and you might receive a notification e-mail if you want.

Tags: 1 comment | Permalink
Password Hashing for Noobs
October 11, 2018 by Noah

I was discussing passwords with someone recently and thought of a neat little hands-on exercise that shows not only how password hashing works, but shows you a real-world example of cracking a weakly hashed password just using Google.

The hands-on exercise should be easily approachable for beginners. I'll also go over a general history of passwords on the Internet -- I've been working as a web developer long enough to watch the whole transition from MD5 to bcrypt play out.

Requirements

Any Unix-like environment with the md5sum command. Most Linux distros have it by default as part of the coreutils package. The Windows Subsystem for Linux might work.

Mac OS might have these built-in too. Not sure.

Or just find a program that can generate MD5 hashes for you, preferably as a downloadable program you run on your computer, or one that runs from a web page but in JavaScript and without the server being involved.

Read more...

Tags: 2 comments | Permalink
Time Zones
August 3, 2018 by Noah

Probably one of the most frustrating things to deal with as a software developer is time. Specifically time zones and daylight savings time and all that nonsense. Tom Scott has a video about it but I have a recent story of my own.

This week at work, we lost about two days of effort trying to make our web application timezone-aware. Apparently, time zones are so ridiculously complicated, that it's basically impossible to store a time with an arbitrary time zone in your database while remembering what the time zone is.

Don't believe me?

The web stack in this story involves JavaScript, Python and PostgreSQL, with PostgresSQL's problems being applicable to any backend stack.

Read more...

Tags: 0 comments | Permalink
Vanilla RiveScript
July 16, 2018 by Noah

I got this e-mail today about RiveScript and thought my response would be good for a general audience as well.

Orion asked:

Hello Noah i want to know...

  1. What is Vanilla Rivescript?
  2. What can Vanilla Rivescript do?
  3. How can i install or use Vanilla Rivescript?

Read more...

Tags: 0 comments | Permalink
Globally Recover Panics in Go
June 22, 2018 by Noah

In the past, I had been tasked to update some Python web apps to have them send e-mails out whenever they run into an uncaught Exception in one of our endpoints. This way we could identify any runtime errors in production and fix them.

In Python it was pretty easy: our web framework, Flask, provides a way to catch any error that happens in any of your HTTP routes. Even if you didn't use Flask, you can set sys.excepthook to a function and catch exceptions globally whenever other code failed to.

But then we had an app written in Go and it needed to have this feature, too. If it were simply a web service, this wouldn't have been bad, but this particular service listened on both an HTTP port and a separate TCP port in another goroutine.

Catching HTTP panics in middleware (or the standard net/http library, which catches panics itself) doesn't do anything to help catch the panics thrown by the TCP server. So, like sys.excepthook, I needed to find a way to globally catch panics in my app.

This was surprisingly very hard to do.

Read more...

Tags: 1 comment | Permalink