Post subject: Ok. New mindset = new thread
Joined: 10/2/2015
Posts: 91
I've kinda missed the point so far as ti what this website is about. Now I want to fix that! I am working on a TAS. But to make it easier for me, how do I find a hitbox and display it with lua in bizhawk? Ram search I am fairly comfortable with, but so far I mostly have found basic stuff (ie. inputs, facing, lives). How can I go about finding the harder stuff like say, a group of ram values that make up a hitbox? And then, how does bizhawk differ from snes9x in lua?
I didn't kill donkey, I saved it. Current projects: Misc Donkey hacks :) Past projects: Pacifist DKC1 DKC1 Entrance randomizer DKC2 Entrance randomizer DKDC (a troll hack of DKC1) DKC1 Enemy randomizer (among other things)
Site Admin, Skilled player (1251)
Joined: 4/17/2010
Posts: 11475
Location: Lake Char­gogg­a­gogg­man­chaugg­a­gogg­chau­bun­a­gung­a­maugg
Warning: When making decisions, I try to collect as much data as possible before actually deciding. I try to abstract away and see the principles behind real world events and people's opinions. I try to generalize them and turn into something clear and reusable. I hate depending on unpredictable and having to make lottery guesses. Any problem can be solved by systems thinking and acting.
Amaraticando
It/Its
Editor, Player (159)
Joined: 1/10/2012
Posts: 673
Location: Brazil
Hitbox areas usually depend on a bunch of things, not only RAM values. You'll probably have to use ROM values and bitwise operations (on SNES). My best advice for now is to look at previous scripts and see how it works. I've seen scipts for Super Mario World, Donkey Kong 2 & 3 and Megaman. Different games might use different algorithms.
Joined: 10/2/2015
Posts: 91
oh god, there are rom values too?? o.o didn't even know. thanks for the advice!
I didn't kill donkey, I saved it. Current projects: Misc Donkey hacks :) Past projects: Pacifist DKC1 DKC1 Entrance randomizer DKC2 Entrance randomizer DKDC (a troll hack of DKC1) DKC1 Enemy randomizer (among other things)
Site Admin, Skilled player (1251)
Joined: 4/17/2010
Posts: 11475
Location: Lake Char­gogg­a­gogg­man­chaugg­a­gogg­chau­bun­a­gung­a­maugg
Sure, it's used all the time. The ROM contains tables of data, and they are read by an offset. That offset may be the only thing that's kept in RAM for some variables. It requires a bit of disasm, but lua can handle the rest just fine, as long as you know what to do. Have you read the article I linked?
Warning: When making decisions, I try to collect as much data as possible before actually deciding. I try to abstract away and see the principles behind real world events and people's opinions. I try to generalize them and turn into something clear and reusable. I hate depending on unpredictable and having to make lottery guesses. Any problem can be solved by systems thinking and acting.
creaothceann
He/Him
Editor
Joined: 4/7/2005
Posts: 1874
Location: Germany
RainbowSprinklez wrote:
oh god, there are rom values too??
Most of the memory in a video game system is in the cartridge (or CD/DVD/BD). ROM is accessed just like RAM.
Joined: 10/2/2015
Posts: 91
i did read the article. i would be lying if i said i completely understood. i downloaded fceux and smb to try and follow along, but i was lost at the Zero Page... $0000? What does $ refer to?
I didn't kill donkey, I saved it. Current projects: Misc Donkey hacks :) Past projects: Pacifist DKC1 DKC1 Entrance randomizer DKC2 Entrance randomizer DKDC (a troll hack of DKC1) DKC1 Enemy randomizer (among other things)
Invariel
He/Him
Editor, Site Developer, Player (171)
Joined: 8/11/2011
Posts: 539
Location: Toronto, Ontario
$xxxx means "memory address xxxx" $#xxxx means "the value xxxx"
I am still the wizard that did it. "On my business card, I am a corporate president. In my mind, I am a game developer. But in my heart, I am a gamer." -- Satoru Iwata <scrimpy> at least I now know where every map, energy and save room in this game is
Joined: 10/2/2015
Posts: 91
so, if i understand correctly, $1FF0 is the last of the zero pages in smb? What does the article mean by 'page'? "The third page is frequently used for sprite data, you can notice that by the specific nature of how they values change." edit: is every 1k a new page?
I didn't kill donkey, I saved it. Current projects: Misc Donkey hacks :) Past projects: Pacifist DKC1 DKC1 Entrance randomizer DKC2 Entrance randomizer DKDC (a troll hack of DKC1) DKC1 Enemy randomizer (among other things)
creaothceann
He/Him
Editor
Joined: 4/7/2005
Posts: 1874
Location: Germany
A page is 256 bytes. Zero page is special because you save one byte in the instruction stream. See https://www.youtube.com/watch?v=fWqBmmPQP40 at ca. 06:50.
Player (80)
Joined: 8/5/2007
Posts: 865
creaothceann wrote:
A page is 256 bytes. Zero page is special because you save one byte in the instruction stream. See https://www.youtube.com/watch?v=fWqBmmPQP40 at ca. 06:50.
This is correct, although I'd like to emphasize that you are unlikely to use this information early in your studies of TASing and/or reverse engineering games. Once you start working in assembly language, which could be anywhere from weeks to years from now (or never), zero page addressing becomes significant. Even then, it remains mostly of academic importance, except to say that the addresses in that range are the most frequently called upon in the game's code. For now, I would focus on the basics of RAM searching/watching and not get bogged down in ROM structure (which I still understand relatively poorly). Nevertheless, if you have any questions on anything from basic to advanced, other users and I will be happy to answer them. I'd like to encourage you because so far you've asked some good questions; a lot of newbies to the site dive right in and produce sub-par work because they fail to study the material in advance. Edit: By the way, if you're still interested in finding hitboxes and are comfortable with Lua scripting, you might use this tool, made by yours truly and FatRatKnight some years ago. I never got around to improving it up to the point I wanted and you may even need to download an old emulator to make it work, but if you can get it running, it should sniff out hitboxes very quickly. Regardless of whether you use the tool, you should know more or less what to look for when conducting RAM searches. For example... • Is the value signed or unsigned? That is, can it take on negative values or is it strictly positive? • Is it something "exotic" like binary coded decimal? BCD is frequently used for on-screen displays. • Where is the corresponding address likely to be located relative to other addresses? Hitboxes are a great example of this because once you find the x- or y- coordinates of one corner of one hitbox, you are likely to find nearby (within, say, 20 bytes) not only the corresponding y- or x- coordinates of the same corner but also the coordinates of the opposite corner. You'll also often find things like enemy health, armor, weapon, various flags (invisibility, invincibility), etc. in the same vicinity. Taking things yet further, you'll likely find corresponding data for all enemies in a big table that can be pretty simply represented. • How is the value expected to behave? Again, hitboxes are great to search for with this because you can fairly easily track them. When the enemy moves left, its x-coordinate almost certainly decreases. When it moves right, its x-coordinate increases. If you conduct your search carefully based on those principles (search for RAM values with the "less than" or "greater than" conditions), you'll often find the address you're looking for very quickly. It's worth noting that in 2-D games, the vertical axis tends to be flipped from how you're used to it in your math classes. Values increase downwards and decrease upwards. This might explain some difficulty you may be having in finding hitboxes. And I'm sure there's plenty more that I'm overlooking right now.
Joined: 10/2/2015
Posts: 91
Thank you bobo! Yeah, I was a bit overwhelmed. Thanks for the encouragement, dude!
I didn't kill donkey, I saved it. Current projects: Misc Donkey hacks :) Past projects: Pacifist DKC1 DKC1 Entrance randomizer DKC2 Entrance randomizer DKDC (a troll hack of DKC1) DKC1 Enemy randomizer (among other things)
Site Admin, Skilled player (1251)
Joined: 4/17/2010
Posts: 11475
Location: Lake Char­gogg­a­gogg­man­chaugg­a­gogg­chau­bun­a­gung­a­maugg
RainbowSprinklez wrote:
so, if i understand correctly, $1FF0 is the last of the zero pages in smb? What does the article mean by 'page'? is every 1k a new page?
Wiki: ReverseEngineering wrote:
Zero Page is addresses from $0000 to $00FF.
RainbowSprinklez wrote:
i did read the article.
Oh you!
Warning: When making decisions, I try to collect as much data as possible before actually deciding. I try to abstract away and see the principles behind real world events and people's opinions. I try to generalize them and turn into something clear and reusable. I hate depending on unpredictable and having to make lottery guesses. Any problem can be solved by systems thinking and acting.
Joined: 10/2/2015
Posts: 91
"$0100 - $01FF is Stack that is also used for temporary needs." lol i was thrown off by the $ is all... only place i see that is jQuery and money
I didn't kill donkey, I saved it. Current projects: Misc Donkey hacks :) Past projects: Pacifist DKC1 DKC1 Entrance randomizer DKC2 Entrance randomizer DKDC (a troll hack of DKC1) DKC1 Enemy randomizer (among other things)
Site Admin, Skilled player (1251)
Joined: 4/17/2010
Posts: 11475
Location: Lake Char­gogg­a­gogg­man­chaugg­a­gogg­chau­bun­a­gung­a­maugg
Yeah you'll have to learn the basics of hex if you are going to attempt understanding of the internals. $ is basically the prefix equal to 0x, and both mean hex notation. 0b would be binary (commonly prefixed with % too).
Warning: When making decisions, I try to collect as much data as possible before actually deciding. I try to abstract away and see the principles behind real world events and people's opinions. I try to generalize them and turn into something clear and reusable. I hate depending on unpredictable and having to make lottery guesses. Any problem can be solved by systems thinking and acting.