Posts Tagged ‘Allegro’

How does Diablo build its maps?

January 18, 2008

I took a bit of time to try and look up how Diablo 1 loads or creates its maps – and I came up with nothing but tile graphics. I have to assume that when you use a stair to go to a level you haven’t been in yet, the progress bar is indicating that the game is generating the map from scratch. I used several tools to look into the Diablo MPQ datafile to try and find more information out, but I was unsuccessful. Without information or raw data, I had to look to other means of working towards building my own maps.

I have the thought now and again that I should really be trying to create my own content. Right now I can’t really support content I’m not ready to build, so it seems reasonable to borrow other content. That’s why you see me building a Diablo clone – it’s a good stepping stone to start off with. I’ve built mazes before, but never anything more complicated than a 1-tile-wide corridor maze. As I think on things, I could probably look up Rogue‘s level creation method, but since I’ve already done this much I figure I might as well see it through.

Getting back to the problem – I wasn’t able to find any information about how Diablo builds its levels, and there was no indication from the datafile how to go about it either. So I decided to take another approach – take screenshots of the automap and put them together in an image-processing program (I like Paint.NET). I wind up with images that look like:

diablomaplv1-200801180807.png

With enough of these, I can start to guess at the patterns and come up with my own builder. It’s a good idea, but the mashup above is awfully hard on the eyes. I wanted to filter out the non-map information, but I didn’t want to hand-edit the compiled image.. but how would I do that? I know GDI+ a bit, but I just wanted a quick-and-dirty solution that I know only one way of creating: Allegro. So I broke down and downloaded Dev-C++ and grabbed Allegro for it. After a bit of wrangling with C++ and a couple of recompiles, I handed my new tool the image and wound up with:

diablomaplv1-200801180807_filtered.png

Perfect! Now I can really get an idea of what the folks at Blizzard were doing.

It would really have been helpful for the guys at Diablo Evolution to have put something about the map generation somewhere on their site. These guys probably know more than anyone else about Diablo. They mention that some of the screenshots in the early days of pre-final Diablo were “impossible” and they could only know that if they knew how the maps were being built. I still have to dig some more before I decide to give up on that route, but for now I’ve got a good lead.

Advertisements