Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best Way to Build a Game Map

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.

like image 427
NoCarrier Avatar asked Apr 08 '09 23:04

NoCarrier


3 Answers

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.

like image 123
ninesided Avatar answered Oct 25 '22 10:10

ninesided


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)

like image 33
jw. Avatar answered Oct 25 '22 09:10

jw.


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. :-)

like image 37
T.E.D. Avatar answered Oct 25 '22 09:10

T.E.D.