Tic-tac-toe Collection
Blog

New game renderer

Version 0.9 includes one big feature you can’t see, but it enables other little features you can see.

The renderer for the actual game has been rewritten. The first one was based on some assumptions that no longer hold, was rather complicated, and most importantly was slow. The new version is far more flexible and quicker.

To get the game up and running sooner, the original renderer created native UI elements for each cell. For 3×3 this was fine. For 19×19 this was terrible, and could take 20 seconds on a slow device. This also meant rendering pieces outside of their cells was difficult (and in the future rendering something that was not a rectangular grid would be a challenge). Now, the whole board is one thing and layout is handled internally.

The first little feature this enables is cool little piece placement animations. The video shows pieces dropping in Drop 4. Gomoku also has its own, which I’ll let you discover.

The second little feature is actually the one that drove me to do this. You may notice when playing on a large grid there still is a (much shorter) loading phase when starting a game. This is not actually the renderer, but the UI controls for selecting elements (which for various reasons will probably remain separate). If the game was non-interactive, the loading would not be there at all. And you can now see that in action when loading a saved game. The new renderer is fast enough (milliseconds) that I can render arbitrary game states anywhere in the UI and the load game screen now takes advantage of this (previously saving a game also saved an image of the game just so it could be shown on the game screen).

Game design