@Deftoneish Glad you like it!
@wzl Well, once it is more polished, we'll see what we do with the tool. (
If I'm not too ashamed of the code, perhaps open source it?)
@ENDESGA Thanks! We do not post very often because we are busy working on it
The past weekend I re-wrote the code for the main character jump. We found that what we had didn't have too much room for tweaking with what we had, so we had to change it a little bit.
This is how the
MC Jump Model works now:
For the game, although we think the best experience would be a gamepad, we do not plan to use analog input (so the experiencie remains the same when playing in a keyboard).
On the
horizontal movement: we have the walk speed, the running speed, and in-between a small time (that we can modify easily) about how much time it takes to get from min to max speed, and a different time for stopping. Running will be acomplished with a button/key.
On the
vertical part, we want to set a min jump height, and a maximum height, but also to give the player the control of the jump.
So we have 2 different stages of jump:
-
preparation: we actually have an animation for this part, that is when the MC prepares to perform the actual jump.
-
afterburner: (i've put that name, if you have a better/adequate name, please tell me
) that is the part of the jump when the MC has already taken off, but, if still pressing the jump button, it can make it jump higher.
So, the complete
velocity for a jump is composed of 3 parts:
min jump velocity + preparation velocity + afterburner velocity.
Since we know the min/max height we want
we have fixed the min/max velocity. We split the difference between the
preparation velocity (proportional to the time it takes to play the prepare jump animation), and the
afterburner velocity (that is proportional to the
afterburner time -> a param we can tweak).
Lets say for example the animation takes 0.25 seconds, and we put an afterburner time of 0.25 (the maximum time to control the jump height would be 0.5 seconds).
Every row in this figure represents a different proportion of "velocity weight" on each stage of the jump: The first row, all velocity is gained in the preparation jump, on the second one there is on part of the velocity jump that is gained in the 'afterburner stage', and in each row, the contribution proportion of that part grows.
Then we have the boxes:
- The
red one : the
width represents the time the player keeps pressing the jump button, the height the proportion of the maximum velocity is getting by pressing the button until that time.
- The
green one: the width marks the point where the preparation animation ends, and the height the proportion of the max velocity you get at that point.
- The
yellow one: the same , but for the last part of the jump.
- The cyan one: is there to mark the minimum velocity threshold
And then we have the parabola, that is the height the MC versus time.
Or, looking at it in another way, here we have two rows:
- the first row is the vertical velocity the MC gets versus the time it keeps pressing the button. And in each column we have a different proportion of the importance of the (prepare/after) stage of the jump.
- on the second row how it maps to the height.
So this way we have these
params to tweak:
-
min height-
max height-
time after the MC has taken off that can still boost the jump
-
ratio of importance of the preparation part of the jump versus the part where it is already on air.
I've been playing with those params and I think that this model is good enough to get a jump that
"feels good".