Since the articles section has been so quiet lately...

Download: https://skydrive.live.com/redir.aspx?cid=b1e7ee094271bbda&resid=B1E7EE094271BBDA!494&parid=B1E7EE094271BBDA!131

This contains:
* .xlsx map file
* .xml map file (xml spreadsheet file, ready to convert to an array)
* .arr map file (in MMF2 array format)
* .mfa example file (showing how to load the map in MMF2)

I'm using Excel Starter 2010 - the exact procedure will vary depending on which spreadhseet app you are using.
I generally prefer Excel 2003, but it is not ideal in this case, as it has a limit of 3 conditional formatting rules (Excel 2010 allows 64).



Introduction

Making a game tile-based is a great way to cut down on the amount of graphics you need to produce, and also speeds up level creation. However, it's almost always necessary to make a custom map editor - fine if you're working on a big project, but very tedious if you just want to make a few quick maps to test an engine.
One solution I've found, is to use Microsoft Excel as a map editor. By using Excel's "conditional formatting", it's possible to make quite a functional map editor - and it's even possible to replace a lot of your MMF2 map loading code with just a few formulae in Excel.
However - before going any further, I would like to stress that this is NOT a replacement for a custom map editor, except in cases where you just want to see a few quick results.



The Basics

The first thing we need to do is adjust the grid, so that the cells are all square. To do that, just click on the little triangle where the horizontal and vertical headers meet, and then drag the edges of the header cells.

Image
Image
Image

Before going any further, set all the values in your map area to "0" - it turns out my array converter still has issues with blank spaces for some reason.
Next, select all the cells in your map area.
Click on the "conditional formatting" button, and then "new rule".
We're going to make it so an array value of 0 = water and 1 = land.

Image
Image
Image

Now at this point, our map looks blue, but if we enter "1" into any cell, it turns green.

Image

That's all well and good, but we need to be able to place other objects as well as background terrain.
So, make a copy the current worksheet. We'll rename the first sheet "Terrain" and the new copy "Units".

Image

Select all the map cells in the Units sheet, and set them to "0".
Keeping the cells selected, click on the "conditional formatting" button, and then "manage rules".

Image

Double click where it says "Cell Value = 1".
Select the option to "Use a formula to determine which cells to format", and then click the button to select a range of cells.

Image
Image

At this point, go back to the Terrain sheet and select all your map cells. Now, you must remove all the "$" signs from the resulting string, and add "=1" at the end.

Image
Image

Repeat for the other formatting rule, but using "=0" instead of "=1".
At this point, the Units sheet will look the same as the Terrain sheet, except without any numbers - and that's because (as you probably guessed by now) the numbers on this sheet will represent units.

Select all the maps cells, and select "conditional formatting" again - but this time, let's select "Icon Sets" and pick the flag set of indicators.

Image

Select "manage rules" again, and adjust the rules for the icon set. Each army will have 6 different unit types, so lets make it so 1-6 are red units, and 7-12 are green units.

Image

Now we just place a few units, and we're done.

Image



Advanced Techniques

However, using Excel we can do some more fancy stuff.
You may have read my article about terrain transitions - http://www.create-games.com/article.asp?id=1869 (apologies for the broken image links - check the example downloads to see how it works).
That always involved some extra code when loading the map - but we can do all that very easily in Excel instead.

To start with, create a new blank sheet, and adjust the grid size again.
Now we just need to use some IF() functions to check for land in each diagonally adjacent cell, and add either 1, 2, 4 or 8.

Image

Finally, repeat with another sheet for the directly adjacent cells.



Loading a Map in MMF2

Now on to the next stage - loading the map file in MMF2.
For this, you need to download my MMF2 array editor - http://www.create-games.com/download.asp?id=8360

Export your Excel spreadsheet as an "xml spreadsheet" file (but save a copy in Excel's own format first - xml doesn't support all the features).
Load the MMF2 array editor and import your xml spreadsheet file. Then just save it to a number array, and you're done - simply load the map into MMF2 in the normal way (see the example).

Image

So there you have it - kind of a rushed article, but you get the idea