Tuesday, November 19, 2013

Part4: The Map Format

Ok - so a ton of things have happened and I have a back-up of about 5 or so posts to make that haven't been written.

We left off with finding that each map is stored in 64x64 chunks. I'm sure that in this crazy meta-format they have, somewhere there's a number that's gonna tell me how many chunks wide this map is (probably even statically in the binary as people love doing that kind of thing), buuuuut I think we'll just make a map hacker - gogogo!

So going on a MASSIVE assumption that they made the maps even (ie the end result is a perfect rectangle), we can do this pretty quickly - let's look at the workflow:

1. We parse every file in the map chunk directory (order is going to matter).
2. For each file, we:
        - Read in the pixel data.
        - Paste it onto a WIP framebuffer in memory.
        - Do that first graphics assignment in undergrad paradigm of keeping track when we need to jump                   down a column.

Sound easy? Good! Python will help a lot here:

Basically, this program takes in two arguments - what I "think" the width of the map is in tiles, and a number so I can quickly name the output something unique.

What next? Well, here we have attempt #1 - width of 20; doesn't look quite right:

We'll try a little more (23) - this one, we can tell it's getting close due to the board almost lining up (looking toward the top for alignment makes sense as things get rather chaotic toward the bottom due to being mis-aligned for the entire image:

Seems like 24 is the magic number for this one! 

For the sake of scale - this is about the zoom level in-game:

As a bonus - it's interesting to note that the Playstation 2 version of this game contained extra maps not seen prior (they're marked with notes and look like test maps that were never active in the game:

At some point, I'll up the full resolution maps if anyone wants to take a look at them - they're actually pretty well done.

Next time, we'll talk about the CARD files - this one's gonna be fun, so stick around. :)

No comments:

Post a Comment