News:

Don't forget to visit the main site! There's lots of helpful docs, patches, and more!

Main Menu

Is there any way to find Samus' exact hit detection?

Started by Mayo-chan, March 19, 2015, 08:30:30 AM

Previous topic - Next topic

Mayo-chan

Hey guys, I'm trying to create an MZM engine with Multimedia Fusion, I've done it in the past to see how it works and it's more or less a hobby of mine.
https://www.youtube.com/watch?v=wWxNvHF6GtA

After speedrunning the game for a marathon and deciding on a whim to look at the old version of the Metroid engine I made last year, I've come to realize that the physics in this one are garbage. I've used frame tweening on an emulator to figure out the exact speeds Samus moves at, but I've made this thread to ask you guys, does any of you know the exact dimensions of Samus' hitbox when she is standing, crouching, spinjumping, ect., or at least how I can find them?

GF_Kennon

So I dont know much on this topic myself, but I did some digging and found PJBoy made a fusion hitbox lua script, I guess its for use in VBA, anyway, I did some more digging and someone made it work with Zero Mission


DisplaySamusBox = 1
DisplayProjectileBoxes = 1
DisplayEnemyBoxes = 1

while true do

local cameraX, cameraY = memory.readshort(0x30013B4), memory.readshort(0x30013B6)
-- these are the co-ordinates of the top-left of the screen measured in quarter pixels

if DisplayEnemyBoxes ~= 0 then
-- This function displays the hitbox of all the enemies in the room
for i=0,23 do
local originAddress = 0x30001AC + i*56;
if memory.readshort(originAddress) ~= 0 then
local enemyX, enemyY = memory.readshort(originAddress+4), memory.readshort(originAddress + 2) --0x30001B0
local topleft = {(enemyX + memory.readshortsigned(originAddress + 14) - cameraX)/4, (enemyY + memory.readshortsigned(originAddress + 10) - cameraY)/4}
local bottomright = {(enemyX + memory.readshortsigned(originAddress + 16) - cameraX)/4, (enemyY + memory.readshortsigned(originAddress + 12) - cameraY)/4}
gui.box(topleft[1], topleft[2], bottomright[1], bottomright[2], "clear", "#808080")
-- draw enemy hitbox
end
end
end


if DisplaySamusBox ~= 0 then
local samusX, samusY = memory.readshort(0x3001600), memory.readshort(0x3001602)
local armcannonX, armcannonY = (memory.readshort(0x3000BEE) - cameraX - 2)/4, (memory.readshort(0x3000BEC)-cameraY - 2)/4
local topleft = {(samusX + memory.readshortsigned(0x30015F6)- cameraX - 2)/4, (samusY + memory.readshortsigned(0x30015F8)- cameraY - 2)/4}
local bottomright = {(samusX - memory.readshortsigned(0x30015F6) - cameraX - 2)/4, (samusY - cameraY - 2)/4}
gui.box(topleft[1], topleft[2], bottomright[1], bottomright[2], "clear", "#80FFFF")
-- draw Samus' hitbox
gui.box(armcannonX-1, armcannonY-1, armcannonX+1, armcannonY+1, "green")
-- draw arm cannon point

local cooldown = memory.readbyte(0x3001418)
if cooldown ~= 0 then
gui.text(armcannonX-1, armcannonY-9, cooldown, "green")
end
-- show current cooldown time
end


-- show projectile hitboxes
if DisplayProjectileBoxes ~= 0 then
for i=0,15 do
local originAddress = 0x3000A2C + i*28;
if memory.readshort(originAddress) ~= 0 then
local projectileX, projectileY = memory.readshort(originAddress + 10), memory.readshort(originAddress + 8)
topleft = {(projectileX + memory.readshortsigned(originAddress + 24) - cameraX - 2)/4, (projectileY + memory.readshortsigned(originAddress + 20) - cameraY - 2)/4}
local bottomright = {(projectileX + memory.readshortsigned(originAddress + 26) - cameraX - 2)/4, (projectileY + memory.readshortsigned(originAddress + 22) - cameraY - 2)/4}
gui.box(topleft[1], topleft[2], bottomright[1], bottomright[2], "clear", "#FFFF80")
-- draw projectile hitbox
end
end
end
vba.frameadvance()
end


I would guess this shows Samus' hitbox

Sorry I cant help more, probably have to wait till someone who knows this stuff is around :P

Lunaria

That engine in showcase in that video is fairly damn impressive though. Funnily enough, I can tell the audio is inaccurate because the channels on the music does not get overwritten by the sound effects. :P

Also, once you got your questions answered, or right away if you'd like, feel free to make a thread in the Misc. Hack and Fangames forum about your project. Since frankly, it seems pretty darn cool~

Mayo-chan

#3
Thank you so much Kennon, sorry for posting this in the wrong board, as soon as the post was made I was like 'wait a minute, this is the wrong board for this' but I couldn't figure out how to delete this thread.

Edit: Holy crap this script is awesome and very useful! It shows a lot of very helpful information in how Zero Mission works!


GF_Kennon

No, this was the correct board to ask the question as it was a question to do with MZM, Lunaria is basically saying you should post a topic for this engine in the Fangames bit because its looking pretty awesome and you havent already :P, anyway glad I could help.