tiistai 28. huhtikuuta 2015

Secrets of Turrican II Revealed

Greetings, readers!

Long time no blog, due to lack of time. But I do occasionally have short periods of spare time, which I usually dedicate for coding. This time I decided to hack one of my favourite games and write about it in my blog.

So far I have played around with 8-bit games to get maps from them or to see if they contain some kewl hidden stuff in the code. It was about time to try that stuff with the 16-bits. Yep, it was time to rip apart an Amiga game! ;) Perhaps in the future I will try to reverse engineer games from other 16-bits as well, provided that I can find the time for that. The SNES, for example, certainly has some interesting games to play around with.

Now I have dipped my toe into the 16-bit water. The game with which I began is a huge classic among Amigans. A real legend, a stunning masterpiece, a fantastic demonstration of what the Amiga can do when given to the right hands. Total design and gameplay perfection on the Amiga.

Yep, the game in question is Turrican II - The Final Fight!

Turrican needs no introduction. When Rainbow Arts created this game in 1991, many jaws dropped. A colourful, fast paced, intense platformer shmup with constant 50 fps performance, great level design and a mind-blowingly fantastic soundtrack. It was extremely well received by both magazines and gamers. What would be a better game to start with than Turrican II? Not only is it one of my favourite games for the Amiga but it's also a fairly simple game, and therefore very ideal to play around with.

In order to find what I was looking for - the level data -  as quickly as possible, I used the best Amiga emulator in the world, UAE, and a saved snapshot image. By default, UAE saves compressed snapshot images, so the uncompressed option must be selected from the dropdown menu. Turrican requires no more than 512 k of RAM, which made modifying the game even easier.

I had a really great time editing this game! Then again, when was the last time that I didn't have fun exploring the code of a game? :) In a fairly short time, I found the level data from the .USS (UAE snapshot) file. The way the tiles are put onto the screen is pretty interesting. Tiles in level data are usually placed from left to right, from top-left to bottom-right. But in Turrican 2, the tiles are placed from top to bottom and once the bottom has been reached, the tile X position increases by one. The image below shows 6 tiles and their hex values.

In the level data, the bytes for those tiles are in this very sequence: 2C 01 02 03 04 05

In the snapshot file, the level data begins at offset 0x44200 and ends at offset 0x46279. The size of level 1 is 163 * 51 tiles. Each Turrican tile is 32 * 32 pixels.

For a perfect editor, I would still have to find out where the enemy data, bonus block locations and data for the mid-bosses is, but for now, this will do. I hope this info was helpful as well if you're going to make an editor yourself.

Stay tuned for new blog entries or possible updates. Bye for now! ;)