Facts
Released
2018
Genre
Platformer
Platforms
Windows, macOS, Linux, Nintendo Switch, PlayStation 4, Xbox One
Developer
Maddy Makes Games
Engine
Monocle (C#, on XNA / FNA / MonoGame)
Series
Celeste
Code
Source release by Maddy Thorson and Noel Berry
Evidence
Code (10)
Developer (1)
Dev blog (1)
Sources
3
On this page
  1. Jumping
  2. Related
  3. Mechanics
  4. References
  5. Sources

Maddy Thorson and Noel Berry released Celeste’s player class under the MIT license, “as a learning resource and for general interest”. The release includes the built-in C# port of Celeste Classic. The license excludes the game and its assets.

All of Madeline’s movement sits in one file, Player.cs, which the developers call a conscious choice to keep its order of operations readable1. The release omits the engine classes it calls (Actor, Engine, and Calc). Some details below rest instead on the public Monocle source and Thorson’s physics write-up.

#Jumping

A jump sets the vertical speed to -105 px/s2,3. For variable jump height, holding jump keeps that speed for up to 0.2 s4,5, then halves gravity near the apex6.

Gravity is 900 px/s²7, with a normal fall limit of 160 px/s8. Units are pixels per second, multiplied by the time step of each update9. Positions are whole pixels, with the fraction kept in a subpixel remainder10.

Coyote time, the grace window after leaving a ledge, is 0.1 s11,12.

Mechanics

MechanicKindHow
Variable jump heightHold timerspeed held for a timer, plus half gravity near the apex
Coyote timeGrace timerJumpGraceTime, a float timer of about 5 or 6 frames
JumpOne speedevery jump takes off at the same speed
Air controlDampedsteering takes 0.65 of the ground's rates, and released, Madeline's speed falls toward 0
GravityLighter while heldone gravity, halved near the apex while jump is held
RunningMomentumone rate to speed up, turn, and stop
Every claim about this game, by concept (41)
generalThe developers chose one large file of long methods for the player's behavior, so its tightly ordered logic reads in sequence.Developer
Air controlIn the air both running rates are multiplied by an air multiplier, 0.65, so steering, stopping, and turning take 650 px/s², and slowing from above the cap 260 px/s².Code
Coyote timeThe jump grace time, Celeste's coyote time, is 0.1 s.Code
Grounded updates refill the jump grace timer; airborne ones subtract the update's time step before the normal state's update, which jumps on a press while it is above zero.Code
At normal speed, Celeste's time step per update is most likely (float)0.0166667 s, the XNA and FNA default 166,667-tick step, not an exact 1/60 s.Wiki
The 0.1 s grace and 0.2 s variable-jump timers end on float rounding: a 0.0166667 s step gives 5 and 11 updates, and an exact 1/60 s step gives 6 and 12.Code
Each update starts by looking for ground; while her vertical speed is 0 or more, Madeline is on the ground if her hitbox, moved 1 px down, overlaps a solid or a jump-through platform.Code
GravityCeleste's gravity is 900 px/s²; each airborne update moves vertical speed toward the fall limit by the gravity times a multiplier times the update's time step.Code
The normal limit on falling speed is 160 px/s; entering the normal state starts the current limit there and gravity approaches it.Code
Holding down while falling at the normal limit or faster raises the limit toward a fast limit (240 px/s) at 300 px/s²; otherwise it eases back.Code
In the public Monocle source, the approach function moves a value toward a target by at most a given step without overshooting.Code
Celeste's actors sit on whole pixels; the vertical move adds the float distance to a remainder, moves by its rounded value, and keeps the fraction.Dev blog
HitboxMadeline moves one pixel at a time and stops at the pixel before a solid, then the collision callback runs.Dev blog
When Madeline hits a solid sideways in the normal state, the horizontal collision handler zeroes her horizontal speed, unless, while she's dash-attacking, a dash block rebounds, bounces, or ignores her, or a dream block takes her in.Code
Madeline's hitbox is 8 px wide and 11 px tall, centered on her X with her position at its bottom; ducking shrinks it to 8 × 6 px.Code
When Madeline rises into a solid in the normal state, she is moved 1 px up and 1 to 4 px sideways to the first spot where her hitbox fits, keeping her speed. She tries leftward first unless she is moving right, then rightward unless she is moving left.Code
Madeline stands up from a duck only where her standing 8 × 11 px hitbox fits. Under a solid that's too low, releasing Down on the ground in the normal state, or starting to fall, leaves her ducked. On the ground in the normal state, if she is stopped, she slides at 50 px/s toward room within 4 px.Code
On stages with floating blocks, a frame-by-frame model of Madeline rising into solids, her ducking box, and the check for room to stand matches a statement-by-statement float32 simulation of the released code on every frame of random stages and input scripts.Code
JumpA normal jump sets Madeline's vertical speed to the jump speed, −105 px/s.Code
Jumping while ducked keeps Madeline's 8 × 6 px ducking hitbox until she is falling with room to stand, because the jump function leaves her ducking flag alone and only the falling check, which tests whether she has room to stand, clears it in the air.Code
The jump function adds a horizontal boost, 40 px/s, times the d-pad direction to Madeline's horizontal speed, after that update's running step, so a running jump leaves at 130 px/s.Code
On a landing in her normal state while not dash-attacking, the code zeroes Madeline's vertical speed and keeps her horizontal speed, unless her latest dash went down and to the side: then the landing multiplies her horizontal speed by 1.2 and makes her duck, once per dash. While dash-attacking, a landing on a dream block can send her into the dream dash first, before either speed changes. The landing update has already used the air rates, and the ground rates start on the next.Code
Simulating the code, a running jump leaves at 130 px/s and slows back to 90 px/s in 10 airborne updates with the d-pad held; a jump from a standstill with the d-pad held leaves at 56.67 px/s.Code
Simulating a hop steered back with Left, the landing update still changes Madeline's speed at the air rate, −10.83 px/s, and the next at the ground rate, −16.67 px/s.Code
RunningMadeline's top running speed is 90 px/s, and the same limit applies in the air.Code
Each update moves Madeline's horizontal speed toward 90 px/s times the d-pad direction by the run acceleration, 1000 px/s² on the ground, so the same rate speeds her up, turns her, and stops her.Code
Above 90 px/s with the d-pad held the same way, Madeline slows toward 90 px/s at a reduction rate of 400 px/s², instead of the full 1000.Code
Holding Down on the ground ducks Madeline; while ducked, her speed moves toward 0 at a duck friction of 500 px/s², whatever the d-pad holds.Code
While Madeline is in control and isn't climbing, picking something up, red-dashing, or in the squash after a red dash hits a solid, she faces whichever way the d-pad points, on the ground or in the air, updated at the start of each update before her speed changes.Code
Simulating the code, Madeline reaches 90 px/s from a standstill in 6 updates on the ground and 9 in the air, and needs 11 and 17 to turn from 90 to −90 px/s.Code
A frame-by-frame model of the player's update and its normal state on flat ground matches a statement-by-statement float32 simulation of the released code on every frame of 300 random input scripts, for both delta-time steps.Code
Variable jump heightThe jump function sets vertical speed to the jump speed plus any platform lift boost, saves it as the variable-jump speed, starts the variable-jump timer at the variable-jump time, and zeroes the grace timer.Code
The half-gravity threshold is 40 px/s, the vertical speed below which (in either direction) holding jump halves gravity.Code
Gravity halves while the absolute vertical speed is under the half-gravity threshold and jump is held (or auto-jump is on), so a held jump hangs at the top.Code
The variable-jump time, how long holding jump can keep the take-off speed, is 0.2 s.Code
While the variable-jump timer runs, holding jump keeps Madeline rising no slower than the speed saved at take-off, canceling gravity; releasing zeroes the timer and cuts no speed.Code
In each update, the player's update ticks both jump timers, the state machine runs the normal state's update (gravity, hold, and new jump), and then the vertical move applies the vertical speed times the time step.Code
Celeste's developers describe the game as locked to 60 updates per second, so the bundled PICO-8 port skips every second frame.Developer
Simulating the jump code (flat ground, no lift boost, a 0.0166667 s step) gives apexes of 7 px tapped and 27 px held, airtimes 15 and 39 updates; an exact 1/60 s step gives 29 px held in 40.Code
When Madeline rises into a solid in the normal state and no corner correction fits, her vertical speed is zeroed. The variable-jump timer is zeroed too, unless it still reads at least the variable-jump time less a ceiling grace, 0.2 − 0.05 s, which spares hits in the jump's first 0.05 s.Code
A ceiling hit spares the variable-jump timer on the jump's own update and the 2 after it with a 0.0166667 s step, and the 3 after it with an exact 1/60 s step. Three subtractions of the 1/60 s step leave the timer at exactly the float 0.15, which is not below the limit.Code

References

  1. ^DeveloperNoelFB/CelesteReadme.md 16
    How we know

    The developers chose one large file of long methods for the player's behavior, so its tightly ordered logic reads in sequence.

    In a platformer like Celeste, the player behavior code needs to be very tightly ordered and tuned, and this style of code was a conscious choice to fit the project and team.
    Source/Player/Readme.md#L16 · upstream ↗

    Claim page

  2. ^CodeNoelFB/CelestePlayer.cs 49
    How we know

    A normal jump sets Madeline's vertical speed to the jump speed, −105 px/s.

    49        private const float JumpSpeed = -105f;
    
    Source/Player/Player.cs line 49 at 1b0ce45 · upstream ↗

    Claim page

  3. ^CodeNoelFB/CelestePlayer.cs 1660–1673
    How we know

    The jump function sets vertical speed to the jump speed plus any platform lift boost, saves it as the variable-jump speed, starts the variable-jump timer at the variable-jump time, and zeroes the grace timer.

    1663            jumpGraceTimer = 0;
    1664            varJumpTimer = VarJumpTime;
    ⋮
    1671            Speed.Y = JumpSpeed;
    1672            Speed += LiftBoost;
    1673            varJumpSpeed = Speed.Y;
    
    Source/Player/Player.cs lines 1660–1673 at 1b0ce45 · upstream ↗

    Claim page

  4. ^CodeNoelFB/CelestePlayer.cs 51
    How we know

    The variable-jump time, how long holding jump can keep the take-off speed, is 0.2 s.

    51        private const float VarJumpTime = .2f;
    
    Source/Player/Player.cs line 51 at 1b0ce45 · upstream ↗

    Claim page

  5. ^CodeNoelFB/CelestePlayer.cs 2960–2966
    How we know

    While the variable-jump timer runs, holding jump keeps Madeline rising no slower than the speed saved at take-off, canceling gravity; releasing zeroes the timer and cuts no speed.

    2960                //Variable Jumping
    2961                if (varJumpTimer > 0)
    ⋮
    2963                    if (AutoJump || Input.Jump.Check)
    2964                        Speed.Y = Math.Min(Speed.Y, varJumpSpeed);
    2965                    else
    2966                        varJumpTimer = 0;
    
    Source/Player/Player.cs lines 2960–2966 at 1b0ce45 · upstream ↗

    Claim page

  6. ^CodeNoelFB/CelestePlayer.cs 2952
    How we know

    Gravity halves while the absolute vertical speed is under the half-gravity threshold and jump is held (or auto-jump is on), so a held jump hangs at the top.

    2952                    float mult = (Math.Abs(Speed.Y) < HalfGravThreshold && (Input.Jump.Check || AutoJump)) ? .5f : 1f;
    
    Source/Player/Player.cs line 2952 at 1b0ce45 · upstream ↗

    Claim page

  7. ^CodeNoelFB/CelestePlayer.cs 24, 2957
    How we know

    Celeste's gravity is 900 px/s²; each airborne update moves vertical speed toward the fall limit by the gravity times a multiplier times the update's time step.

    24        private const float Gravity = 900f;
    
    Source/Player/Player.cs line 24 at 1b0ce45 · upstream ↗
    2957                    Speed.Y = Calc.Approach(Speed.Y, max, Gravity * mult * Engine.DeltaTime);
    
    Source/Player/Player.cs line 2957 at 1b0ce45 · upstream ↗

    Claim page

  8. ^CodeNoelFB/CelestePlayer.cs 23, 2760–2763
    How we know

    The normal limit on falling speed is 160 px/s; entering the normal state starts the current limit there and gravity approaches it.

    23        public const float MaxFall = 160f;
    
    Source/Player/Player.cs line 23 at 1b0ce45 · upstream ↗
    2762            maxFall = MaxFall;
    
    Source/Player/Player.cs lines 2760–2763 at 1b0ce45 · upstream ↗

    Claim page

  9. ^CodeNoelFB/Celeste · JamesMcMahon/monocle-enginePlayer.cs 742–744, 908, 934–935, 322–323; Entity.cs 95–98
    How we know

    In each update, the player's update ticks both jump timers, the state machine runs the normal state's update (gravity, hold, and new jump), and then the vertical move applies the vertical speed times the time step.

    742                //Var Jump
    743                if (varJumpTimer > 0)
    744                    varJumpTimer -= Engine.DeltaTime;
    
    Source/Player/Player.cs lines 742–744 at 1b0ce45 · upstream ↗
    908            base.Update();
    
    Source/Player/Player.cs line 908 at 1b0ce45 · upstream ↗
    935                MoveV(Speed.Y * Engine.DeltaTime, onCollideV);
    
    Source/Player/Player.cs lines 934–935 at 1b0ce45 · upstream ↗

    2 more excerpts on the claim page

  10. ^Dev blogThorson 2020 · NoelFB/CelestePlayer.cs 935
    How we know

    Celeste's actors sit on whole pixels; the vertical move adds the float distance to a remainder, moves by its rounded value, and keeps the fraction.

    xRemainder += amount; int move = Round(xRemainder); if (move != 0) { xRemainder -= move;
    Actor Basics · archived copy ↗
    935                MoveV(Speed.Y * Engine.DeltaTime, onCollideV);
    
    Source/Player/Player.cs line 935 at 1b0ce45 · upstream ↗

    Claim page

  11. ^CodeNoelFB/CelestePlayer.cs 48
    How we know

    The jump grace time, Celeste's coyote time, is 0.1 s.

    48        private const float JumpGraceTime = 0.1f;
    
    Source/Player/Player.cs line 48 at 1b0ce45 · upstream ↗

    Claim page

  12. ^CodeNoelFB/CelestePlayer.cs 713–720, 2970–2975
    How we know

    Grounded updates refill the jump grace timer; airborne ones subtract the update's time step before the normal state's update, which jumps on a press while it is above zero.

    713                //Jump Grace
    714                if (onGround)
    ⋮
    717                    jumpGraceTimer = JumpGraceTime;
    ⋮
    719                else if (jumpGraceTimer > 0)
    720                    jumpGraceTimer -= Engine.DeltaTime;
    
    Source/Player/Player.cs lines 713–720 at 1b0ce45 · upstream ↗
    2970                if (Input.Jump.Pressed)
    ⋮
    2973                    if (jumpGraceTimer > 0)
    ⋮
    2975                        Jump();
    
    Source/Player/Player.cs lines 2970–2975 at 1b0ce45 · upstream ↗

    Claim page

Sources

Code

Primary