-
Notifications
You must be signed in to change notification settings - Fork 7
Hitboxes
Instructions and index page for hitbox Lua scripts
Although the sprites on screen seem to interact directly with one another, 2D fighting games and other action games usually use unseen hitboxes to determine whether attacks connect or miss. These boxes can be made visible in MAME-rr and FBA-rr through the use of [LuaScriptingFunctions]. This information can help players improve their game and help people who don't play the games to appreciate how they work.
Also see combovid for in-depth discussions.
Some game engines have specialized kinds of boxes, but here are the types that are found in most games.
https://raw.githubusercontent.com/TASVideos/mame-rr/master/pics/hitboxdemo.png
The attack box must touch the opponent's vulnerability for the attack to connect. Characters may have one or several vulnerability boxes for different areas of the sprite, but most fighting games only allow attacks to have one attack box at a time.
If an opposing projectile's attack touches a projectile vulnerability box, the projectiles negate one another. In some games, projectiles don't have designated vulnerability areas and negate by touching attack boxes.
A pushbox cannot occupy the same space as another pushbox. Attempting to press them together will cause characters to push one another. Jumping attacks that extend below and behind the pushbox allow for easier crossup attacks. Some moves cause pushboxes to disappear, allowing the character to pass through the opponent. In primitive games like Fatal Fury 1 & 2, vulnerability boxes also perform the function of pushboxes.
A throwbox must touch the opponent's throwable box for the throw attempt to succeed. Throws are generally active for only one frame. Some games don't have designated throwable boxes and reuse the pushbox for this purpose.
These scripts work with either parent and clone ROMs. Download the script file, load the appropriate ROM, launch a Lua window (ctrl-L by default), then browse for and run the .lua file. The ROM must be up to date for MAME-rr or FBA-rr, and may be out of date with respect to mainline MAME.
The current versions can be downloaded from the SVN repository. Changes are trackable on the update page or by subscribing to the update feed.
The behavior can be modified by pressing Lua hotkeys. (The key bindings are assigned in the emulator settings.)
- Hide or reveal all the graphics on the screen to show only the boxes. Default off.
- Hide or reveal axis markers for characters and other objects. Default on.
- Hide or reveal the centers of individual boxes. Default off.
- Hide or reveal pushboxes. Default on.
- Hide or reveal throwability boxes. Default off.
Both emulators can show boxes, but they differ in usability and accuracy.
MAME-rr advantages:
- doesn't crash so much on loading savestates or loading new ROMs
- doesn't demand so much CPU when displaying partially transparent boxes
- more powerful cheat engine means a more reliable background removal procedure
- no frame sync problems for CPS2 games
- can use debugger breakpoints for games on any system, but this requires extra effort in coding and usage
- much better performance for CPS3 games
- built-in Lua breakpoints for !NeoGeo, CPS1 and CPS2 systems
- This means only FBA can properly show throwboxes for the `sf2` and `cps2` scripts, and is required for the `garou` script.
The game backgrounds can make the boxes harder to see. This can be offset by increasing the fill opacity of the boxes, but this in turn makes the character sprites harder to see. The ideal solution is to remove the backgrounds entirely. One way to do this is with "cheat" codes that prevent the background and HUD from being displayed by the game.
https://raw.githubusercontent.com/TASVideos/mame-rr/master/pics/ssf2twithbg.png https://raw.githubusercontent.com/TASVideos/mame-rr/master/pics/ssf2tblackbg.png
Here is how to get the codes working in MAME:
- Download the latest official cheat pack.
- Extract cheat.zip from the downloaded archive to the base MAME folder.
- Run the ROM in MAME, find _Cheats_ from the main menu, and set the code to _On_.
- The codes for some games need to be activated before the start of the match to remove the HUD.
- The codes are designed to only affect the game while a match is in progress.
- The effects of some codes are not fully reversible.
- Most of the codes patch ROM data and will only work with parent sets, not clones.
- The background color for !NeoGeo games can be adjusted by editing the color value in the codes.
- It possible to convert codes for some, not all, games to work in FBA.
Screenshots or videos captured with the backgrounds removed can easily be processed to make the background color transparent. In order for this to work with hitboxes, the fill opacity must be set to zero and the border opacity should be maximum. A shortcut to do this is to set `no_alpha` in the `globals` at the top of the script to `true`.
local globals = { axis_color = 0xFFFFFFFF, blank_color = 0xFFFFFFFF, axis_size = 12, mini_axis_size = 2, blank_screen = false, draw_axis = true, draw_mini_axis = false, draw_pushboxes = true, draw_throwable_boxes = false, no_alpha = true, --fill = 0x00, outline = 0xFF for all box types }
Colors can be changed by editing the `box` values at the top of the script.
["vulnerability"] = {color = 0x7777FF, fill = 0x40, outline = 0xFF}, ["attack"] = {color = 0xFF0000, fill = 0x40, outline = 0xFF}, ["proj.] = {color = 0x00FFFF, fill = 0x40, outline = 0xFF}, ["proj.] = {color = 0xFF66FF, fill = 0x40, outline = 0xFF}, ["push"] = {color = 0x00FF00, fill = 0x20, outline = 0xFF}, ["throw"] = {color = 0xFFFF00, fill = 0x40, outline = 0xFF}, ["throwable"] = {color = 0xF0F0F0, fill = 0x20, outline = 0xFF},
The `color` numbers are RGB values, and the `fill` and `outline` determine the opacity of the inside and outside of the box. `0xFF` is fully opaque and `0x00` is invisible.
The default colors are subject to change in future versions.
All of the Street Fighter II games. ||Parent ROM||Game|| ||sf2||Street Fighter II: The World Warrior|| ||sf2ce||Street Fighter II': Champion Edition|| ||sf2hf||Street Fighter II': Hyper Fighting|| ||ssf2||Super Street Fighter II: The New Challengers|| ||ssf2t||Super Street Fighter II Turbo|| ||hsf2||Hyper Street Fighter 2: The Anniversary Edition||
https://raw.githubusercontent.com/TASVideos/mame-rr/master/pics/sf2sf2.png https://raw.githubusercontent.com/TASVideos/mame-rr/master/pics/sf2sf2ceuc.png https://raw.githubusercontent.com/TASVideos/mame-rr/master/pics/sf2sf2hf.png https://raw.githubusercontent.com/TASVideos/mame-rr/master/pics/sf2ssf2.png https://raw.githubusercontent.com/TASVideos/mame-rr/master/pics/sf2ssf2t.png https://raw.githubusercontent.com/TASVideos/mame-rr/master/pics/sf2hsf2.png
https://raw.githubusercontent.com/TASVideos/mame-rr/master/pics/colorssf2.png
Attacks that hit a weakbox deal double damage. Weak boxes only appear in _Street Fighter II: World Warrior_ and in WW mode of _Hyper Street Fighter 2_. They are colored the same as throwboxes by default.
This box is susceptible to air throws but not ground throws. The opposite is true for the normal throwable box.
All of the Marvel/Versus games on the CPS-2 system. ||Parent ROM||Game|| ||xmcota||X-Men: Children of the Atom|| ||msh||Marvel Super Heroes|| ||xmvsf||X-Men Vs. Street Fighter|| ||mshvsf||Marvel Super Heroes Vs. Street Fighter|| ||mvsc||Marvel Vs. Capcom: Clash of Super Heroes||
https://raw.githubusercontent.com/TASVideos/mame-rr/master/pics/marvelxmcota.png https://raw.githubusercontent.com/TASVideos/mame-rr/master/pics/marvelmsh.png https://raw.githubusercontent.com/TASVideos/mame-rr/master/pics/marvelxmvsf.png https://raw.githubusercontent.com/TASVideos/mame-rr/master/pics/marvelmshvsf.png https://raw.githubusercontent.com/TASVideos/mame-rr/master/pics/marvelmvsc.png
FBA is needed to show the exact frames when throws are active and when pushboxes are inactive. In MAME, only the potential throw range is viewable, and pushboxes tend to flicker or not disappear when inactive. However, boxes sometimes update a frame early or late in FBA.
https://raw.githubusercontent.com/TASVideos/mame-rr/master/pics/colorsmsh.png
It's possible to show where the box would appear if a throw were attempted. This box type is fully transparent (invisible) by default and can be shown by increasing its opacity value. This is unnecessary since FBA can show the real throw attempts.
All of the remaining CPS-2 fighting games, including the Street Fighter Alpha and Darkstalkers series. ||Parent ROM||Game|| ||sfa||Street Fighter Alpha: Warriors' Dreams|| ||sfa2||Street Fighter Alpha 2|| ||sfz2al||Street Fighter Zero 2 Alpha|| ||sfa3||Street Fighter Alpha 3|| ||dstlk||Darkstalkers: The Night Warriors|| ||nwarr||Night Warriors: Darkstalkers' Revenge|| ||vsav||Vampire Savior: The Lord of Vampire|| ||vhunt2||Vampire Hunter 2: Darkstalkers Revenge|| ||vsav2||Vampire Savior 2: The Lord of Vampire|| ||ringdest||Ring of Destruction: Slammasters II|| ||cybots||Cyberbots: Fullmetal Madness|| ||sgemf||Super Gem Fighter Mini Mix||
https://raw.githubusercontent.com/TASVideos/mame-rr/master/pics/cps2sfa.png https://raw.githubusercontent.com/TASVideos/mame-rr/master/pics/cps2sfa2.png https://raw.githubusercontent.com/TASVideos/mame-rr/master/pics/cps2sfz2al.png https://raw.githubusercontent.com/TASVideos/mame-rr/master/pics/cps2sfa3.png https://raw.githubusercontent.com/TASVideos/mame-rr/master/pics/cps2dstlk.png https://raw.githubusercontent.com/TASVideos/mame-rr/master/pics/cps2nwarr.png https://raw.githubusercontent.com/TASVideos/mame-rr/master/pics/cps2vsav.png https://raw.githubusercontent.com/TASVideos/mame-rr/master/pics/cps2vhunt2.png https://raw.githubusercontent.com/TASVideos/mame-rr/master/pics/cps2vsav2.png https://raw.githubusercontent.com/TASVideos/mame-rr/master/pics/cps2ringdest.png https://raw.githubusercontent.com/TASVideos/mame-rr/master/pics/cps2cybots.png https://raw.githubusercontent.com/TASVideos/mame-rr/master/pics/cps2sgemf.png
FBA is required to show all throws in: sfa, sfa2, sfz2al, vsav, vhunt2, vsav2, cybots, and sgemf. It is also needed in dstlk and nwarr to show air throws and to make ground throws be attempted at long range. However, boxes sometimes update a frame early or late in FBA.
https://raw.githubusercontent.com/TASVideos/mame-rr/master/pics/colorssfa2.png
Air throws in sfa, sfa2 & sfz2al, and special ranged throws in nwarr grab at the opponent's axis instead of a box.
Selected beat-em-up games on the CPS-2 system. ||Parent ROM||Game|| ||ffight||Final Fight|| ||dino||Cadillacs and Dinosaurs|| ||punisher||The Punisher|| ||avsp||Alien vs. Predator|| ||ddtod||Dungeons & Dragons: Tower of Doom|| ||ddsom||Dungeons & Dragons: Shadow over Mystara|| ||batcir||Battle Circuit||
https://raw.githubusercontent.com/TASVideos/mame-rr/master/pics/beatemupffight.png https://raw.githubusercontent.com/TASVideos/mame-rr/master/pics/beatemupdino.png https://raw.githubusercontent.com/TASVideos/mame-rr/master/pics/beatemuppunisher.png https://raw.githubusercontent.com/TASVideos/mame-rr/master/pics/beatemupavsp.png https://raw.githubusercontent.com/TASVideos/mame-rr/master/pics/beatemupddtod.png https://raw.githubusercontent.com/TASVideos/mame-rr/master/pics/beatemupddsom.png https://raw.githubusercontent.com/TASVideos/mame-rr/master/pics/beatemupbatcir.png
Non-character objects are colored as projectiles. Pushboxes are not used.
Most of the King of Fighters games on the !NeoGeo MVS system. ||Parent ROM||Game|| ||kof94||The King of Fighters '94|| ||kof95||The King of Fighters '95|| ||kof96||The King of Fighters '96|| ||kof97||The King of Fighters '97|| ||kof98||The King of Fighters '98 - The Slugfest|| ||kof99||The King of Fighters '99 - Millennium Battle|| ||kof2000||The King of Fighters 2000|| ||kof2001||The King of Fighters 2001|| ||kof2002||The King of Fighters 2002||
https://raw.githubusercontent.com/TASVideos/mame-rr/master/pics/neogeokof94.png https://raw.githubusercontent.com/TASVideos/mame-rr/master/pics/neogeokof95.png https://raw.githubusercontent.com/TASVideos/mame-rr/master/pics/neogeokof96.png https://raw.githubusercontent.com/TASVideos/mame-rr/master/pics/neogeokof97.png https://raw.githubusercontent.com/TASVideos/mame-rr/master/pics/neogeokof98.png https://raw.githubusercontent.com/TASVideos/mame-rr/master/pics/neogeokof99a.png https://raw.githubusercontent.com/TASVideos/mame-rr/master/pics/neogeokof2000.png https://raw.githubusercontent.com/TASVideos/mame-rr/master/pics/neogeokof2001.png https://raw.githubusercontent.com/TASVideos/mame-rr/master/pics/neogeokof2002.png
All throwboxes in !NeoGeo games show up one frame late. Not enough frames pass between the box computations and the graphics update to correct this.
FBA is needed to show throwboxes in `kof94` and `kof95`. The the only `axis throw` boxes for this script are the special throws in those two games.
https://raw.githubusercontent.com/TASVideos/mame-rr/master/pics/colorskof98.png
Attacks that hit a guardbox will be blocked, either by manually blocking, by an autoguard move, or by a special counter move.
The Garou Densetsu/Fatal Fury !NeoGeo series. ||Parent ROM||Game|| ||fatfury1||Fatal Fury - King of Fighters|| ||fatfury2||Fatal Fury 2|| ||fatfursp||Fatal Fury Special|| ||fatfury3||Fatal Fury 3 - Road to the Final Victory|| ||rbff1||Real Bout Fatal Fury|| ||rbffspec||Real Bout Fatal Fury Special|| ||rbff2||Real Bout Fatal Fury 2 - The Newcomers|| ||garou||Garou - Mark of the Wolves||
https://raw.githubusercontent.com/TASVideos/mame-rr/master/pics/neogeofatfury1.png https://raw.githubusercontent.com/TASVideos/mame-rr/master/pics/garoufatfury2.png https://raw.githubusercontent.com/TASVideos/mame-rr/master/pics/neogeofatfursa.png https://raw.githubusercontent.com/TASVideos/mame-rr/master/pics/neogeofatfury3.png https://raw.githubusercontent.com/TASVideos/mame-rr/master/pics/neogeorbff1.png https://raw.githubusercontent.com/TASVideos/mame-rr/master/pics/garourbffspec.png https://raw.githubusercontent.com/TASVideos/mame-rr/master/pics/garourbff2.png https://raw.githubusercontent.com/TASVideos/mame-rr/master/pics/garougarou.png
This script mostly doesn't work MAME due to extensive use of breakpoints. FBA is required.
The backgrounds can be removed using the script itself by setting `no_background` in the `globals` section to `true`. This must be done before the match start to work.
https://raw.githubusercontent.com/TASVideos/mame-rr/master/pics/colorsrbff2.png
There are no throwability or projectile vulnerability boxes.
The CPS3 games, excluding the Jojo titles. ||redearth||Red Earth|| ||sfiii||Street Fighter III: New Generation|| ||sfiii2||Street Fighter III 2nd Impact: Giant Attack|| ||sfiii3||Street Fighter III 3rd Strike: Fight for the Future||
https://raw.githubusercontent.com/TASVideos/mame-rr/master/pics/cps3redearth.png https://raw.githubusercontent.com/TASVideos/mame-rr/master/pics/cps3sfiii3.png
This script was originally translated to Lua from the mameserver project. The 3rd Strike code was also helped by the work of crystal cube
For now, the only way to show normal throwboxes in redearth/warzard is with the MAME-rr debugger. Run MAME from the command line with the `-debug` switch:
> mame redearth -debug -lua cps3-hitboxes.lua
Or to avoid using the command line, edit mame-rr.ini so that `debug` is `1`:
- CORE DEBUGGING OPTIONS
The debugger starts by halting execution of the game and the UI. Press F5 to release control. The script will print the BPs to the Lua console:
https://raw.githubusercontent.com/TASVideos/mame-rr/master/pics/consoleluabp.png
Copy and paste the line over to the debugger console and hit enter. Now all supported box types will appear correctly.
https://raw.githubusercontent.com/TASVideos/mame-rr/master/pics/consoledebuggerbpcrop.png
The game may glitch up when the command is entered but this only happens once. Before quitting or unloading the ROM, enter `bpc` into the debugger console to clear any installed breaks, or else MAME will crash.