Pages

Monday, May 13, 2013

Third Meeting - Designing Player Movement

For our third meeting, we sat down with the goal to design and program the player movement.  We completed this task in 4.5 hours.

Player Scale

Chris started the meeting by whiteboarding the size of the character and the jump-height relative to the screen.

Player Movements

Chris then described the following movement states for the character:
  • Idle
  • Walk
  • Jump
  • Double Jump
  • Attack (Ground)
  • Attack (Air)

Player Attacks

When the player attacks on the ground, they are frozen in place while an animation plays out, creating a hit box in front of the player in that duration.

When the player attacks in the air, they go into a dive sequence.  At the beginning of this sequence, the player is given a slight upward impulse, then is given a downward acceleration faster than gravity.  The sequence naturally ends when the player hits the ground.  But the dive can be canceled by hitting attack, allowing for a double jump or another attack.  Attacks can be chained through activation/canceling for versatile air movement.

Player State Transitions

We needed to know exactly how the player will transition between these movements.  So we created a state diagram with the following states and their respective possible transitions to other states.
  • Idle State
    • (left or right keys) > Walk State
    • (jump key) >  Single Jump State
    • (attack key) > Ground Attack State
    • (floor vanishes) > Single Jump State
  • Walk State
    • (left and right keys released) > Idle State
    • (attack key) > Ground Attack State
    • (jump key) > Single Jump State
    • (walk off cliff) > Single Jump State
  • Ground Attack State
    • (attack completed) > Idle State
    • (floor vanishes) > Single Jump State
  • Single Jump State
    • (standing) > Idle State
    • (jump key) > Double Jump State
    • (attack key) > Single Jump Dive State
  • Double Jump State
    • (standing) > Idle State
    • (attack key) > Double Jump Dive State
  • Single Jump Dive State
    • (jump key) > Double Jump State
    • (standing) > Idle State
    • (attack key) > Single Jump State
  • Double Jump Dive State
    • (standing) > Idle State
    • (attack key) > Double Jump State

Starting with the "JumpNRun" example

The ImpactJS engine comes with a simple "JumpNRun" example project, which is a simplified version of Biolab Disaster (closed source).  We decided to implement our state machine on top of the JumpNRun code base for testing and to dump the important parts into our own project later.

The current "player" entity in this project has no existing state machine and has the following physics:
  • Fixed jump height (set velocity at jump)
  • Constant ground and air acceleration
  • Movement friction
  • Max horizontal and vertical velocities

Modifying the Jump

In standard platformers, you can jump higher as you hold the jump key and stop jumping by releasing the jump key.  This was the first modification we made to the jump behavior.



(animated gif)

We also wanted it to be easy to change horizontal direction while in the air.

(animated gif)

Adding Double J

(to be continued)

No comments:

Post a Comment