Some questions about SNES collision

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
Some questions about SNES collision
by on (#185350)
Is SNES collision hardware based (I once heard a lot of old consoles/computers used collision stuff built into the hardware) or does every game implement it differently? Is AABB common or are different types of bounding boxes usually used? I'm mainly talking about platformers e.g. Super Mario World, Mega Man X, Super Metroid etc. and how is it that when I forcibly teleport a character into a wall they almost alwayts pop back out into the correct spot?
Re: Some questions about SNES collision
by on (#185352)
Software handles collision.

Feel free to disassemble / trace these games yourself. I'd love to know if there is differences.
Re: Some questions about SNES collision
by on (#185354)
I would really like to but 65816 is gibberish to me right now I can't imagine myself understanding a decent amount it anytime soon. Hopefully within the next 5 or 6 months if I'm lucky.
Re: Some questions about SNES collision
by on (#185358)
What kind of game do you want to make?

I really think us SNES 'newbs' should collaborate more.
Re: Some questions about SNES collision
by on (#185359)
dougeff wrote:
I really think us SNES 'newbs' should collaborate more.

Where do I stand? :lol:
Re: Some questions about SNES collision
by on (#185360)
dougeff wrote:
What kind of game do you want to make?

I really think us SNES 'newbs' should collaborate more.


My aim isn't to make a game (at least not yet) but to reverse engineer, understand, and hack Mega Man X.
Re: Some questions about SNES collision
by on (#185363)
Espozo wrote:
dougeff wrote:
I really think us SNES 'newbs' should collaborate more.

Where do I stand? :lol:

In a world of your own making :)
Re: Some questions about SNES collision
by on (#185366)
ittyBittyByte wrote:
My aim isn't to make a game (at least not yet) but to reverse engineer, understand, and hack Mega Man X.

Then your continual avoidance of 65816 will put an end to your aim/goal. You are going to have to learn assembly and put in the many, many hours reverse-engineering something to get an answer to all your questions. Not harping on you, just saying several of your posts look for "the easy way out", and there is no such way.
Re: Some questions about SNES collision
by on (#185393)
Have to agree with koitsu... If you want to understand the program, you're going to have to read it at some point. I know 65816 and SNES have a pretty steep learning curve off the start, largely because good resources on it are hard to find.

This might help, it's a full blown official manual on the 65816, but it's also massive. At the least you should be able to look up different opcodes and addressing modes and learn what exactly they do. I refer to this page a lot as a quick reference for details of each instruction. Mostly, which forms of each instruction exist (you can STZ using X as an index but not Y, for example) and which flags they affect.

The other main thing you'll need to understand to read SNES code once you have the 65816 instruction set down is the hardware registers. I've always referred to a very old text file I found somewhere around here for that. I don't know where to find it anymore so I've attached it here. If you see code reading/writing to addresses in the $2000s or $4000s, it's likely it's one of these registers. (But you have to be aware what bank you're currently in, as these registers only exist in banks $00 through $3F.)

This page gives you the entire memory map for the SNES, but it is understandably confusing at first glance. LoROM is the most common format I think, but I don't know if Megaman is.

As for how collision detection is done, this page might provide some basic insight on different approaches to it that some games have taken, including megaman. Might help give some idea how to find what you're looking for.

Hopefully that should help you get started. It's rough at first but once you begin to understand it's easy from there.
Re: Some questions about SNES collision
by on (#185408)
Khaz wrote:
... I've always referred to a very old text file I found somewhere around here for that. I don't know where to find it anymore so I've attached it here. ...

What you've attached is part of my old SNES documentation. The last release was in a file called sndoc230.lzh or sndoc230.zip, which you can find here. (I'm Y0SHi/Yoshi; I've changed monikers a couple times since then)

It's "sufficient" for basic learning, but does get many things wrong. You can refer to Anomie's docs, no$sns docs, the wiki you referenced, or official documentation (send me a PM) for the rest of the nitty-gritty.