You might remember my very first topic at Map Requests where I needed the Jungle Hijinxs map and kinda succeeded thanks to Fearnavigatr's excellent effort.
However, this time I'm into a more technical thing. I'm talking about a method contrary to screenshot-mapping; writing a program that does the maps for us. Allow me to elaborate.
Donkey Kong Country's level format is ridiculously simple. A level is always* 64 tiles wide and 16 tiles high, is sequenced in columns of tiles, one tile being 32 x 32 pixels. Take a look at the very first column of 'Jungle Hijinxs', thats level array begins at 0x190000.
81 40 67 00 78 00 80 00 68 00 49 00 EA 00 EB 00 EC 00 ED 00 EE 00 EF 00 F0 00 F1 00 F2 00 00 00
And since it's 2 bytes per tile, let's isolate to words:
81 40 | 67 00 | 78 00 | 80 00 | 68 00 | 49 00 | EA 00 | EB 00 | EC 00 | ED 00 | EE 00 | EF 00 | F0 00 | F1 00 | F2 00 | 00 00
The very first tile, '81 40' means literally 'Tile 81, flipped horizontally'. Why? Because the first byte, 81, or whatever it might be is always just the tile. You can change it to any value, and the desired tile will change. The second byte, 40, will be read nibble-by-nibble;
The first nibble, 4, must be read in binary.
Binary table is the following:
Flip Vertically || Flip Horizontally || Ghost || Ghost
If a bit is set, the action is true. 4 is 0100 in Binary, so...
DON'T Flip Vertically, DO Flip Horizontally, DON'T make a ghost, DON'T make a ghost.
(Ghost means that the tile looks normal, but you have no interaction with it. You just walk/fall through it. No idea why it must be defined twice, and who gives a damn anyway since it doesn't serve a purpose in mapping.)
The second nibble, 0 in this case means what bank to use. 0 means use bank 0, 1 means use bank 1, etc...
Now we know how the levels work, but where are the tiles read from? That's when I kick in. I've ripped tilesets of most DKC level types. Below are the links to the Jungle tileset banks 0 to 2.
http://i126.photobucket.com/albums/p82/Raccoon_Sam/Jungle_0.png
http://i126.photobucket.com/albums/p82/Raccoon_Sam/Jungle_1.png
http://i126.photobucket.com/albums/p82/Raccoon_Sam/Jungle_2.png
In short, the program works like this:
1. Read two bytes from desired location
2. Check bank and load corresponding PNG
3. Check the tile byte and print the corresponding tile to the array
4. Check for Vertical or Horizontal flip and apply if true
5. Read next 2 bytes and repeat process
Once 16 tiles are printed below each other, the first column is done, and another column will be started.
Repeat until 1024 tiles are printed.
I've attached a demo movie if you don't get it (requires Flash Player 8).
So yeah, if you're a software developer, be sure to look into this. I'm more than glad to help and will provide all the necessary tilesets if this project gets anywhere.
Cool :D
Hey, good work. I'd lend a hand, but I've got finals this week. Are the backgrounds stored in the same fashion?
I don't even know why I still have my crappy DKC maps up. >_<
Sweet if a program to do this automatically can be made. Would it work for the whole DKC trilogy, do you think?
(...Hey, I'm sure it's not the same as with the Donkey Kong Land games, but if it did...that'd certainly make The Ultimate Koopa happy. :P)
Revned: Backgrounds work exactly the same. They're a bit darker than the foreground though.
JonLeung: Sadly, no. DKC2 and 3's level formats remain undiscovered. I've looked into the games (2 and 3 that is) and noticed that there are no similar structures. I've found some tilemaps and pointers, but nothing level-data related (except some arrays that upon editing make the levels look like vomit, but those probably have nothing to do with level data.)
Maybe the level data in DKC2/3 is compressed.
---
"its a good day to do what has to be done by me and help my brother to defeat the enemys" - John Freeman
Why, Jon do you always have to mention something to do with me? <____< XD
RT-55J: That might well be the case.
And on the tile flipping, I made a more sensible system;
-If the byte is 4x, flip horizontally.
-If the byte is 8x, flip vertically.
-If the byte is Cx, flip horizontally and vertically.
The flipping flags are easy to deal with in code. I might put something together today if you can send me some of the files needed. (my name @ smspower.org)
All the necessary stuffs sent.
If only it was on Monday...
(I'll try and look at it tonight. I'm thinking I can make a fairly generic tool for this that might be reusable.)
Yay!
Hurry up. why is this ignored? bump bump bump lol <_<
OK, seriously I won't do that again.
Why were you bumping a thread that had just been posted in only 5-6 hours earlier? =P
---
"So this is what it's like..."
- Spark Mandrill
OK, here we go...

You can dump entire level sets as single images (eg. all jungle-themed levels) but a 41920x512 image is hard to deal with...
Actually, get this one. The Tile class wasn't necessary. Source is included in this one as well. Java code where everything happens in main() should not be copied at home.
That is so cool..! Thanks a lot, Maxim, I'll get to ripping ASAP.
Type what I said:
java -cp . TileMapReconstructor
Java knows that means "run the TileMapReconstructor.class file".
'Exception in thread "main" java.lang.NoClassDefFoundError: TileMapReconstructor'
:<
Works fine for me. Did you make sure to use the "cd" command to get to the right directory? Try typing the following before the command Maxim gave you:
cd /Users/Bradbury/Desktop/DKCTilemapReconstructor/
Hmm, I guess I'm too used to a commandline and never considered you might not be in the right directory.
Here's what it looks like to create the above image for me:
C:\Documents and Settings\GreadyM\Desktop\maps\DKC>java -cp . TileMapReconstructor "Jungle_" 3 32 32 "Donkey Kong Country (U) (V1.0) [!].smc" 0x190000 168 16 "Jungle Hijinks.png"
Loading Jungle_0.png...
Loaded: 512x512
Got 256 tiles.
Loading Jungle_1.png...
Loaded: 512x512
Got 256 tiles.
Loading Jungle_2.png...
Loaded: 512x160
Got 80 tiles.
Loading Donkey Kong Country (U) (V1.0) [!].smc...
Creating map...
Saving...
Done!
It seems you didn't rip all the tilesets yet, but most things I've tried seem to work fine. For the level ranges you've documented, the map width can be calculated from (end offset - start offset + 1) / 32, so for example "190000 - 1914FF Jungle Hijinx" becomes 0x15000 / 32 = 168 (hence the 168 parameter in the commandline above).
Hmm, that's odd. Doesn't seem to work for me.. Is there a way to compile/convert it to a JAR? I'm most certain they work.
And don't thank me for those offsets, they're all Giangurgolo's wondrous works. He has also ripped the banana sets and explained how they work in his site, too. You might want to take that into a consideration too.
http://giangurgolo.home.att.net/dkc/
I'm not sure a jar helps, since it still needs to be in the right directory and to have loads of commandline options passed in.
java -jar TileMapReconstructor.jar "Jungle_" 3 32 32 "Donkey Kong Country (U) (V1.0) [!].smc" 0x190000 168 16 "Jungle Hijinx.png"
Impressive work! I'm always amazed at what people can accomplish from reading a game's original data.
(Although I'm glad in a way that you're not trying to dump/extract maps from games I'm mapping, otherwise I'd be out of work ;))
---
"With the first link, the chain is forged. The first speech censored, the first thought forbidden, the first freedom denied, chains us all irrevocably." [...] The first time any man's freedom is trodden on, we're all damaged. - Captain Jean-Luc Picard
Current projects: Sonic CD (Sega CD), Mega Man V (GB), Mega Man Zero (GBA), Battletoads (NES)
Maxim Said:
I'm not sure a jar helps, since it still needs to be in the right directory and to have loads of commandline options passed in.
java -jar TileMapReconstructor.jar "Jungle_" 3 32 32 "Donkey Kong Country (U) (V1.0) [!].smc" 0x190000 168 16 "Jungle Hijinx.png"
Reading Giangurgolo's documents, it seems the water levels are encoded differently and will need a modified program to be dumped.
Oh yes, I forgot to mention that. That's why I had the * in my first post but never explained why.. Sorry about that.
And Slipslide ride is sequenced in rows, too.
I'll try to mod it tonight if I get a chance. It's just a simple switch between column-wise and row-wise processing.
I think making it totally generic will be very hard, unfortunately, but the code is hopefully simple enough that it can be adapted for other games. Many games work in a similar way.
Hey, that'd be great.
And yeah, a similar format is really common, but what amazed me the most was that a SNES-game used it.
Can you point me at tile images and offsets for these horizontally-stored stages? I can't really make it without being able to test it.
Oh, right..!
Well, I've got my entrance exam for an art university tomorrow morning, and it's 21:32 now. It starts 9 o' clock and ends at 4 PM, so I'll get to ripping the tiles in... 19 hours or so.
...by which time, I'll be on a plane. So don't expect a response until Tuesdayish.
Wow.... it's probably just me but this does look really complicated for me... I know nothing about Java (well I know what Java is but I don't now how to erm.. "use it")...
*coughmakemoremapsnaoorillgomadlolcough* <_< just kidding <_< Nah... I don't want this to go down like the DKL2 topic >_> <_<
Project discontinued under extreme discouragement
http://www.dkc-atlas.com/dkc/maps/1-1.php
That's too bad, but at least all the maps will be available some day, hopefully. Hope you have something else to fall back on as far as mapping is concerned (unless you're a more balanced person than me without a compulsive need to map games) :)
---
"With the first link, the chain is forged. The first speech censored, the first thought forbidden, the first freedom denied, chains us all irrevocably." [...] The first time any man's freedom is trodden on, we're all damaged. - Captain Jean-Luc Picard
Current projects: Sonic CD (Sega CD), Mega Man V (GB), Mega Man Zero (GBA), Battletoads (NES)
Huh? Well, their tool does everything you wanted, their maps are incomplete and not in the more standard just-a-PNG-file format... why not use their tool to finish the job?
By extreme discouragement, do you mean people discouraging you, or do you actually mean extreme lack of ENcouragement?
I think we've had our fill of your personal encouragement on Donkey Kong maps, Ultimate Koopa. :P
I'm guessing Raccoon Sam was disappointed that someone beat him to the punch.
And yet, as Maxim said, their maps are incomplete...
Well, here's the output from
the DKC Resource Extraction Tool over on DKC Atlas:

Obviously there's still work to be done before submitting them. I won't be the one who does it...
If I weren't so busy lately I'd definitely lend a hand in assembling these. It looks very doable now.
Yeah, by discouragement I meant that I feel a bit pushed down upon finding someone who already made a superior tool and obsoleted our promising start. They say it's a work in progress and updates sporadically.
But hey, we still could do a VGMaps exclusive I guess. I don't think they'd want us to go and take the maps from their site.
About the DKC Resource Extraction Tool... when I tried to generate the level maps, it just crashed... is this yet another one of those "I really shouldn't have brought that tripe that is... Vista" things?
... I was going to post about the fact that the program crashes, but I see I already mentioned it... however, I tried it again, but it still crashed, or "stopped working". Is it simply a "Vista-related" thing?
I know there's an edit feature, but that doesn't "bump" it. Now, please, I know you hate DKC, but can you tell me WHY it crashes when I try and generate the level maps? And if you don't know, then at least say you don't know, so I KNOW, please?
I would help, but...I honestly don't know. But at least now you know. =P
---
"So this is what it's like..."
- Spark Mandrill
<_< but I'd still prefer it if someone DID know... but at least I know people haven't totally ignored this.