News: 11 March 2016 - Forum Rules
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia, Danke

Author Topic: Donkey Kong Orig. Edition (NES) - using whole DK area for all animation frames?  (Read 1681 times)

Enkel

  • Newbie
  • *
  • Posts: 3
    • View Profile
Hi everyone! I have changed the Donkey Kong sprite animation for Donkey Kong Original Edition but now I have problems during some frames when I implement it.

I used Tile Layer Pro and wrote different numbers on all 8x8 tiles that looked like they belonged to Donkey Kong himself in order to identify which part belonged to what frame of the animation and for what position. I made a completely different primate from scratch (a monkey instead) and animated it in Photoshop.

Now, here's my problem. Donkey Kong's whole animation area while he is throwing barrels is 48 x 32 pixels (6x4 tile areas), but he never uses the whole area at the same time. During his first frame, there is a 8x8 area missing on the top left corner of his location as well as on the right top corner, for example. And when these areas are not used, they instead become part of the same tile as the background tile (black in this case). During other frames these areas are actually used so it's not a permanent part of the background.

In my animation, I sometimes need to use the whole area during a couple of frames to fit the sprite, so currently some areas go black during some parts of the animation. I've looked and there should be no problem sizewise since there are lot of unused tiles when I look at the tiles in Tile Layer Pro. However, I do not know how to control which tiles are used when and where (other than editing the original ones in TLP), I am currently only able to follow exactly the same animation pattern as the original DK sprite animation which is not what I want to do since I want to have a more "alive" animation (not being forced to keep the same face expression for multiple frames for example). I have the entire monkey animation ready, it's just the implementation that is the problem.

How can I locate where I can modify the code that controls the size of DK's tile area for each frame as well as where the game uses tiles from? I have been goofing around a bit with FCEUX but I have no idea what I'm doing to be honest. Where do I start?

Psyklax

  • Hero Member
  • *****
  • Posts: 1109
    • View Profile
    • Psyklax Translations
First of all, are you sure DK is part of the background? I'd be surprised if he wasn't a sprite. You may want to read about how the NES PPU works:
https://wiki.nesdev.com/w/index.php/PPU

The problem you or anyone else will have with editing Donkey Kong is that it's a very small ROM with very little space, though I'm thinking of the, er, original version, rather than the Original Edition. Maybe the latter has been expanded, leaving more empty space.

Replacing the tiles is the easy part, but if you want to change the animation, you'll need to learn assembly. There will be code in the game saying "use this tile here" for each part of DK, so to change where the tiles go, you'll have to edit the existing code, and possibly add more somehow. I'll have a look myself later.

In the meantime I recommend learning about how the background and sprite layers work, and remember that pixels don't mean too much on the NES because the system works entirely on 8x8 tiles. Actually this is true for most 8- and 16-bit consoles. :)

EDIT: you were right: DK is part of the background rather than a sprite, at least most of the time. When he carries Pauline up the ladder, he becomes a sprite. Around $330 in RAM is where the tile arrangement is kept for DK, and it's sent to the PPU from there. It gets the details from around $4668 in the ROM. You'll find that $4668 to $467F is the tiles used for DK's first frame, 4x6 tiles going in columns from left to right. The previous address ($4667) contains $46, and I'm not sure precisely what that does, but the point is that you'll find 24 bytes with one frame of DK, then a $46, then another 24 bytes with a different frame. Try going to $4668 in the ROM and start messing around with it! :)

EDIT2: In case you didn't guess, $24 is the tile used for the black background.
« Last Edit: April 06, 2018, 12:06:41 pm by Psyklax »

Enkel

  • Newbie
  • *
  • Posts: 3
    • View Profile
He probably is a sprite, but "unused" areas (8x8 black tiles) turn into the same tile as the background, probably meaning the sprite size is smaller for those frames. In my animations I also do have some areas that are unused, but they are at different locations compared to the original. All in all, it will hopefully not require more space in the ROM, but just work a bit differently to work with the new animation.

Yes, that code is exactly what I'm looking for! Hopefully I can get to understand it one day.

Here is how DK animates during the first stage while he is throwing barrels in case anyone is interested:


Note: these "tile numbers" are just something that I've made up to organize my own animations.

Thanks for the recommendations and link, Psyklax. Now I know where to start!

Psyklax

  • Hero Member
  • *****
  • Posts: 1109
    • View Profile
    • Psyklax Translations
So, how did it go? Did you see my edit to my original post? It shows where you can find all the animation frames in the ROM (and that he's not a sprite). Knowing what I know now, I'm sure you'll have no problem changing the animation to whatever you like. :)

Enkel

  • Newbie
  • *
  • Posts: 3
    • View Profile
Didn't notice the edit, sorry! Thanks a lot for the help and hopefully I'll be able to continue next weekend!