Jun 8, 2013

Every programmer has his own style. Nintendo's and Konami's programmers were very similar in many regards. While I did complain about how hard it was finding the Sun's code in SMB3 because of how sloppy Nintendo's coding was, it was still close to how Konami did Castlevania. I've looked into a couple other games from different companies today.

One snippet of code that seems possibly universal, although not always used: If you see a series of ORA calls in a code, note down those RAM offsets. They're most likely pause variables. Most games had numerous such variables, so using ORA like that let the programmers break code if any of them were set.

Strider (Capcom)
So far this is seeming to be a convoluted mess, just like Mega Man. Capcom's methods seem to include using 3 or 4 variables for the same thing. There seems to be a reason, as each variable undergoes different transformations throughout the course of the step, but it makes tracking down values difficult. Three bytes were used just for the y-coordinate of Hiryu; which one to use? I think it has to do with some funky collision checking. Strider's programmers also apparently stored the I/O reads twice; one byte I've witnessed storing both I/O press and I/O hold values. Not sure what to think about that.

Chip & Dale's Rescue Rangers 2 (Capcom)
Same old story. Twenty different variables just for coordinates alone. Pain in the ass to track down which bytes actually matter.

Ghouls & Ghosts or whatever (Capcom)
Seriously Capcom! Is it really too hard to just add speed values to offset the coordinates?! Why the fuck can't you program like everyone else?!?!?!

////UPDATE IN CAPCOM'S DEFENSE////
G.I. Joe (Taxan)
So I guess Capcom handles movement like some other companies after all. If I'm not mistaken, their games are programmed in some kind of 32bit format. Taxan's movement code was scattered, but still readable. First fractional vectors were handled and the rollover was carried to the view offset (GM does this automatically, so you never have to worry about it in Game Maker). Then there's some other vector quantities involved, but I have yet to see them get set.

That said, Taxan still at least uses states. It's a bit closer to Ninja Gaiden (see below) and not as easy to read as Castlevania, but still easy enough to work with.
Self note: RAM offsets $0400,X are cleared to #$FF and hold the object_index. RAM offsets $0420,X hold the phases.
////END UPDATE////

Ninja Gaiden (Tecmo)
I tried to copy some code from this, but then gave up. While it does seem to use states and I think I did track down the state variables, it just branches through value after value after value. It looked at a glance like Ryu's state tree (meaning it was just a bunch of branches) was the same as enemies'. It almost seemed like everyone used the same states (meaning they all had the same code, just with different values for some variables), so I gave up on reading it for now.

 Saiyuki World/Whomp'Em (Jaleco)
This one is somewhat notable because each instance's stats are all together. You can easily see the y-coordinate, then the vspeed, then the x-coordinate, than the hspeed, etc. of any enemy at a glance. It does jump around like Capcom's games, but nowhere near as badly. While it does have states to some extent (a lot of jump-to-offset commands), there's no clear demarcation like in Nintendo's and Konami's games, so it's still a bitch to decode.

Teenage Mutant Ninja Turtles (Konami)
Ah. Good old Konami. Like G.I.Joe, there are at most 16 instances, which makes reading stat bytes really freaking easy. And since it is Konami after all, RAM offsets $0510,X are the states. Aw, I love Konami. Set the breakpoint for $0510; click Run; click Run; click Run; click Step Into; see the classic Konami jump-to-offset code from CV3; go to sleep happy.

Tetsuwan Atom (Konami)
Sure, rub it in my face.This game looks like it was coded by someone from Tecmo or Jaleco. DEC state BNE DEC state BNE DEC state BNE. Ugh. CV3's code was so beautiful compared to this crap. And movement was handled with alternate variables. Hardly looks like a Konami game at all.

Goonies II (Konami)
Oh my god. After trying to read through Tetsuwan Atom, this was a breath of fresh air. Took me 20 seconds to locate the RAM offset for state bytes and 2 seconds to retrieve the address for state handling. This game's code already feels familiar.
"He likes the Goonies II code. Hey Mikey, he likes it!"

No comments:

Post a Comment

©TheouAegis Productions™. Powered by Blogger.