The game has made a great deal of progress in our second sprint! With the unreal project and gthub set up, it was finally time to start programming the movement. I started with the Unreal Third Person Template, because it comes with a functional player character using Unreal’s Character Movement Component, as well as a nice level to play around with the movement.
I began by tweaking the parameters of the Character Movement Component. The Lead Designer wanted the player to build up speed on the ground that can be translated to the air using the pole vault, and so I raised the max speed on the player and lowered the acceleration, which made our character control not dissimilarly to how Sonic The Hedgehog might. The next tweak I made was greatly lowering the jump height. While we still wanted the jump to be an option, we want players to rely heavily on the pole vault for moving vertically.
With the basic movement configured to how we liked, now it was time to start with the pole vaulting! I began by identifying where it was possible to vault from by using a raycast from the player’s head pointing 45 degrees downwards towards the ground. Then, by taking the surface normal of the raycast’s hit, I was able to reflect the raycast across that plane, and use that direction for an impulse added to the player. Then, I took the players velocity (scaled down a bit so that the impulse wasn’t insane explosive) added up with a baseline velocity to get the magnitude of the impulse applied to the player.
Red - Raycast checking for surface
Blue - Surface Normal
Yellow - Reflected Raycast with magnitude shown
Standing Still vs Running Full Speed
I also negated the Y value of the reflected vector when the raycast hit a vertical wall, allowing for the player to vault off of walls!
There were a few issues with this system however, Vaulting off of steep slopes felt awkward, because it would usually just send you straight up or backwards. And vaulting off of an angled ceiling would also send you upwards since the Y value was forced to be upwards when reflecting off of a wall.I had tried to solve this by using rotators rather than a reflection vector to determine the direction of the vault, but this ended up just becoming a mess of code that didn’t really solve the issues, and I’m still working on solutions to these issues as well as discussing with the lead designer about what types of these weird issues are acceptable constraints for designing our levels.
However, some of these unintended behaviors were actually pretty fun to play around with. While messing around I found that jumping at the same time as vaulting would give me more than twice the vertical height of the normal pole vault, and after speaking with the lead designer we decided that we wanted to keep this “bug”, as it’s added some interesting depth to the main mechanic. We also considered giving the player an extra forward boost when vaulting off the ground without the jump, to make both techniques better in different situations.
Another unintended ability was a “wall-riding” of sorts. Because the player’s direction was a reflection off of the surface they’re aiming at, hugging a wall and aiming almost parallel to the wall, barely angled enough to be touching, meant that you weren’t pushed very far away, and that you were close enough to do it again, and again, and infinitely so long as you managed to time your vaults well and stay close to the wall.
The player is sent slightly away from the wall at this angle, but by holding left you can steer yourself up against it again to repeat the process indefinitely
While this technique is pretty fun, it also opens up a whole can of worms in the level design department if every wall can be vaulted along indefinitely as if it were the ground, so I’m working to implement a solution that still permits long sections of continuous wall vaults in the level design, without turning every flat wall into a potential sequence break.
Over the next sprint, I’m going to try and polish up the movement some more and fix some of the current issues so that we’ll be able to create a prototype level for playtesting!
Comments
Post a Comment