EMBERLINE
- ..
- .metadata17 B
- README.md2.3 KB
- defaults.module
- init.luau51.1 KB
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
- Sample both controllers (
emberline.input) — facing-relative, so "back" is always away from the opponent. - Run each fighter's state machine over the names in
Rules.STATES. - Push the bodies apart, then hold both inside the frame the camera can show.
- Resolve every live hitbox against the other fighter's hurtbox.
- Step projectiles.
- 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.
onBlockis enforced. Blockstun is set so the defender leaves stun exactlyonBlockframes 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. pushbackandjumpArcare 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.