Tutorials

Here are different things I’ve researched and played with:

ChatGPT Story Time

My wife and I have found a fun use for ChatGPT - story telling!

This article outlines my prompting strategy, and contains the stories that GPT-4 has generated that we’ve really enjoyed.

ChatGPT Story Time

Batman (NES) Pixel Art Study

I’m trying to improve my pixel art skill, so I thought it would be fun to look closely at one of the best looking games on the NES – Batman!

Hopefully I can learn a few things from these great artists.

Grab a snack and enjoy some art with me 😀.

Batman (NES) Pixel Art Study

FABRIK Algorithm (2D)

The FABRIK algorithm is an amazingly clever solution to the Inverse Kinematics problem – how to adjust the joints of an arm to reach a target location.

In this tutorial, I go over how the core algorithm works in 2D, building up from simple concepts.

FABRIK Algorithm (2D)

NaN-Boxing

How do dynamically typed languages hold any data type in any value?

One way is NaN-Boxing. This technique crams a payload into a signaling NaN value.

NaN-Boxing

Polygon Clipping

Polygon clipping is an interesting problem: how do you intersect, union, or diff two polygons?

My first attempt was a failure:

Polygon Clipping - Part 1 (Greiner-Hormann)

So I researched and developed another algorithm, which handles every case:

Polygon Clipping - Part 2 (Modified F. Martinez 2008)

Polygon Clipping

C Tricks

I update this document with different C tricks I come across that I find useful.

Maybe you’ll find some of these tricks useful too.


Tri-Color Garbage Collector

Garbage collectors can seem magical, but their essence is quite simple.

Here I discuss and walk through an experimental tri-color garbage collector written in C.

Tri-Color Garbage Collector

Genetic Algorithms

Using computers to simulate breeding to search for optimal fitness.

This article discusses the basic strategy I used to create breeding bunnies, in my Ludum Dare 31 entry, Bunnies!


Procedurally Generated Planet Textures

Using Perlin noise to generate planets.

When creating Odyssey, I used this basic technique to generate unique planet textures for every level.

(Much cheaper than hiring an artist 😛)

Procedurally Generated Planet Textures

Shunting Yard (Part 1)

A magical algorithm for parsing expressions.

Shunting Yard (Part 1)

Two-Dimensional Bin Packing

Given a collection of different sized images, how can you efficiently pack them into one big image?

Brute-forcing the problem is too expensive - so here we come up with a simple heuristic that works pretty well.

Two-Dimensional Bin Packing

How to Fix Banding in Gradients

Photoshop’s gradient algorithm can have banding artifacts when drawing subtle gradients. The fix: dithering.

How to Fix Banding in Gradients