Log inGet started
World

EMBERLINE

Branchmain
Branchesmain
Commite3b1d97d67

README.md

emberline.fight

The fight itself, on a fixed 60 Hz step.

Bus.services.fight is registered from this module: start(opts), stop(), update(dt), isRunning(), session(), phase(), forceRoundEnd(side).

What one step does

  1. Sample both controllers (emberline.input) — facing-relative, so "back" is always away from the opponent.
  2. Run each fighter's state machine over the names in Rules.STATES.
  3. Push the bodies apart, then hold both inside the frame the camera can show.
  4. Resolve every live hitbox against the other fighter's hurtbox.
  5. Step projectiles.
  6. Advance the round clock, and end the round on a KO or on time.

Visuals are applied once per rendered frame, not once per fixed step: the fighter's state picks a clip name, the clip index from the sheet picks a frame, and setActiveFrame is only called when the frame actually changes.

The rules that make it a fighting game

  • A block is a direction. Holding away blocks; the stance decides what it stops (Rules.BLOCK_TABLE). A crouching block eats an overhead and a standing block eats a low.
  • A throw is unblockable and loses to a jump or to anything that is not standing still blocking.
  • onBlock is enforced. Blockstun is set so the defender leaves stun exactly onBlock frames relative to the attacker leaving recovery, so a blocked heavy really is punishable and a blocked light really is not.
  • Hitstop freezes both fighters on connect, and input keeps buffering through it, which is what makes a cancel land on the frame you pressed it.
  • Damage scales down a combo through Rules.COMBO_SCALING.
  • pushback and jumpArc are distances, not per-frame speeds.

Where the numbers come from

Bus.registry.fighters[id] (the roster) and Bus.registry.art[id] (the sheets) win wherever they exist. emberline.fight.defaults answers where they do not, with a complete FighterDef for every slot in Rules.MOVE_SLOTS and a full sheet covering every name in Rules.CLIPS, so the fight is playable on its own.

Events

Emits fight.roundStart fight.roundEnd fight.matchEnd fight.hit fight.block fight.throwLand fight.superStart fight.ko fight.jump fight.land fight.dash fight.stateChanged fight.meterFull, with the payload shapes documented in emberline.bus.