Imagine this: You rush to the airport and get there with 50 minutes left until your flight leaves. Security takes longer than usual as your other half left her nail polish in your bag, and you get to your gate with 10 minutes to spare. Finally, when the boarding begins, you find there were actually two flights leaving for the exact same end destination, at the exact same time, and your flight is actually on the other end of the airport.
This happened to me on Monday. I was due to be in Cologne for GDC and Gamescom, after successfully applying for, and getting, press passes for both major conferences. There were no more flights that day, and no more for the next day, so instead of moping around feeling sorry for myself I decided to make the most of my week off from work, and spend the whole week working on Twixel.
So for a progress update, here’s what happened to Twixel between August 15th and August 21st:
- Twixel now supports multiple aspect ratios
In the past release of Twixel, I was new to developing, and so decided to develop the whole game in 16:9 aspect ratio. Because of this, I found that if devices had anything different (e.g. 4:3 on iPad) it would cause issues for the presentation of the game. As a quick workaround for the time (as back in 2014 Unity’s GUI tool was atrocious!) I decided just to put black bars at the top and bottom of screens to make sure Twixel was always 16:9 (as can be seen below on the iPad version):
As of this week, I have now gone back to the drawing board and made sure that Twixel is fully compatible with 16:9, 16:10, 4:3 and 5:4 aspect ratios. This was achieved by getting the screen’s aspect ratio, and changing the FOV (for 3D) and camera size (for 2D) based on what aspect ratio the monitor was. This also required changing the sizes of the stages to ensure no blue/grey skybox was seen around the edges, but otherwise I’ve tested this is all now working exactly as expected. You can see the PC 4:3 screen below:
- All menu’s updated to use new GUI Canvas method, ensuring text and images are in the right place no matter the aspect ratio of your monitor
Before Unity’s great new Canvas feature, I was stuck with making elements in game, and hoping they stayed in the same place between resolution changes and aspect ratios. Now, I’ve gone back and made all screens comply with the new method, ensuring all text stays where it should do on every screen. This was needed for the next update-
- Twixel now has context aware button prompts throughout entire game
When I first released Twixel back on Humble Bundle, I programmed in xbox controller support but left all menus referring to keyboards. Not anymore! For the Steam release, all screens fully support xbox and PC inputs, meaning no matter which device you’re using to play the game, every screen will show you the appropriate buttons to press. For a comparison, look at my Pause Screen (shown when you pause) compared to my new one:
and the new one (should a user be using their keyboard to play the game):
and the new one should a player be using the Xbox Controller to play the game:
- Overhauled entire save and load system, introducing a GameManager to track all variables used throughout
This one took forever! Lets go into depth as to why this had to happen:
When I first made Twixel, I was relatively new to programming practices, and whilst I still feel I’m a noob, I at least know this: never save things in the registry.
Twixel 100% relied on Playerprefs.setfloat and others to save and read all information about high scores, achievements, everything. This was all fine and good for someone new to programming, but meant that any player could easily go to their registry, change a few keys and BAM! They’ve got 100000 seconds on a level. This also caused performance issues, as the OS ensures that the registry can never be corrupted, it has to process each request to read and save elements to it. Because of this, Twixel was sending requests 60 times a second (it’s framerate) causing performance to plumit!
Considering Twixel will incorporate leaderboards and achievements on Steam, this could not stand, so I’ve set about making a GameManager which never gets destroyed whilst the game’s open (and even if it somehow manages to, it’ll remake itself, meaning it’s forever present).
This GameManager stores all the variables I need throughout the game, and filestreams them them to a TwixelSaveData.dat file on the devices program data directory. Whilst I know this file is still hackable, it should prevent 99% of players from opening it and messing with the values.
With this GameManager in place, I set about changing every single reference to the old playerprefs, and my god were there many! I then also had to test the entire new system, ensuring it worked as expected. I’m glad to say that as of my Steam release, this will indeed all work as a player would expect!
- Fixed presentation of Twixel Level in 2D mode
Twixels logo is meant to illuminate as the cubes circle it. In 2D this was not happening as the cube’s animation stayed exactly at the logos sides, stopping light from illuminating it. I’ve now made the cubes move forward (and back!) should the player choose 2D, ensuring it’s always illuminated like it should be.
Old way (bugged - notice the logo at the top being grey):
New (fixed) way:
- Twixel now uses Unity’s new sceneManager system.
To load levels years ago in Unity was as simple as:
This unfortunately has been superseded, meaning whilst it still worked, it may not in the future. As a consequence I had to go through my entire code and change it to:
Not a massive change, and nothing the end user is ever going to see, but one that needed doing.
Just the Beginning
There’s still much more to be done before Twixel’s release on 18/11/2016, but so far, I’ve made great progress. Once a few more tweaks have been done (fixing some issues with object generation and creating more obstacles), I’ll work on getting Twixel talking to the Steam API correctly. I’m hoping that won’t be too difficult, as Twixel already works with Google Play and Game Center on Android and iOS.
Anyway, thanks for reading, and if you have any questions about Twixel or anything in general, you can reach me @Caesoose on Twitter, or just comment below! I’ll be happy to chat.
I cant wait a lot of hype behind this game.