Inside Velocity 2X: Telepods
Creating functionality for throwing telepods was by far the most technically challenging task.
We started off by allowing players to throw telepods using only the touch screen on Vita. Essentially, the player touches any point on the screen, and we use that point as the anchor. As the player moves their thumb around we generate the trajectory for throwing the telepod around the anchor point.
This worked smoothly on Vita, because there is a nice big screen to play with. You can touch anywhere on the screen and there’s enough space to pull the trajectory in any direction you wish. Velocity 2X was initially signed as a Vita-only title, so this was all good. Later however, it became a cross-format title, and on DS4, this was extremely hard to get right.
First off, there isn’t much space on the DS4 touch pad. The only way to get a throw trajectory right was by touching beyond the middle of the pad, using as much distance as possible to create the anchor pull. No matter how we fiddled with the numbers, we couldn’t get it to feel intuitive. Alas, we had to leave it alone and move onto tasks with much higher priority.
Due to the fiddly nature of our implementation – and after watching Colin Moriarty repeatedly fail to get the hang of it at GDC – we decided to change tact and add support for using the left stick to throw telepods instead.
Initially, even using the left stick didn’t feel right and intuitive enough. The problem was that there are some areas where you want fine precision over the throw trajectory, and others where you want broad movement. The following image shows where fine control of trajectory is required:
In other areas you want broad movement so you can throw the telepod at roughly correct angles and move through a level quickly:
To overcome this problem, we changed it so that trajectory is no longer based on the direction you are trying to throw the telepod, but actually uses the magnitude of movement instead. We track how fast the player moves his/her thumb on the left stick. If the speed at which the input changes is beyond a particular threshold, the trajectory follows the movement quicker, and as it slows down, the movement becomes more fine grained.
Once we had this new system in place, we simply applied it to the DS4 touch pad and were delighted to find that it suddenly felt a whole lot better. Phew.
To generate the actual trajectory taken by a telepod, we had to replicate the behaviour of Box2D.
Replicating the movement of a telepod through the air is easy, but generating the bounce direction is really quite difficult.
This is especially true for cases where the telepod hits along the boundaries of two surfaces of the environment. In order to ensure that we get a 100% accurate trajectory, we generate a Box2D physics object right before we think the trajectory will hit the environment. We give this Box2D physics object the properties that the telepod will have right before it hits the environment and use its position in the next frame to determine the bounce direction of the telepod. Facemelting.
The trajectory calculations per frame actually try to predict 100 steps in the future. There is one frame lag between what you see on screen and what the physics calculations are doing behind the scenes, to allow for bounces. So you can say that the telepod throw trajectory runs at 30fps while the rest of the game runs at 60fps.
Teleporting to telepods
When you teleport to a telepod in mid-air, there are a few frames of pause before you begin to fall, which allows you to get your bearings before deciding what to do next. This means that tricky challenges are possible, such as throwing a telepod, teleporting to it in mid-air and quickly teledashing through a hazard.
This functionality caused a lot of problems for me as it was so tricky to get the code right, but James was very passionate about the mechanic and really believed the game needed it.
Fortunately we did a lot of playtesting, and during one of our playtesting sessions someone just couldn’t get the hang of it at all. We watched in pain as she repeatedly failed to teledash through a hazard after appearing from a mid-air teleport. The poor girl must have tried fifty times before she looked around to ask for help.
The great thing about playtesting in the studio is that you can make changes on the fly, which we did. I sat the tester down next to my desk and tweaked the values and timings until she was able to perform the action perfectly every time.
Whenever a new feature is implemented, it creates potential clutter and confusion for a player, so we spend a lot of time streamlining the experience to get out of the player’s way. In Velocity 2X this is probably best illustrated by transitioning between ship and platform sections using telepods.
For example, if you’re flying along in your ship, you can drop a telepod anywhere as a way to return to that point later on. If you’re then in a platform section, you can drop another telepod anywhere on foot, and using the map you can instantly teleport between the two telepods you dropped. The game assumes that the player gets in and out of their ship, but the player doesn’t have to labour over it. Feel the power!
We’ve managed to squeeze a silly amount of functionality onto a single button:
- Tap the triangle button and Kai/Quarp Jet drops a telepod.
- Hold down the triangle button while standing on top of a telepod and Kai picks that telepod up.
- Double tap the triangle button and Kai/Quarp Jet will teleport to the most recently dropped telepod.
- Hold down the triangle button and use the left stick to enable the trajectory for a telepod throw.
Even though we still support touch screen and the DS4 touch pad for throwing telepods, FuturLab’s preferred way of throwing the telepods is via the left stick as it’s just faster. Hopefully now that you know how it works, you will find it easy to adjust tricky throwing angles!
P.S: To avoid accidental screen touches, the areas close to the edges of the screen on Vita are ignored if input is being received from either of the sticks… =)