Inside Velocity 2X: Teledash
Like many of the mechanics in Velocity 2X, teledashing was implemented, re-implemented, implemented once more, and then tweaked and polished to a knife edge to make sure that players feel awesome and in control while teledashing at pace through the environments.
See Kai’s teledash in action in the trailer below:
Knowing what is happening behind the scenes with this seemingly simple mechanic will give you the power to complete levels at a lightning pace.
The birth of teledash
We started with a very simple approach. You bring up the teledash cursor at a particular distance from Kai and when the player lets go of the square button, we check whether it is colliding with the environment or not, and position Kai to the location of the cursor.
We soon found a problem in that the cursor’s location is always mid-air since it is positioned at Kai’s shoulder height. That means every time we move Kai to the location of the cursor she will go into the jump state. This meant you could’t chain multiple teledashes =(
Instead of moving Kai to the location of the teledash cursor, we positioned her to the teledash cursor position minus the height of the cursor from the ground. This worked well, until we got to the point where the cursor was on top of a slope. If we moved Kai to the location of the cursor minus the height of the cursor, we end up with Kai inside the environment =(
In comes ray-casting. Essentially we draw a line from the location of the cursor downwards towards the environment. We determine the point at which the line hits the environment and move Kai to that location.
We wanted Kai to be able to teledash through hazards and Vokh guards. Pulling stunts like this at high speed is extremely fun, but our first implementation was tricky to do. Way too tricky as it happened, so we make the player invincible for a few frames if they enable the teledash cursor while attempting to warp through Vokh guards and other hazards.
So be fearless and see how fast you can go through the environments – teledashing through hazardous platforms is the coolest thing you will do this year! 😀
Sprinting and teledashing
The system also allows for smooth transitions between sprinting and teledashing. You can teledash in any direction and our system will remember the direction in which you were sprinting and adjust the speed of the player so you never stop sprinting while teledashing.
As explained above, Kai is positioned from her current location to the position of the cursor when performing a teledash. For a while this meant that if you were teledashing quickly through environments you would not collect the crystals if you teledashed past them. Whilst this makes sense in the game universe (teleporting is not the same as moving quickly), it’s not very fun missing crystals and having to retread your steps to grab them :/
To get around this problem we generate 5 raycast lines which collect crystals between Kai’s teledash start position and her teledash end position. Our system ensures that players can collect crystals even when teledashing from a slope:
If you are aiming for quick times and topping the leaderboards, teledashing is your most trusted friend.
See how fast you can complete the levels. Oh and see how many teledashes you can squeeze into level 4 =)