Sonstiges: Developer Diary - The Creation of a Switch Game
Michael Grönert, am 26.12.2016, Seite 14 von 25
BadToxic Discord Server | GameMaster Discord Server | BadToxic on Twitter
BadToxic on Instagram | BadToxic's Dev Instagram | BadToxic on YouTube
Part 14: Support for Android and iOS
Today we want to make sure that our game will work on mobile devices. More specifically, it’s about devices which offer only touch controls. Most people now may think of their mobile phone or tablet, most of which are running Android or iOS, so I chose today's title because of this. In general, this also applies to Windows Phone or devices that can be operated at least optionally without buttons and controllers, such as laptops with touchscreens or even the Nintendo Switch.
Control without buttons
Most phones, smartphones and tablets have no buttons to control our character, so we need a solution that allows us to control everything via touch screen. First and foremost, the controls get optimized for the 3DS and the Nintendo Switch which both have analog sticks (joysticks) and buttons. Exceptions so far only are a few menus such as the network lobby - which later will get additional button controls, too. For the 3DS, a pure touchscreen control setup is theoretically possible but at least for the Switch, it would not make sense in TV mode.
The most important aspect is moving our character through the landscape. For this, various approaches would be conceivable: For example, you could tap on a spot the player will automatically walk to and you could interact with objects by tapping them. For this, however, a pathfinding system would be necessary so that you do not get stuck on any small obstacle which would otherwise negatively affect the flow of the game. And all mini-games also would have to be adapted for other controls. For example, our “Gong” (Pong clone) could move the paddle to the finger. Such an implementation could make the operation more convenient for a user but would require a great deal of effort. It can also greatly change the experience and make things easier or harder. Imagine an online shooter, where a player with a mouse plays against one with a touchscreen - probably not fair. For these reasons, I decided, at least initially, for a "touch gamepad" - the mapping of an analog stick and buttons on the screen.
”Touch Gamepad” simulates gamepad buttons on the touch screen (iPhone X)
On the left side, we have an analog stick with which we want to move our character. Like his physical role model, you can either move it a lot or just a little bit in one direction to regulate the speed. So far we have an A and a B button on the right side. They simulate pressing, holding and releasing real buttons.
Initially, I experimented with a few peculiarities such a simulated analog stick can have as an advantage over the real deal. For example, it does not have to stay in place and could be moved a bit to accommodate the most comfortable thumb position. Or it can jump directly to the point where you place a finger so that you can start moving from any point. Of course, it should be noted that the analog stick can not be moved to positions where it obscures other UI elements that you want to interact with - neither the A and B buttons, nor the hotbar of the inventory should be covered. Unfortunately, I was not satisfied with the results of these experiments with different screen sizes and found it rather unpleasant not to be able to rely on a fixed position, so I have decided against these approaches for the time being.
Inventory navigation via gamepad
While you couldn’t move around the player character before without using buttons, it was the exact other way around in regards to the inventory menus. It was not possible to use or move the items without resorting to a mouse, stylus or touch controls. This should be changed to allow for button or general gamepad controls which is especially important for the Nintendo Switch’s TV mode. Here, too, a concept had to be worked out first to make interactions as simple and intuitive as possible. I wanted to make sure you can do as much as possible without interrupting the flow of the game. This means I do not want to pause the game, open an extra UI and go through all the items manually if it can be avoided. For example, how can you move an item from one inventory, like the GameGuy window, to the hotbar and vice versa? You can find lots of games where you can send each item individually to another inventory via additional submenu - "armor", "equip sword", "move potion to quick menu", "put apple in backpack"…
Quick use and moving items via gamepad
In this screenshot you can see how I simplified such processes. With the L and R shoulder buttons you can move the item slot selection in the hotbar to the left or to the right. If a usable item is highlighted, the "use" button is displayed, in this case the Y button as it’s the case of an Xbox controller. If this key is pressed, for example, the corresponding window opens when the GameGuy Item is highlighted. Now that a window covers the game world, it makes no sense to be able to move the player in the background. Therefore, the movement keys (analog stick or D-pad) now can be used to navigate in the inventory of the window parallel to the hotbar navigation. On the right side you can see what happens when a battery is highlighted in the hotbar while in the window a slot for the battery is marked. As soon as two slots are marked whose contents can be exchanged, the "swap" button appears, here X. Without illustrating all the details, it should make clear how much easier the navigation will be. Of course, a lot of logic is needed to check which items can be used or exchanged.
These are likely to be the most important improvements in terms of controls which were fundamentally changed, meaning today’s topic has been dealt with. In the next diary entry, we will finally take care of a second mini-game and this time you are welcome to try something for yourself.
Do you prefer to read this diary in the developer's mother tongue? Then click here to read this diary entry in the original German language!