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.
我正在经典的Ultima系列中编写一个小型俯视RPG。我需要一种快速而肮脏(比肮脏更快)的方式来设计大型地图 - 例如1000个瓷砖x 1000个瓷砖,我需要一些帮助来思考如何去做这件事。
I would say there are a good 50-60 different types of tiles - woods, rivers, plains, etc.
我想说有50-60种不同类型的瓷砖 - 木材,河流,平原等。
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.
定义一个数组(或一些类似的结构)来保存两个关键信息 - 位置/坐标标识符,以及1-60的整数,定义它是什么类型的图块。
-
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.
在光栅编辑应用程序中,绘制一个1000px x 1000px图像。使用50种不同颜色的调色板,我绘制我的地图 - 1个像素对应1个瓷砖。对于给定的水砖,我会画出一组蓝色的像素。另存为.gif或.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.
写一些处理器然后分析前面提到的gif / jpg并逐像素地分析它。根据像素的RGB值,它确定图块类型。然后,处理器代码生成一些填充地图数组的例程。
So far, i'm thinking there must be an easier way.
到目前为止,我认为必须有一个更简单的方法。
5 个解决方案
#1
Try sourceforge: http://sourceforge.net/search/?type_of_search=soft&words=tile+editor
尝试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)
TileStudio甚至会输出可以直接编译到引擎中的头文件/源文件(不确定您的需求是什么)
#2
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."
“曾几何时,你需要使用小方块瓷砖。现在,没有必要制作基于瓷砖的2D引擎。任意图像都具有完整的alpha和大量的填充率,你可以组合一个像一本贴纸书。将你的图形放在任意位置,像疯子一样层层叠叠。像Aquaria这样的游戏看起来很棒,瓷砖无处可见。“
there's also a link in there for step-by-step instructions on making an in-game editor based on IndieLib.
还有一个链接,用于制作基于IndieLib的游戏内编辑器的分步说明。
#3
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. :-)
另一个选择可能是编写一个程序,允许您只定义主要功能的位置,而生成器程序将填写其余部分。 (例如:河流从x1,y1到x2,y2。“大”forrest以x,y等为中心)。这可能只允许您从较小的地理要素文件中定义大型地图。可以把它想象成矢量绘图,而不是指定栅格中的每个最后一个像素。 :-)
#4
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.
我建议您将位置信息作为存储数据结构的索引信息,而不是您在其中查找的内容。 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.)
(不完全确定这不是你的意思,但我想我会把它放在那里。)
#5
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)
现场有很多关于这个主题的关于游戏“流氓”的文章,这可能非常实用。 (以RogueBassin为例)
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.
他们还讨论了数据结构以允许更多变化(例如有一个基本图像,并在您定义地图数组中的表示时随机添加一些(小)“条纹”图像。例如,添加一些小岩石去草地。其他影响似乎在最终V,其中一些屋顶元素变得透明,当你通过它们也是基于这些结构。
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
#1
Try sourceforge: http://sourceforge.net/search/?type_of_search=soft&words=tile+editor
尝试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)
TileStudio甚至会输出可以直接编译到引擎中的头文件/源文件(不确定您的需求是什么)
#2
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."
“曾几何时,你需要使用小方块瓷砖。现在,没有必要制作基于瓷砖的2D引擎。任意图像都具有完整的alpha和大量的填充率,你可以组合一个像一本贴纸书。将你的图形放在任意位置,像疯子一样层层叠叠。像Aquaria这样的游戏看起来很棒,瓷砖无处可见。“
there's also a link in there for step-by-step instructions on making an in-game editor based on IndieLib.
还有一个链接,用于制作基于IndieLib的游戏内编辑器的分步说明。
#3
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. :-)
另一个选择可能是编写一个程序,允许您只定义主要功能的位置,而生成器程序将填写其余部分。 (例如:河流从x1,y1到x2,y2。“大”forrest以x,y等为中心)。这可能只允许您从较小的地理要素文件中定义大型地图。可以把它想象成矢量绘图,而不是指定栅格中的每个最后一个像素。 :-)
#4
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.
我建议您将位置信息作为存储数据结构的索引信息,而不是您在其中查找的内容。 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.)
(不完全确定这不是你的意思,但我想我会把它放在那里。)
#5
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)
现场有很多关于这个主题的关于游戏“流氓”的文章,这可能非常实用。 (以RogueBassin为例)
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.
他们还讨论了数据结构以允许更多变化(例如有一个基本图像,并在您定义地图数组中的表示时随机添加一些(小)“条纹”图像。例如,添加一些小岩石去草地。其他影响似乎在最终V,其中一些屋顶元素变得透明,当你通过它们也是基于这些结构。
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