Just some minor startup improvements.
- Improved actual startup time by making some things run in parallel that were previously serial.
- Improved apparent startup time by transitioning from the splash screen to a loading screen sooner.
Just some minor startup improvements.
The game renderer has been massively overhauled, directly leading to the following:
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).
The Easy AI and Hard AI now work with Drop Four. Apparently they were previously getting confused.
A while ago, I wrote about how some game modes are just “bad”, but I was going to include them anyway. Despite that, it would be nice if there was way to avoid the worst of them. One of my planned features is match-made online multiplayer. If I want to allow players to choose settings, then potential opponents definitely need to know whether the game is going to be fair.
I came up with a plan to generate a load of potential game settings, and run the AI on them, and see what the results were. That way it would be possible to identify fair games (games in which both players have a similar chance of winning) and add them as options to the game. Although I may still end up doing that, it occurred to me I could just add this information to the app.
So, on the game setup screen in 0.8 will be a new section called “chance to win”. This is how measure of how good the AI believes the best move is for the first turn of each player. A you can see, in a standard game of Tic-tac-toe, it does not look good for player 2.
For general use, this is calculated on the server, and cached per game setup. It can technically be run in the app, but the results vary more (but will probably be added as a fallback – I strongly believe the app should work offline).
Version 0.7.1 of Tic-tac-toe Collection includes new AI difficulty settings. It turns out making an easy AI was quite hard.
At some point I plan to write an in depth post into how the AI works, but for now all you need to is effectiveness is based on how long it thinks for compared to how many possible moves there are. In this way it is quite unsophisticated.
So, for easy, I made the AI think for less time, and for hard, I made it think for more (I also made normal a little easier while I was at it). In general, this worked well. The problem was, even when I made it really easy, it was still impossible to be at it at standard game of Tic-tac-toe.
Standard Tic-tac-toe is a bit of problem all round frankly. I want the game to generally be a fun game, in which players have a good chance of winning (or losing). And that is not true of standard Tic-tac-toe. But not including it seems odd, so I have to try and accommodate it. Since you can’t beat the AI on normal anyway, I was already facing the problem that normal and hard would be the same, so I felt that it was important that at least easy would be different.
So in the end, I had to make the easy AI a little stupid. It still does scale it’s thinking down but now it also has a chance of just choosing a move at random. That chance should be low for games with more moves, so it doesn’t become silly on larger boards. But it does mean you can, occasionally, win a game of Tic-tac-toe.