PHP: Map Image Generation

Accompanying the first Dungeon Generator Algorithm article is a sample PHP file that will generate an image from a bi-dimensional array. You can download it here if you wish.

There are comments in the file to make it easier to edit. All you have to do is give it a $map variable with the correct numbers (-1 for paths, 0 for empty squares, and positive integers for room numbers), change the MAP_WIDTH and MAP_HEIGHT accordingly, and it will generate a PNG image for you showing you your rooms and paths.

Feel free to use it in your own projects, or even to test your own generator(s) as you go!

Note: this PHP file uses the GD library. You will need this library installed in your server for it to work. You can check if you have it installed with php_info().