# 一种从单个图像生成游戏地图的算法

game map http://www.oglehq.com/map.png

### 评论（7）

2021-10-14 7 楼

``````Bit 0 : Has planet
Bit 1 : Has line from planet going north
Bit 2 : Has line from planet going northwest
...
Bit 8 : Has line from planet going northeast
``````

``````<table border="0" cellspace="0" cellpadding="0">
<tr>
<td><img src="cell_X.gif"></td>
<td><img src="cell_X.gif"></td>
</tr>
<tr>
<td><img src="cell_X.gif"></td>
<td><img src="cell_X.gif"></td>
</tr>
</table>
``````

2021-10-14 6 楼

2021-10-14 5 楼

2021-10-14 4 楼

2021-10-14 3 楼

`````` Tile   Connections
nw  n ne  w  e sw  s se
nw      0  0  0  0  0  0  0  0
n       0  0  0  0  1  0  1  0
ne      0  0  0  1  0  0  0  0
w       0  0  0  0  0  0  0  0
center  0  1  0  0  0  0  1  1
e       0  0  0  0  0  0  0  0
se      0  0  0  0  0  0  0  0
s       0  1  0  0  1  0  0  0
sw      1  0  0  1  0  0  0  0
``````

``````draw_map(connection_map):
For each grid_square in connection_map
connection_data = connection_map[grid_square]
filenames = bitmap_filenames_from(connection_data)
insert_image_references_into_table(grid_square,filenames)

# For each square having one of 256 bitmaps:
bitmap_filenames_from(connection_data):
filename="Bitmap"
for each bit in connection_data:
filename += bit ? "1" : 0
return [filename,]

# For each square having zero through nine bitmaps:
bitmap_filename_from(connection_data):
# Special case - square is empty
if 1 not in connection_data:
return []
filenames=[]
for i in 0..7:
if connection_data[i]:
filenames.append("Bitmap"+i)
filenames.append("BitmapSystem");
return filenames
``````
2021-10-12 2 楼

``````11000010.jpeg
``````

``````196.jpg
``````

2021-10-10 1 楼

SVG 受firefox、opera、safari和chrome的支持-技术上只支持部分规范，但出于实际目的，您应该能够做您需要的事情。w3schools有 a good reference for learning/using svg
VML 是微软对SVG的回应，而且（令人惊讶的是）IE本机支持SVG，尽管SVG不是。Msdn拥有最好的 reference for vml

604 主题
2454 回复
493 人气