Printing Floating-Point Numbers

March 05, 2014

Dragon CurveAs far as I could find, there are only two open source implementations of floating-point to string conversion that are both efficient and accurate. Each one uses a license requiring attribution in accompanying documentation. Personally, I don't use anything with an MIT or BSD style license because I'd rather avoid the legal baggage. Unfortunately, all of the public domain or Zlib-licensed alternatives don't produce accurate results (sometimes knowingly).


As an everyday tool that is often taken for granted, it might be surprising that it is so rarely implemented, but it's actually nontrivial to solve. It's also one of those problems complex enough where a wise engineer might recommend that "you never write your own", but I like a challenge and have been interested in it for a while. After spending a couple weeks investigating and experimenting, hopefully I can make it a bit more digestible for the curious.

RJ 9-bit

January 7, 2014

RJ 9-bitI made this font for my updated site design. Every character is made from a 3x3 grid and it supports the basic latin character set (but the punctuation is a bit of a mess to be honest).


Feel free to download and use it as long as you give me credit. It's released under the Creative Commons Attribution 4.0 International License.

Damped Springs

July 20, 2012


I've worked on third-person camera systems for numerous games and I often need a method for smoothing camera motion as the player moves through the world. The player’s motion may create sharp, discontinuous changes in direction, speed or even position. The camera, however, should:

  1. Avoid discontinuities in motion. Accelerate and decelerate as needed rather than snap to a new velocity.
  2. Never let the player outrun the camera. The farther away he gets, the faster the camera needs to move.
  3. Move exactly the same with respect to time regardless of frame rate.


To solve this problem, I often simulate the camera with a set of damped springs.



June 3, 2011

iSquish iSquish was both my first iPhone app and my first project built with Unity. I wanted to do something very simple to get my toes wet in the whole AppStore process. I did the programming, game design, sound effects, and user interface art. My friend, Takashi, modeled and animated all of the bugs.


All in all, I think going with Unity was worth it for the ease of iteration, portablitly, and the prebuilt editor, but it also came with a set of issues mostly focused on performance. Scripting in Unity is done with C# and C# is not built with the needs of a game in mind. The biggest problem comes from the language itself being built around the concept of allocate and forget with the assumption that performing garbage collection as needed won't be noticed by the user. This is fine in your average application, but in a game setting where you are always pushing the frame rate, the garbage collector is bound to cause a frame rate drop. This results in having to be annoyingly careful with what you do in C# to prevent hidden allocations from taking place. When you start realizing the need to avoid 'foreach' loops in favor of 'for' loops to prevent enumerators from being allocated behind your back, you quickly start to miss the simplicity of C/C++.

How to use ASSetPropFlags in ActionScript 2.0

August 28, 2010

There are multiple undocumented functions in ActionScript 2.0 of which one is ASSetPropFlags. I needed to use this function on a project recently and quickly found out that most of the unofficial documentation is either incorrect or overly brief. What I'm going to do here is describe how the function works and then show a program that will test and confirm some of the more complex functionality.