Codetapper's Amiga Site

Toki Map Ripping

Maptapper comes preloaded with several configuration files including level 1 from Toki. In this tutorial, you can extract the tiles and map yourself from the game.

Part 1: Tile Ripping

Load Maptapper and select Open from the File menu. Open the Toki folder and select the Toki_Level1.uss file:

Maptapper will open the WinUAE savestate, decompress it (if required), copy the ECS colour palette, select a default 16x16 tiles and position the tile ripper at address $0:

Notice in the palette that colour 0 and 16 are both black. More on this later. Start pressing the Page Down button on your keyboard. We're hunting for anything resembling graphics. To a trained eye address $3c000 it looks like the font used by the game:

Press the Page Down button again. At $3e800 it looks like some character graphics. If you press the Q key, the rip width will increase by 16 pixels to 32 pixels and you will see the graphics look much better. In this case, they are not the map tiles so reduce the rip width by 16 pixels by pressing the A key.

After you press Page Down a few more times, you will see something very interesting at address $52800. After a little practice with the tool, you will be able to see that these are tiles:

I personally like to verify that the tiles are correct at this stage by increasing the colour depth, but other rippers prefer to line the tiles up first. It's completely up to you. Press the E key 4 times to increase the bitplane count from 1 to 5. After each press, the graphics will become more clear. Once 5 bitplanes are selected, you will see most of the tiles:

The top 2 rows are incorrect, so press the Down Arrow key a couple of times to line up the tiles correctly at address $52804:

Bingo, we have the tiles! Now we need to find the first tile. Press Shift and Up Arrow together to move the display up by an entire row of tiles:

The top line now contains 16 garbage tiles, then a blank tile and 3 ground tiles. We need to make a decent guess at where the tiles start for the next phase. If in doubt, choose extra tiles as it's better to have excess tiles than be missing any, and the Map Search feature will usually find the map even if you have made a mistake. Games will often store a completely blank tile as tile 0, so press Shift and Right Arrow to move the address an entire tile at a time until the blank tile is the top left tile:

Part 2: Map Ripping

Now switch to the Map Search tab:

Now we need to load a screenshot from the game. Click the ... or Load Image button and select the file Toki_Level1.png.

(The ... button will open a file requester where you can select the screenshot. The Load Image button will re-load whatever image was previously loaded without the file requester if you have altered parts of the image).

At this stage I always press the Replace colours that do not match the tile palette button (which is mainly purple with a magic wand on it) as this will highlight any areas we need to avoid for the tile match function. Click the button and notice that Toki turns purple:

All non-purple pixels matched the tile palette which is fantastic. Now drag the selection rectangle onto the screenshot and resize it to select a range of tiles. Always try and select a region that contains a range of tiles, as if you select a section of identical tiles, the Map Search will be much slower or fail completely due to too many matches:

Press the Match Tiles button and wait a few seconds. If everything goes to plan, Maptapper will locate the tiles, re-align your selection perfectly and display all the tile indexes:

Now we have the tile indexes for that area, press the Search for Map button to automatically search the memory dump for a map. We were lucky with our selection, and a single match has been found at $520c6. Maptapper has worked out that the map is stored as bytes and the width is 60 bytes:

Click the Map Ripper tab and choose the match from the drop-down list:

The map will appear in memory positioned exactly over the tiles you chose. The width is 60 tiles, but the height of the map is unknown, as is the alignment:

Click on the map, then use the arrow keys to move the map around to locate the top. You can press Shift and the arrows to move 8 tiles at a time instead of 1:

Once you have found the top of the map, it is usually very easy to see the left corner as the previous tiles will often be garbage. Continue to use the arrow keys until you have aligned the top left corner of the map:

The map looks good, but the bottom contains some extra garbage that we need to trim off. Use the W key to increase the height of the map and S to decrease it. Level 1 of Toki appears to have a map height of 57 tiles:

Part 3: Tidy Up

Anyone familiar with the game may have noticed that there are a lot of black areas on the map that contain other graphics during the game. The game has a parallax scrolling background that is drawn onto the screen, but Maptapper cannot combine maps automatically. The next best thing is to replace one of the 2 black colour palette entries we found earlier with another colour. Click on the Tile Ripper tab and right-mouse click on colour index 0 and choose Aqua from the popup menu:

Many of the tile graphics will now change appearance:

Click on the Map Ripper tab again and press F5 to force a refresh of the screen. Notice several areas on the map will change from black to aqua:

During the middle section of the game, the aqua colour is set to black, so that part will have to be recoloured manually in a paint program if required. Press the Save Map button and a file requester will appear:

Name the map whatever you like and a PNG will be saved containing the entire map from level 1. You can also save the tile graphics by pressing the Save Gfx button on the Tile Ripper tab.

Extension

To verify that it doesn't really matter if the tiles you chose were perfect, mis-align the tiles slightly so the first blank tile is not in the correct position. When the map search is performed, you will notice the Adjust value is set to the number of tiles you were 'out' by. This is Maptapper's way of accounting for the tiles being incorrectly lined up. If the Adjust value is 0, you picked the perfect starting tile.

Post your comment

Comments

  • Gravatar for kevin

    Excellent work.
    I'd love to do this for Nuclear War. Any advice on how to get started?

    kevin 06/04/2017 11:55pm (7 months ago)

RSS feed for comments on this page | RSS feed for all comments

You may enjoy these articles...

Toki Map Ripping

Comedy

If you look inside many Amiga games, secret messages have been hidden by the programmers. Richard Aplin was the king of hiding messages in the startup-sequence file, and his Line of Fire and Final Fight startup-sequences have become legendary! The Sensible Software team were also prolific at hiding messages in their games.

Toki Map Ripping

Interviews

A collection of technical interviews with Amiga programmers that worked on commercial software in the glory days of the Amiga (late 1980s to early 1990s!)

Toki Map Ripping

Maptapper

The Ultimate Amiga Graphics, Level and Map Ripper!

Toki Map Ripping

Random Rants

A random assortment of rants relating to the Amiga!

Toki Map Ripping

Sprite Tricks

An explanation of how many famous Amiga games utilised sprites in weird and interesting ways