Already Normalized

Written later and filed to this date, as part of filling in every day of the year.

touch controls

That is the whole message: two words, lowercase, no body, the fourth and last commit on the day the game repository was created, a Wednesday in January. The first commit was “init”, 86 files including a 215-line instruction file for the model that describes an architecture with no way yet to be played on a phone. The second, “init commit”, added fonts, an icon atlas and a deploy workflow. The third, “file path fix”, changed two lines, a script tag and the music folder, from absolute paths to relative ones, because the host it was about to deploy to serves a project under a sub-path and an absolute path reaches past it. Then this one: six files, 225 lines in, 25 out.

Most of the 225 are a joystick. Touch the screen and a base circle appears under the finger, radius 60, with a knob of radius 25 that follows the finger and is clamped to the base. The direction handed to the game is the knob’s offset divided by the 35 pixels it can travel, after a dead zone of 10. The input system got a new branch: “Check if joystick is providing input (already normalized)”, and if so, use it as it comes; otherwise read the keyboard, and normalize that.

“Already normalized” is the phrase to read closely. The keyboard branch normalizes because holding two arrows would otherwise move the player faster along the diagonal; it makes every direction unit length. The joystick branch skips that step on the strength of the parenthesis, and the parenthesis is almost true. The joystick vector is at most unit length. Inside the rim it is shorter: a thumb resting just past the dead zone moves the player at twenty-nine percent of full speed, and the speed rises with the reach. The comment says the two inputs are alike. The code says a thumb can walk and a keyboard can only run.

Whether that was intended, the message cannot tell you, because the message is two words. Nor does it mention the other change in the diff: the music default went from one track enabled to all twenty-six. Nor is there a body to say that the deploy workflow added two commits earlier listens for pushes to a branch called main, and the repository’s branch is master. The game was, at that moment, a thing I meant to deploy, with controls for a phone and a workflow that would never fire.

The author understood the engine well enough to write 215 lines about it for a model and a joystick in an afternoon. The one sentence of explanation in the whole commit is the parenthesis, and it is the one thing in it that is not quite true.


← all writing