The first thing on my list if the map so lets get on to it.
And yes ! It`s time for another wonderful diagram :
And then :
Now the map is the first milestone of my little project. As said in my little graph the map is a grouping of classes that I call Tile. They hold a background sprite for the terrain they have room for an NPC or object to occupy the tile. I'm not sure yet if the tile has a reference to objects on top of it or the object on it has a reference to the tile, or both. Loading a sprite on a tile (and thus, loading the whole grid with tiles) is another thing I'm not sure about. My first reflex is to throw an 2d array at it and translate the integer values to images. Lets say :
{ 3, 2 }
{ 3, 1 }
3 is a road, 2 is grass and 1 is water. When the array is sent to the Grid it assigns a sprite depending on the value received. Of course this is a cheapo solution, a better way would be of creating a custom data structure that contains lets say an array of sprites. The way the sprite array is created is by using technique that I didn't figure out yet. Now that the structure is filled with images I send it to the grid at generation or I use a function to replace the current grid and render the grid again to reflect the changes. In the end I think that whatever technique I use I'll have to translate an array to images anyway. The big difference is what I send to the grid. If I send an array the grid needs to do the translation, if not an external module does the translation and send the already constructed structure to the grid and it simply replace the structure with the one I sent. I need an idea.
In my last game I used the array of int technique to create my maps. A simplified version looks like this :
{ 3, 3, 3, 1, 3, 3, 3, 3, 3,
3, 3, 3, 1, 3, 3, 3, 3, 3,
2, 2, 2, 1, 3, 3, 3, 3, 3,
2, 2, 2, 1, 3, 3, 3, 3, 3,
2, 2, 2, 1, 1, 1, 1, 1, 1,
3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3 }
It looks pretty simple, lets say the 1's are roads, 3's are grass and 2's represent water. Just by looking at the array you can see a rough outline on how the map will look. Road starts from north goes to the center of the map next to a little pond and veers right to the east. The problem comes from the fact that there might be a hundred of sprites used and I need a number for each. After a while the map might look like this :
{ 33, 33, 33, 2, 33, 33, 33, 33, 33,
103, 3, 3, 2, 33, 33, 33, 33, 33,
6, 3, 3, 2, 33, 33, 33, 33, 88,
33, 33, 33, 2, 33, 33, 33, 33, 33,
46, 45, 9, 2, 2, 2, 2, 2, 2,
33, 33, 33, 33, 33, 33, 33, 33, 33,
33, 33, 33, 33, 33, 33, 33, 33, 33 }
Thats pretty much the same map as above exept I added a house and replaced the lake by a river. Can you make sense of this array now ? Not me, at least not with a quick glance. Last time I ended my project by trying to create a program, some kind of map-editor, on which I placed tiles and I it returned the array that I could copy & paste on my game and use. This was a semi-good idea in the sense that it kind of worked but it was a pain to create the external program and it took my attention off of the main project.
*Idea*
One way I could use is to create a .png of the map and import it to my game, the game will now take this image and turn it into a instance of a Grid readily available. Pros and Cons are:
Pros :
It's fairly easy to create a map in paint.
Importing it is extremely easy and fast.
Cons :
I need to make a custom content importer.
I need to make sure the map is 32 * MapSize.X and the tiles need to be spaced exactly on the right spot or the content importer will get the wrong tiles. For example if the first tile is at (0,0) and 32 in size, the tile to the right of it needs to be placed exactly at (33, 0) or I'll lose part of the tile. If my hand slips and I place the tile at (32, 0) I'll lose the one line of pixel. When the content importer takes the image and divide it by blocks of 32x32 it will not grab the right tiles, like everything's going to be offset by one pixel.
In the end I think I''ll try it, for lack of a better idea.

