It’s better to use floats for maths and leave ints for indices

Someone showed me a bug in my recent game, Freefall, whereby you can get as far as you like, by just changing speeds continuously, you don’t even need to look at the screen, just tap with a consistent tempo to keep changing speeds. This works because the projectile speeds are set with integers which means they have:

  1. A base speed at which they will hit you with the parachute
  2. Fast (double base) speed they will you with if in free fall
  3. Anything faster than this will miss you because it will get off the screen before it reaches you and is therefore only in there for decoration / to confuse the player

I used integers for practically everything in the game because the low resolution meant that even moving one pixel at a time is a pretty big step (there are only 48px in the vertical axis) and you can’t draw smaller than that.

During testing I focussed on checking that 1 & 2 would hit you at their respective speeds and that you could dodge them if you changed at the last moment. If you change speeds so infrequently the problem is less apparent. Continue reading

Launched a new game: Freefall

On 27 February I released a new Nokia 3310-style game: Freefall. In this game you control a parachute for humanitarian airdops in hostile territory. It’s my entry to Nokia 3310 Jam 5 and the theme was Fast & Slow so the main game action revolves around controlling the speed of the airdop between parachuting and freefall to dodge bullets coming from both sides.

The aim of the Nokia 3310 Jam is to have fun making a game using the restrictions of a Nokia 3310, so green, low-res, 1-bit screen, monophonic and only 12 keypad buttons. My entry placed 28th out of a 147 submissions and I’m especially proud of this because I did the music, animations, programming and game design all by myself. The game is open source and you can read it in the GitHub repository.

Always prefer accessing GitHub over SSH than HTTPS

This is to avoid accidentally cloning a repo as read-only when GitHub defaults to HTTPS links, and then having to edit the gitconfig later to get an SSH URL you can push to. Add these 2 lines to your global .gitconfig file in your home folder to override all URLs from HTTPS to SSH:

[url "ssh://"]
     insteadOf =

Why though?

Note, this is not for all git remotes, only GitHub. I have a similar setting for the GitHub Enterprise instance we use at work. Generally though, for most remote servers I’m fine with whatever it gives me, which is usually HTTPS.

The difference becomes important if I ever want to contribute (i.e. push) to the cloned repo, as is mostly the case when cloning my own repos or work code. Continue reading