After an initial burst of energy last month, I knew I wouldn't have so much time available for working on Tower Defence challenge up until the June 30th finish. However I did manage to get much of it working already and now I am mostly at the 'finishing up' stage.
- More music tracks
- I have added some more game modes. The normal mode is a scripted set of 12 levels, random generates 20 random levels increasing in difficulty, and 'budget' is a shorter game of 6 random levels but you are given an estimated amount of money to beat all the enemies at the beginning, and you can't win any more cash, so you have to make it last.
I have made some effort to make the game cross platform. It works well on Linux, Windows and Android now. To that end there is a certain amount of 'designing for the common denominator'. I had to scale back the particle effects so that it would work well on tablets and mobile phones. If I was spending more time on it I would scale the number of particles according to hardware.
Graphics Quality Setting
Inside the game pause menu there is now a performance slider where you can trade off graphics quality with speed. It sets the unity GraphicsQuality setting. This works well, although I did encounter a snag on Android.. the higher quality settings on some devices was causing complete graphical corruption, possibly trying to switch anti-aliasing. While I could try and blame this on Unity, I do know that devices can be bad at reporting their capabilities, and you often have to just 'try it and see what happens'.
What was however a design oversight is that when you set unity to GraphicsQuality that causes corruption, while you can quit out of the game from the OS, Unity actually SAVES your choice of graphics quality so that the next time you run it it is also corrupted. The only way around this (on Android) was to go into App settings and delete the cached app data. Clearly this was not ideal for users.
As a bodge compromise, when you originally start the game it reads the default GraphicsQuality, persists this separately, then resets to the default every time you run the game. This means any changes to quality are lost on each startup, which is annoying, but better than the graphical corruption. Another alternative would be to get the user to click on an 'OK' box within 15 seconds to confirm that graphical changes worked, but I did not have time for this.
Gamepad / Keyboard input
While a lot of tasks have gone very well, I spent a lot of yesterday and today getting keyboard and gamepad input working. Most people will play the game using mouse, or touchscreen, and it works best with these. However my Android TV box has no touchscreen, and I find it annoying how few Android game developers support other means of input.
I had previously managed to get gamepad input working on Android using Android SDK via java / NDK, however configuring input on Unity seems rather overcomplicated. I read several recommendations that the Unity input system was poor, and it was better to buy InControl or Rewired assets to do this.
I tried the free version of InControl but couldn't get it to recognise my gamepad. So I went back to the in built Unity InputManager and finally managed to (barely) get it working. The selection of joystick axes seems non-standardized, so I have no idea whether my setup will work with other joysticks / gamepads, not having the time or facilities for further testing.
As well as simply getting a gamepad working, there is also the issue that the game was designed for mouse.
I had hoped that navigating the menus would be a simple affair, but it took me a while to work out how to select a default menu item when entering each menu screen, without which you could not change the selection. Many people I googled had had similar problems, I am not clear on the 'correct' way to do it. In addition many of the UI items did not show a large enough change in colour to indicate that they were highlighted, and I had to change this manually.
Gameplay with keyboard / gamepad
The biggest hurdle was how to place towers in a game designed for you to pick a spot with the mouse? I decided to have a cursor which you can move up down left and right across the map. This was a bit fiddly to get working with the input, and is still not perfect, but does allow you to play the game, albeit not as efficiently as with a mouse / touchscreen.
Finally I had to cover tower selection via keyboard / gamepad. To do this I simply had a button cycle through towers available, and had to put in an indicator arrow to show which was currently selected.
I have now tried it and it even works well on my Android TV box with gamepad, which has surprised even myself. Performance has been very good, even on low power devices. That is probably largely down to careful design due to me being already familiar with performance bottlenecks on this hardware (fill rate is usually the biggest issue), and using mostly simple mobile diffuse shaders.
I suspect from now until release I will mostly be concerned with testing. The input in particular has introduced all kinds of subtle potential bugs from different combinations of input devices. I would ideally like a high score table but handling virtual keyboard input on different platforms puts me off, unless I use a simple initialing system.