LPC-tutorial

LPMUD游戏驱动说明

2019-04-25  本文已影响0人  秋林拾叶

本文节选自本人写作的《 LPC 语言基础教程:从零学习游戏开发》第一章第二节。

第二节 LPMUD游戏驱动说明

游戏驱动

MUD游戏源码我们称之为 mudlib,像C语言源程序需要编译后运行一样,LPC语言开发的 mudlib 也需要特定的虚拟机环境运行,这个虚拟机就是游戏引擎,习惯称之为游戏驱动(driver),早期的驱动是 mudos,但是作者早已停止维护,现在由叶雨飞大神在 mudos 最后版本上继续维护,并取名为 fluffos 持续更新,官方网址为:https://www.fluffos.info/

本书开发MUD也以 fluffos 为游戏驱动,使用版本为 v2019。因为本书重点是LPC教程,对驱动的编译不是重心,具体编译流程请看官网文档:https://www.fluffos.info/build.html 。官方文档中对 cygwin 下编译需要的包列的不全,为保证v2019最新版(Latest commit dc9a507 on 31 Jan)及以前的版本能正常编译,需要安装以下包:

对开发新入门的同学,推荐先从 windows 系统下开始,直接下载编译好的版本,下载地址:fluffos v2019 @CYGWIN-64

运行时配置文件

游戏驱动需要配合配置文件运行,这个配置文件指定游戏驱动运行时的一些必须参数,在下载的 lpmud-driver 中的 config.ini 文件即为游戏运行时配置文件。我们使用记事本或 notepad++ 等编辑器打开文件,会看到以下内容:

# name of this mud
name : LPC-TEST

# for machines with multiple IP addresses, this specifies which one to use.  this
# replaces the SERVER_IP compile-time define.
# mud ip : 0.0.0.0

# port number to accept users on
port number : 5555

# the external ports we support
# external_port_1 : binary 3166
# external_port_2 : telnet 5555
# external_port_3 : telnet 6666

# absolute pathname of mudlib
mudlib directory : .

# absolute pathname of driver/config dir
binary directory : .

###############################################################################
# You shouldn't change anything below this point unless you know what         #
# you're changing.... =)                                                      #
###############################################################################

# debug.log and author/domain stats are stored here
log directory : /log

# the directories which are searched by #include <...>
# for multiple dirs, separate each path with a ':'
include directories : /include

# the file which defines the master object
master file : /system/kernel/master

# the file where all global simulated efuns are defined.
simulated efun file : /system/kernel/simul_efun

.
.
.

配置文件中指定了 mud 的名字(name)、连接端口(port number)、mudlib的路径(mudlib directory)、主控文件的路径(master file)、模拟函数文件的路径(simulated efun file)等。

配置好正确的路径后,使用以下指令启动游戏驱动:

driver config.ini

上一篇 下一篇

猜你喜欢

热点阅读