Skip to content
neomorrisonPublic

About

Bhop: a free browser bunny hop game on faithful Source-engine movement. Hand-strafed, no auto-strafe, no speed multipliers, 128 Hz fixed timestep. Built with three.js.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bhop_ascent

A bunny hop game in the browser, on faithful Source-engine movement.

No auto-strafe, no speed multipliers, no assists. You get 250 u/s for free,
and every unit above that you take by hand, one 128 Hz tick at a time.

Play it →  ·  How it works  ·  The map  ·  Controls  ·  Run locally

Live demo License: MIT three.js JavaScript Tick rate Stars


bhop_ascent start screen explaining how strafing works and the controls

Why

Most browser bhop games fake it: auto-strafe, speed multipliers, or physics that only look like Source. That makes them easy and teaches nothing that carries over. bhop_ascent ports the actual Source movement code path, so the skill is the real one: strafe with the mouse, hit the landing tick, and the speed is yours.

Features

  • Source movement, by hand. Air acceleration with the 30 u/s wish-speed cap, friction and ground acceleration in Source's FullWalkMove order.
  • Fixed 128 Hz timestep. A 60 Hz monitor and a 240 Hz monitor gain exactly the same speed. Rendering interpolates between ticks.
  • Five timed stages. IGNITION, ASCENT, ZIGZAG, THE VOID and THE NEEDLE, spiralling about 1,700 units above the start line.
  • Checkpoints that cost time, not the run. Falling sends you back to the last checkpoint and the clock keeps going.
  • Strafe sync and key display. See how much of the available gain your ticks actually took. Readouts only, never input.
  • Optional auto-hop. Timing only: it re-jumps on the tick you land and never touches direction or speed.
  • Splits and personal bests, saved in your browser.
  • No assets to download. Geometry is built in code and sound is synthesised.

How it works

The whole game is one rule, taken from CGameMovement::AirAccelerate:

const wishspd = Math.min(wishspeed, 30);        // the entire skill ceiling
const currentspeed = vel.x * wx + vel.z * wz;
const addspeed = wishspd - currentspeed;
if (addspeed <= 0) return;                      // already faster than 30 that way: nothing

In the air, the speed you may aim for along the direction you hold is clamped to 30 u/s, but the rate you accelerate toward it is not. Once you move forward faster than 30 u/s, holding W does nothing. The only way to add speed is to point the wish vector nearly sideways of your velocity and keep rotating it with the mouse: hold A and swing left, or D and swing right, for the whole jump, then flip on the next.

The per-tick ceiling is sqrt(v² + 30²) − v, so gains shrink as you get faster. test/movement.test.mjs measures it:

8 hand-strafed hops:   250 -> 825 u/s   [343, 428, 507, 580, 648, 712, 771, 825]
8 hops holding only W: 250 -> 250 u/s

Everything else follows from Source's order of operations: half gravity, jump, friction, accelerate, move, categorise, half gravity. The jump happens before friction, which is why a frame-perfect hop keeps every unit of speed and touching down for one tick without jumping costs about 4%.

Why a fixed timestep. Air acceleration is a per-tick sum, so at a variable frame rate a fast monitor would strafe measurably faster than a slow one. The simulation runs at a hard 1/128 s with an accumulator, and each frame's mouse movement is split evenly across the ticks it drives.

The map is checked, not eyeballed. In a hop chain you take off from wherever you landed, so the real constraint is the centre-to-centre pitch between pads, not the visible gap. test/map.test.mjs computes the speed each of the 117 pads demands and fails if the difficulty curve spikes, a rise exceeds what a jump can reach, or a landing gets narrower than the player hull.

A bot proves it is completable. test/bot.test.mjs drops a scripted player on the start line with nothing a human lacks: strafe keys, a jump and a yaw it turns at a bounded rate. Before each hop it tries candidate strafes on a copy of the physics body and takes the one that lands furthest. It finishes all five stages.

The map

Stage What it asks for Speed you need to hold
IGNITION find the rhythm 387 u/s
ASCENT every pad higher than the last; climbing costs airtime 483 u/s
ZIGZAG pads thrown side to side, flip the strafe every hop 506 u/s
THE VOID pitches past 400, plus a jump pad that only buys height 602 u/s
THE NEEDLE 96-unit beams: the gaps ease off, the landings do not 605 u/s

Every checkpoint is followed by a graded run-up, so a fall is recoverable.

Controls

Key Action
W A S D / mouse Move / look
Space, mouse wheel or LMB Jump
Ctrl or C Duck
R Restart run
Q Back to checkpoint
Tab Records
Esc Settings
F1 Auto-hop
F2 / F3 Key display / sync display
M Mute

Run locally

Plain ES modules, no install and no build. Serve over HTTP, since modules do not load from file://.

git clone https://github.com/neomorrison/bhop.git
cd bhop
python3 -m http.server 8000     # then open http://localhost:8000/

Tests run in Node with no dependencies:

node test/movement.test.mjs                          # the movement model
node --import ./test/register.mjs test/map.test.mjs  # every gap on the course
node --import ./test/register.mjs test/bot.test.mjs  # a scripted player runs it end to end

Project structure

index.html      HUD, panels, styles, import map, module entry
src/
  config.js     movement CVars and user settings
  physics.js    collision volumes and Source PlayerMove. No three.js, no DOM
  world.js      builders that emit the mesh and the matching collider
  map.js        bhop_ascent and the route-demand analysis the map test checks
  player.js     body and camera (the camera reads the body, never writes it)
  input.js      keyboard, mouse, pointer lock, per-tick mouse distribution
  timer.js      run state, splits, personal bests
  hud.js        speedometer, clock, key display, sync meter, results
  main.js       fixed-timestep loop, triggers, menus
test/           movement, map feasibility and full bot run

Contributing

Issues and pull requests are welcome. Good first ideas:

  • a second map built with the builders in src/world.js, checked by the same map test
  • a replay ghost of your personal best (the surf project has one to borrow from)
  • a speedometer graph of the last run on the results screen
  • more bot strategies in test/bot.test.mjs

If bhop_ascent taught you to strafe, a ⭐ helps other people find it.

Disclaimer

An independent project, not affiliated with or endorsed by Valve. The movement reproduces the Source-engine model (friction, ground acceleration and the 30 u/s air wish-speed cap) from public documentation. All geometry, art and code are original and no Valve assets are used. The renderer and module skeleton are adapted from hvh.

License

MIT

About

Bhop: a free browser bunny hop game on faithful Source-engine movement. Hand-strafed, no auto-strafe, no speed multipliers, 128 Hz fixed timestep. Built with three.js.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages