views:

847

answers:

5

I'm in the process of writing a small overhead view RPG much in the vein of the classic Ultima series. I need a quick and dirty (more quick than dirty) way of designing large maps - say 1000 tiles x 1000 tiles, and i need some help thinking through how to go about doing this.

I would say there are a good 50-60 different types of tiles - woods, rivers, plains, etc.

So far, the best I could come up with was

  • define an array (or some similar structure) to hold two key pieces of information - a location/coordinate identifier, and an integer from 1-60 defining what type of tile it is.

  • in a raster editing application, draw a 1000px x 1000px image. Using a palette of 50 different colors, i draw my map - 1 pixel corresponds to 1 tile. Say for a given water tile, i'll draw a group of pixels in a certain shade of blue. Save as a .gif or .png.

  • write some processor that then analyzes the aforementioned gif/jpg and analyze it pixel by pixel. Depending on the RGB value of the pixel, it determines the tile type. Processor then code-generates some routines that populate the map array.

So far, i'm thinking there must be an easier way.

+3  A: 

Try sourceforge: http://sourceforge.net/search/?type_of_search=soft&words=tile+editor

Several of those editors will save out to some standard format, which you can then pull into your game as you like.

TileStudio will even output header/source files that can be compiled directly into your engine (not sure what your needs are)

jw
+2  A: 

Sounds like a pretty good way to me. However, you might find creating a custom map builder to be just about as easy.

Another option might be to write a program that would allow you to just define the location of major features, and a generator program will fill in the rest. (Eg: River running from x1,y1 to x2,y2. "large" forrest centered at x,y, etc). That might let you define a large map just from a smaller file of geographic features. Think of it as sort of like doing vector drawing instead of specifying every last pixel in a raster. :-)

T.E.D.
+9  A: 

Does it need to be tile based? Take a look at Daniel Cook's site, Lost Garden, not only does he give you some tasty free artwork, but he discusses the advent of arbitrary placement of images in games, rather the tiles:

"Once upon a time, you needed to use little square tiles for everything. Nowadays, there is no real need to make a tile based 2D engine. With arbitrary images with full alpha and lots of fill rate, you can put together a game like a sticker book. Drop down your graphics at arbitrary positions and layer like a madman. Games like Aquaria look great and tiles are nowhere to be seen."

there's also a link in there for step-by-step instructions on making an in-game editor based on IndieLib.

ninesided
+1 for out of the box thinking! <ba-dum> I'll be here all night folks!
Mike Robinson
+1  A: 

Another option would be to generate the (pixel) map or directly the game map. This of course depend on the size of your worl, and if you have a lot of specific resources (a city at this point, a mine at this point...)

There were a lot of article on this subject at site about the game "rogue", that could be quite usable. (try RogueBassin for example)

They also speak about the data structure to allow for more variation (such as having a base image, and randomly add a number of (small) "fringe" images when you define the representaion in your map array. For exemple to add some small rock to the grass ). Others effect as seem in ultima V, where some roof element became transparant when you pass unde them are also based in these structure.

We found that having an image (in our case, a set of image) is easy, since you can make upgrade the look (no more rectangular forest!) when you have the time, and concentrate on the specific quest location.

regards

Guillaume

PATRY
+2  A: 

I'd recommend having your position information be the indexing information for your storage data structure, rather than something you're looking up in it. I.E.

int get_terrain_type(int x, int y) {
    return terrain[x][y];
}

(Not entirely sure that isn't what you meant, but I thought I'd put it out there.)

chaos