Monday, August 15, 2016

Building and Testing Tezad in Go 1.6 vs 1.7

Go 1.7 just got released! How does Tezad fair?

Tezad is pezad's puzzle game project, written in Go. It still has quite a lot of polishing ahead of it, but at least the game is playable (besides not knowing where the boundaries are). Take a look:

The latest version of Tezad, built on Go 1.7. Look at me almost get a home run, or a quadruple, or whatever the non-infringing name would be!
It's got lots of other stuff though: A game that ramps up gravity every 10 line clears; gravity which can drop 2 or more lines every frame towards the higher end, even instantly dropping to the bottom on the last levels; CW and CCW rotation, fast drop, instant drop, wall kicks, a ghost tetromino that will show where your tetromino will land... you can even hold tetrominoes too, it's just too bad you can't see what you're holding.

Go 1.7 supposedly has a compiler that will make smaller and faster binaries, and will do this faster than previous versions of Go. Let's try it out!

I can test the compile times and binary sizes easily enough, but the game doesn't yet have an automated benchmarking tool. What it does have is unit test for core parts of the game logic, all running parallel. So, I ran a bash script to build Tezad in a loop n times, and another script to loop over running the tests n times as well.

Turns out they weren't lying! Take a look:

Go Version1.61.7diffratio
Total build time sec63.28357.426-5.85790.74%
Total builds25250100.00%
Avg build time sec2.531322.29704-0.2342890.74%
Tezad size bytes50556964531984-52371289.64%
Tezad size MiB4.8214874274.322036743-0.499450683689.64%
Total test time sec91.83670.13-21.70676.36%
Total tests25250100.00%
Avg test time sec3.673442.8052-0.8682476.36%
As tested on an old 13-inch late 2009 MacBook with 2.26 GHz Intel Core 2 Duo, 4GB DDR3, Crucial M2 256GB SSD.

Build time improved over 9%, size of the binary improved over 10%, and the time to run the tests improved over 24%. Not too shabby for not changing a single line of code!

(As an aside, you may be wondering what happened to Tezad since you saw it around 2010 or so. That was the C++ version. The new one is a complete rewrite. Code isn't yet available to the public, but someday it should be.)

Monday, March 7, 2016

FLIF - Free Lossless Image Format

FLIF is a lossless image format which "outperforms PNG, lossless WebP, lossless BPG, lossless JPEG2000, and lossless JPEG XR in terms of compression ratio."

Besides being patent-free and LGPL licensed, one of the more useful features is in the interlaced images. Need a 1:2 or 1:4 sized image? Then don't read all of the file! I'm not sure if there are markers in the file which let you find out these boundaries, but it is a new file format so who knows what'll happen between now and version 1.0.

Monday, February 22, 2016

OpenDyslexic font

OpenDyslexic font is designed to make text easier to read for dyslexics. Neat! It is also free for personal and commercial use.

http://opendyslexic.org/