PHP网页游戏学习之网页游戏学习之Xnova(ogame)源码解读(七)源码解读(七)
十、基础数值(vars.php)
vars.php文件中定义游戏中关键的基础数值,全部以数组形式定义;PHP中的数组实际上是一个有序图。我们下面将以代码注
释的方式进行说明,可能有不正确的理解,希望大家自己也仔细看看,有问题请提出来!如果对这段数值理解了,那么你就可
以创造新的单位了,比如新的科技(可以看我服的殖民技术)、新的船舰等。
// 玩家消息类型定义,具体含义请看messages.mo
$messfields = array (
0 => "mnl_spy",
1 => "mnl_joueur",
2 => "mnl_alliance",
3 => "mnl_attaque",
4 => "mnl_exploit",
5 => "mnl_transport",
15 => "mnl_expedition",
97 => "mnl_general",
99 => "mnl_buildlist",
100 => "new_message"
);
// 所有游戏单位类型定义,其实就是数据库表中字段
$resource = array(
//建筑单位
1 => "metal_mine",
2 => "crystal_mine",
3 => "deuterium_sintetizer",
4 => "solar_plant",
12 => "fusion_plant",
14 => "robot_factory",
15 => "nano_factory",
21 => "hangar",
22 => "metal_store",
23 => "crystal_store",
24 => "deuterium_store",
31 => "laboratory",
33 => "terraformer",
34 => "ally_deposit",
41 => "mondbasis",
42 => "phalanx",
43 => "sprungtor",
44 => "silo",
//科技研究单位
106 => "spy_tech",
108 => "computer_tech",
109 => "military_tech",
110 => "defence_tech",
111 => "shield_tech",
113 => "energy_tech",
114 => "hyperspace_tech",
115 => "combustion_tech",
117 => "impulse_motor_tech",
118 => "hyperspace_motor_tech",
120 => "laser_tech",
121 => "ionic_tech",
122 => "buster_tech",
123 => "intergalactic_tech",
124 => "expedition_tech",
199 => "graviton_tech",
//船舰单位
202 => "small_ship_cargo",
203 => "big_ship_cargo",
204 => "light_hunter",
205 => "heavy_hunter",
206 => "crusher",
207 => "battle_ship",
208 => "colonizer",
209 => "recycler",
210 => "spy_sonde",
211 => "bomber_ship",
212 => "solar_satelit",
213 => "destructor",
214 => "dearth_star",
215 => "battleship",
//防御单位
401 => "misil_launcher",
402 => "small_laser",
403 => "big_laser",