All Articles

Most recent displayed first:

  • C Tricks

    I’ve been coding in C99 quite a lot lately. I wanted to write down some of the tricks I’ve been using.

    I don’t take credit for any of these ideas – I’ve either directly stolen these ideas from other coders, or rediscovered techniques that have probably been known for 40 years.

    I will continue updating this document as I stumble across more useful tricks.

    The code on this page is Public Domain, but this article is copyright according to the notice at the very bottom.

    ...read more

  • This Isn't Normal

    “That’s just the way it is!”

    It amazes me how easily bad ideas fool humans.

    ...read more

  • Super Trump Run

    I’ve been depressed lately. I decided to make a game to make me laugh and vent some steam. Enjoy!

    ...read more

  • The Failure of Being Right

    Doesn’t it feel great to be right?

    ...read more

  • NaN-Boxing

    How do dynamicly typed languages allow any variable to hold any type? There are a few different techniques, but the one I use for sink is NaN-boxing.

    ...read more

  • Growing Through Pain

    Watching the children around me growing up, I am always amazed at the amount of pain they are forced to deal with. Illness, uncertainty, divorce, frustration, powerlessness, death…

    A child experiences such extreme amounts of pain on a daily basis.

    ...read more

  • Polygon Clipping (Part 2)

    My previous polygon clipping tutorial dove into the Greiner-Hormann clipping algorithm. Unfortunately, this algorithm fails at common cases… so let’s revist the problem and try again.

    The F. Martinez 2008 algorithm handles coincident edges (unlike Greiner-Hormann), but it still has some minor goofiness. Let’s solve this problem once and for all.

    ...read more

  • Polygon Clipping (Part 1)

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

    The Greiner-Hormann clipping algorithm is quite beautiful and intuitive. Let’s dissect it and take a look.

    ...read more

  • De-Bug

    Writing Prompt from /u/raybreezer:

    The world as you know it has managed to exist without any free will whatsoever. One day you realize, you actually have the ability to control your own actions.

    ...read more

  • Kong's Garbage Collector

    Garbage collectors (GCs) feel like some sort of esoteric programming magic. What’s really funny is that a simple good-enough garbage collector is actually quite easy to write. The core functionality of Kong’s GC is only around 250 lines of C code.

    ...read more

  • You Are The Cook

    What a shame that so many people lead the same basic life.

    ...read more

  • The Gray Sludge

    Each paint stroke is death.

    One more moment, lost to the abyss, never to be seen again.

    Miniscule fragments claw themselves forward, trying to outrun their inevitable fate: the gray sludge.

    ...read more

  • Genetic Algorithms

    In my Ludum Dare 31 entry, Bunnies!, I used a very simple genetic algorithm to breed bunnies. It can seem like magic at first, but genetic algorithms are very simple at their core.

    ...read more

  • Ludum Dare 31 Live-Blog!

    Live-blogging my Ludum Dare 31 experience. Most recent entries are on top. I’ll plan to post about once an hour (while working). Permanent link here. You’ll have to manually refresh the page to get updates. Follow and comment on twitter @voidqk. All timestamps in EST.

    ...read more

  • Shunting Yard (Part 3)

    Let’s continue adding to our Shunting Yard code base.

    In Part 2, we created operator precedence. This allowed us to delay application of operators indefinitely, using a stack. Next, we’ll focus on adding parentheses, so that the end-user can manually override precedence.

    Series: Part 1, Part 2, Part 3, …

    ...read more

  • Odyssey (LD30) Postmortem

    Results are out for Ludum Dare 30, and my game Odyssey did pretty damn good!

    Rank (of 1493)CategoryRating
    #13Fun4.11
    #24Theme4.16
    #34Overall4.00
    #60Innovation4.00
    #200Mood3.45
    #269Audio3.22
    #337Humor2.71
    #484Graphics3.19

    The #13 ranking in Fun just blows me away! My aggregate rating is 93.6% (+0.1% from last time).

    ...read more

  • Jimmy Boy

    Writing Prompt from /u/BS9966:

    Suddenly various living dinosaurs start appearing all across the planet. No one knows how or where they are coming from.

    ...read more

  • Everyone's Ludum Dare 30 Results

    Like last time, I analyzed the Ludum Dare results.

    Click here to analyze the LD30 results!

    Alternatively, you can download the raw data here:

    ...read more

  • Shunting Yard (Part 2)

    Let’s continue building a general purpose Shunting Yard algorithm.

    We left off with bare-bones skeleton that implements a shunt to delay building of the abstract syntax tree (AST). Our skeleton left a lot to be desired. For this article, we’ll implement operator precedence.

    Please read Part 1 first, since the code here builds directly on the source from that article.

    Series: Part 1, Part 2, Part 3

    ...read more

  • Procedurally Generated Planet Textures

    For my Ludum Dare entry, I procedurally generate the textures for the planets. In the game, my math is a little off, and I didn’t have time to derive the correct formula – but now, with unlimited time, I can think a little more clearly :-).

    ...read more

  • Ludum Dare 30 Live-Blog!

    Live-blogging my Ludum Dare 30 experience. Most recent entries are on top. I’ll plan to post about once an hour (while working). Permanent link here. You’ll have to manually refresh the page to get updates. Follow and comment on twitter @voidqk. All timestamps in EST.

    ...read more

  • Everyone's Ludum Dare 29 Results

    I became slightly annoyed at the analysis and accessibility of the Ludum Dare 29 results. So I decided to write a program that would scrape all the pages and extract the necessary data.

    You can now download the LD29 results in a convenient CSV or JSON format, here:

    Or, for even more fun, I made a page that analyzes results:

    Have fun!

    ...read more

  • Shunting Yard (Part 1)

    The Shunting Yard Algorithm is, quite possibly, my favorite algorithm. It transforms a series of tokens into an abstract syntax tree, taking into account operator type, precedence, and parenthesis.

    Through the next series of articles, I want to build a general purpose expression parser using the algorithm. By the end, we’ll have an algorithm that can be easily extended to add many different types of operators… any arity (unary, binary, ternary, etc), prefix, infix, and postfix.

    Series: Part 1, Part 2, Part 3

    ...read more

  • Inner Demons (LD29) Postmortem

    Voting has officially ended for Ludum Dare 29. My entry was ranked as follows:

    Rank (of 1493)CategoryRatingPercentImprovement
    #63Mood3.8895.8%+31.9%
    #70Humor3.6495.3%+22.0%
    #101Innovation3.8893.2%+26.5%
    #116Overall3.7692.2%+23.3%
    #148Fun3.6090.1%+10.9%
    #149Audio3.5090.0%N/A
    #227Theme3.6484.8%+52.3%
    #551Graphics3.1763.1%-8.0%

    Average score: 88.1% (+23.0% improvement from previous entry)

    If you’re curious, you can play my game, Inner Demons! Let’s dive into the postmortem…

    ...read more

  • Ludum Dare 29 Live-Blog!

    Live-blogging my Ludum Dare 29 experience. Most recent entries are on top. I’ll plan to post about once an hour (while working). Permanent link here. You’ll have to manually refresh the page to get updates. Follow and comment on twitter @voidqk. All timestamps in EST.

    ...read more

  • Winter Olympics Game Jam

    I decided to challenge myself this weekend, with a faux-game-jam. I came up with a theme on Friday (Winter Olympics), and built Sled Drifter! over the course of the long weekend.

    ...read more

  • Diner Devil! (LD28) Postmortem

    Voting has officially ended for Ludum Dare 28. My entry was ranked as follows:

    Rank (of 1284)CategoryRatingPercent
    #267Fun3.2279.2%
    #343Humor2.6173.3%
    #371Graphics3.1771.1%
    #399Overall3.1368.9%
    #427Innovation3.0066.7%
    #464Mood2.8163.9%
    #867Theme2.1432.5%

    Average score: 65.1%

    If you’re curious, you can play my game, Diner Devil! Let’s dive into the postmortem…

    ...read more

  • Two-Dimensional Bin Packing

    Two-dimensional bin packing turns out to be quite a pickle.

    I was introduced to the problem as a 13 year old. My Dad’s friend, Keith, noticed I was taking a knack to programming, and wanted to see if I could help him. Keith was (and still is) a carpenter.

    Keith wanted me to write a program where he could input a list of shapes, and the program would figure out the best way to cut a board of wood into those shapes, while minimizing scrap wood. Seems reasonable.

    My 13 year old mind quickly exploded… I couldn’t figure out one simple, obvious way to do it. Eventually I gave up, to my ego’s dismay (and Keith’s disappointment!).

    ...read more

  • Ludum Dare 28 Live-Blog!

    Live-blogging my Ludum Dare 28 experience. Most recent entries are on top. I’ll plan to post about once an hour (while working). Permanent link here. You’ll have to manually refresh the page to get updates. Follow and comment on twitter @voidqk. All timestamps in EST.

    ...read more

  • How to Fix Banding in Gradients

    Photoshop’s gradient algorithm is quite disappointing. It is notorious for creating gradients with banding. Here is an example, attempting to create a gradient from #222 to #333:

    Photoshop’s Gradient with Banding

    Eeeww!

    Can you see it? If you look closely, there are vertical “lines” in the image where the color changes. This is incredibly easy to fix algorithmically - but very difficult to fix any other way.

    ...read more