|
发表于 2010-1-26 23:50:20
|
显示全部楼层
我在一个博客上看到用lua来实现zmud的map功能
map_daxueshan={
[1]={
roomid=1,
roomname="川西土路",
roomindex=1,
roomnumber=1,
roomflag=0,
roomnpc={},
roomdes="这里已经到了四川最西面,再往前走就要进藏了,气候比川中要冷许多,路边越渐荒凉,偶尔在草丛中露出一堆白骨,在寒风中闪着刺眼的白光,令人触目惊心。",
roomcx=0,
roomcy=0,
roomcz=0,
roomexists={
["sw"]=2
}
},
[2]={
roomid=2,
roomname="藏边土路",
roomindex=1,
roomnumber=2,
roomflag=0,
roomnpc={},
roomdes="这里已经进入了西藏,地势越来越高,空气稀薄,连呼吸都困难起来。阳光分外刺眼,晒得人皮肤发紧,口干舌燥。遥遥往见远处一座城池,让人不由得振奋精神,加快了脚步。",
roomcx=-1,
roomcy=1,
roomcz=0,
roomexists={
["ne"]=1,
["sw"]=3
}
},
[3]={
roomid=3,
roomname="藏边土路",
roomindex=2,
roomnumber=2,
roomflag=0,
roomnpc={},
roomdes="这里已经进入了西藏,地势越来越高,空气稀薄,连呼吸都困难起来。阳光分外刺眼,晒得人皮肤发紧,口干舌燥。遥遥往见远处一座城池,让人不由得振奋精神,加快了脚步。",
roomcx=-2,
roomcy=2,
roomcz=0,
roomexists={
["ne"]=2,
["w"]=4
}
},
[4]={
roomid=4,
roomname="明霞门",
roomindex=1,
roomnumber=1,
roomflag=0,
roomnpc={},
roomdes="这里是吐蕃国皇城的南门,吐蕃是边陲小国,但历年重视军备城防,城墙修筑得坚实高阔,比起中原重镇来竟也毫不逊色。此刻城门吊桥落下,由城门洞下经过的行人熙熙攘攘,看形貌服色大多是在附近聚居的少数民族。",
roomcx=-3,
roomcy=2,
roomcz=0,
roomexists={
["e"]=3,
["n"]=5
}
},
[5]={
roomid=5,
roomname="街道",
roomindex=1,
roomnumber=3,
roomflag=0,
roomnpc={},
roomdes="吐蕃国皇城的街道比起中原大城来要窄小些,也冷清许多。青石漫铺的路两边已经被压出两道深深的车辙。压碎的青石板下裸露出的泥土呈现出脏乎乎的黑色,被冻得硬邦邦的。看来吐蕃当今赞普大大重视军备于民生。东边是家大车店,有不少来往客商在那里歇脚。西面是个兵营。",
roomcx=-3,
roomcy=1,
roomcz=0,
roomexists={
["e"]=7,
["w"]=6,
["s"]=4,
["n"]=8
}
},
[6]={
roomid=6,
roomname="猛虎营",
roomindex=1,
roomnumber=1,
roomflag=0,
roomnpc={},
roomdes="这里驻扎的是吐蕃国皇家的亲兵卫队,负责皇城内外的防务。营内中间有一大快平整的教练场,一个威风凛凛的将官正大声吆喝着训练一小队士兵。营门右首的墙上贴着张微微泛黄的告示(gaoshi)。",
roomcx=-4,
roomcy=1,
roomcz=0,
roomexists={
["e"]=5
}
}
}
这个lua脚本形式的map,通过A*算法可以计算出任意连个房间之间的路径,用lua算还是很快的。 |
|