Post subject: Super Mario Bros. 1 Hitboxes Exposed
Joined: 4/25/2004
Posts: 615
Location: The Netherlands
It seems to me there's hardly any information about hitboxes. Time to clear that up. I've downloaded the current SMB run and hooked up a script to show hitboxes. And no, that's not wrong, that's simply how they work. It becomes somewhat more obvious with moving platforms, which have a hitbox underneath as well (and you only stand on them when your hitbox lies on them). Bowser fireballs have a tiny hitbox and the hammers from bowser or hammer bros hardly show any hitboxes (but they have them, my script simply isn't taking them into account since it only tracks enemies). Occasionally you also see a hitbox for fireballs and powerups. Not sure why that's so sporadic, but whatever. Fun fact: there's a piranha at the entrance pipe of the water level in castle 8.4. The enemy is invisible but will kill you. The hitbox clearly shows up in the movie :0 Youtube: http://youtube.com/watch?v=eDaYK1cOCmw Lua Script v1: http://lua.pastey.net/92636 Lua Script v2: http://lua.pastey.net/92707 (shows hammers and coins!) You can check for yourself, nowhere in the run do the green hitboxes collide, unless the game shows they did (always one frame after they collide). Can you believe how close those calls were in 8.3 and 8.4? PS. if anyone objects to using this run as an example I'll take it off and create some random walking. This just seemed like a better example as it shows the entire game.
qfox.nl
Experienced player (699)
Joined: 2/19/2006
Posts: 742
Location: Quincy, MA
tested on consolle: yes, you can get killed by the invisible pirahna plant in the water area of 8-4. Interestingly, that has never happened to me during a normal gameplay. Also, I would like to see what the hammer's hitboxes look like. It might make it easier for my speedruns.
Super Mario Bros. console speedrunner - Andrew Gardikis
Player (147)
Joined: 11/27/2004
Posts: 688
Location: WA State, USA
I can't think of any good reason for all of the green hitboxes to be low than the actual sprites.
Nach wrote:
I also used to wake up every morning, open my curtains, and see the twin towers. And then one day, wasn't able to anymore, I'll never forget that.
Joined: 4/25/2004
Posts: 615
Location: The Netherlands
I haven't investigated where those coordinates are stored, but I guess they're using more coordinate-addresses then regular enemies. Perhaps they use the same hitbox addresses as reserved for powerups and fireballs?
qfox.nl
Experienced player (699)
Joined: 2/19/2006
Posts: 742
Location: Quincy, MA
I bet they had some difficulty with getting the hitbox right on mario without messing up the "solid collision box" or something. possibly? haha... if you went down a pipe and there was an enemy in the air, where mario's hitbox travels, would you die?
Super Mario Bros. console speedrunner - Andrew Gardikis
Joined: 4/25/2004
Posts: 615
Location: The Netherlands
I doubt that. The green box coordinates are directly read from memory and plotted to screen. It's actually the solid hitbox that don't seem to have actual hitbox coordinates (although I'm still convinced I simply can't find them. Enemies should have these boxes as well...). As for the enemy hitbox being lower, yeah I don't know. It doesn't really matter whether they are as long as every object's offset is equal... Possibly it makes more sense elsewhere.
qfox.nl
Player (67)
Joined: 3/11/2004
Posts: 1058
Location: Reykjaví­k, Ísland
Interesting! (+1!)
Experienced player (699)
Joined: 2/19/2006
Posts: 742
Location: Quincy, MA
Yeah, can someone test to see if you can go down a pipe running at full speed and then get killed by an enemy because the hitbox kept traveling forward. The only case where I could see that occurring would be in a level with a lakitu. 4-1 would be a good candidate.
Super Mario Bros. console speedrunner - Andrew Gardikis
Joined: 4/25/2004
Posts: 615
Location: The Netherlands
I have a feeling that being in an uncontrollable state (there's a switch) also makes you invulnerable.
qfox.nl
Experienced player (699)
Joined: 2/19/2006
Posts: 742
Location: Quincy, MA
qFox wrote:
I have a feeling that being in an uncontrollable state (there's a switch) also makes you invulnerable.
oh really? hmmm... I also want to see what happens to the hitboxes when you obtain a star.
Super Mario Bros. console speedrunner - Andrew Gardikis
Joined: 2/1/2008
Posts: 347
andrewg wrote:
qFox wrote:
I have a feeling that being in an uncontrollable state (there's a switch) also makes you invulnerable.
oh really? hmmm... I also want to see what happens to the hitboxes when you obtain a star.
Since you kill enemies whenever you touch them while you have a star, I assume that the hitboxes still exist, but the program code just counts all of Mario's collisions with an enemy as killing the enemy.
<ccfreak2k> There is no 'ctrl' button on DeHackEd's computer. DeHackEd is always in control.
Post subject: Re: Super Mario Bross Hitboxes Exposed
upthorn
He/Him
Emulator Coder, Active player (388)
Joined: 3/24/2006
Posts: 1802
qFox wrote:
And no, that's not wrong, that's simply how they work. It becomes somewhat more obvious with moving platforms, which have a hitbox underneath as well (and you only stand on them when your hitbox lies on them).
the thing about this statement is that, you can be off by a small value, and as long as the amount of the error is consistent for all the boxes displayed, it will appear to behave correctly. Incidentally, this means that you could subtract say 8 pixels from the y component of all displayed hitboxes and have a display that is equally useful, but is not distracting in its placement of the boxes.
How fleeting are all human passions compared with the massive continuity of ducks.
Joined: 4/25/2004
Posts: 615
Location: The Netherlands
Sure, except that the hitbox for the moving platform would no longer make sense. I think. But you are right, the offset is not important. This is just how they are found in memory... I doubt _they_ are subtracting 8 pixels before putting them there :)
qfox.nl
upthorn
He/Him
Emulator Coder, Active player (388)
Joined: 3/24/2006
Posts: 1802
qFox wrote:
Sure, except that the hitbox for the moving platform would no longer make sense. I think. But you are right, the offset is not important. This is just how they are found in memory... I doubt _they_ are subtracting 8 pixels before putting them there :)
my point is that there's no assurance that the hitboxes use the same coordinates that the camera uses, and if the difference is constant, it might be better to align the two.
How fleeting are all human passions compared with the massive continuity of ducks.
Joined: 4/25/2004
Posts: 615
Location: The Netherlands
Ok. Ummm. Yeah. It seems that drawing on screen was not done with the precision I anticipated. To be more accurate, due to scanlines and NTSC and whatever... drawing was vertically off by 8 pixels :( I'm fixing stuff now.
qfox.nl
Post subject: Re: Super Mario Bross Hitboxes Exposed
Former player
Joined: 12/5/2007
Posts: 716
youtube.com wrote:
This is a private video. If you have been sent this video, please make sure you accept the sender's friend request.
:(
Post subject: Re: Super Mario Bross Hitboxes Exposed
Joined: 2/14/2005
Posts: 10
Location: Sweden
ShinyDoofy wrote:
youtube.com wrote:
This is a private video. If you have been sent this video, please make sure you accept the sender's friend request.
:(
I get the same problem.
!ERAU QSSI DLRO WEHT
upthorn
He/Him
Emulator Coder, Active player (388)
Joined: 3/24/2006
Posts: 1802
ShinyDoofy wrote:
youtube.com wrote:
This is a private video. If you have been sent this video, please make sure you accept the sender's friend request.
:(
I imagine i thas to do with
qFox wrote:
drawing was vertically off by 8 pixels :( I'm fixing stuff now.
How fleeting are all human passions compared with the massive continuity of ducks.
Joined: 4/25/2004
Posts: 615
Location: The Netherlands
Alright. New vid (I edited first post as well). http://youtube.com/watch?v=eDaYK1cOCmw The box might be off by one or two pixels, but if that is the case, they ALL are, so it doesn't really matter. I took real special care this time, I changed the script, it's now drawing EVERY hitbox the memory has. This includes 1 mario, 3 coins, 5 enemies, 2 (mario) fireballs, 1 (!) powerup and 9 hammers. (Bowser and (his) fireballs are considered regular enemies in this system). I also figured out the system of showing points (like when you hit an enemy) and the "explosion" of bricks, but I didn't draw those, because, well, who gives a damn :) It's a funny thing that you can have only one powerup. If you get the star in 1.1 and then open up the flower, the star disappears. But that's probably well known. So andrewg, there's your hammer hitboxes :p Have fun with them. I'm going to bed.
qfox.nl
Player (120)
Joined: 2/11/2007
Posts: 1522
I remember in a previous version that drawing to the screen lagged by one frame, so if it was based on memory values it would be one off. The way around it was to use guiregister to register the drawing function so that it would draw at the same time as the rest of the graphics. Just a thought :) Looks cool...
I make a comic with no image files and you should read it. While there is a lower class, I am in it, and while there is a criminal element I am of it, and while there is a soul in prison, I am not free. -Eugene Debs
Former player
Joined: 3/31/2005
Posts: 192
Location: Argentina
I have to wonder why the game uses hitboxes for coins that jump out of blocks, since they don't interact with anything at all. Oh, and there's also this: what's with the rotating fireball barriers having no hitboxes?
Editor, Active player (296)
Joined: 3/8/2004
Posts: 7469
Location: Arzareth
qFox wrote:
Alright. New vid (I edited first post as well).
Wow, the hammer hitboxes are really screwy.
Joined: 4/25/2004
Posts: 615
Location: The Netherlands
Well, it turns out there are only 9 hammer hitboxes. On top of that, they share hitboxes with coins and powerups too (although that's probably a pretty safe bet).
qfox.nl
Joined: 7/20/2004
Posts: 45
Bisqwit wrote:
Wow, the hammer hitboxes are really screwy.
Yeah, I noticed that too. That certainly explains why it's been mentioned before that the hammers have horrible collision detection. And just think, in all my years of cursing at the hammers for killing me, it really WASN'T my fault! :P I didn't think the pirahna's hitboxes would be that small though. That kind of surprised me.
Editor, Active player (296)
Joined: 3/8/2004
Posts: 7469
Location: Arzareth
Takarifreak wrote:
I didn't think the pirahna's hitboxes would be that small though. That kind of surprised me.
Kind of explains why we have been able to see in TASes Mario / Luigi dive straight into the mouth of a (descending) piranha plant and survive. Frame 1: Visual collision with the plant's hitbox, already down the plant's mouth Frame 2: Mario falls further down and hits the pipe trigger. Enemy collision trigger is superseded. (Didn't somebody mention that the ouch trigger is done only at the frame _after_ the collision?)