1.概要及环境
KBEngine是一款开源服务端引擎(中文官网http://kbengine.org/cn/),能够在Linux、Windows下部署,为了学习方便,我们在本机Windows下进行服务器环境的搭建。
1)服务端源代码 https://github.com/435886030/kbengine
2)环境:WIN7 + VS2013 (建议使用2013,其它版本可能会有些工程设置报错)
2.构建服务端环境
1.打开kbengine\kbe\src\kbengine_vs120.sln
2.重新生成解决方案(构建baseapp、baseappmgr、cellapp、cellappmgr、dbmgr、loginapp、machine及其依赖项)
3.到kbengine\kbe\tools\server\install\目录下,命令行执行python installer.py install 进行一些环境变量的设置。
过程控制台输出如下:
C:\kbe_root\kbengine\kbe\tools\server\install>python installer.py install
Check the dependences:
- kbe_environment: checking...
ERROR: KBE_ROOT: is error! The directory or file not found:
/kbe
KBE_ROOT current:
reset KBE_ROOT(No input is [C:/kbe_root/kbengine/]):
KBE_RES_PATH current: %KBE_ROOT%/kbe/res/;%KBE_ROOT%/assets/;%KBE_ROOT%/assets/s
cripts/;%KBE_ROOT%/assets/res/
reset KBE_RES_PATH(No input is [%KBE_ROOT%/kbe/res/;%KBE_ROOT%/assets/;%KBE_ROOT
%/assets/scripts/;%KBE_ROOT%/assets/res/]):
KBE_BIN_PATH current: %KBE_ROOT%/kbe/bin/server/
reset KBE_BIN_PATH(No input is [%KBE_ROOT%/kbe/bin/server/]):
KBE_UID current: 34416
reset KBE_UID(No input is [34416]):
之后还会进行MySql相关的设置,若设置成功,则完成安装,如下:
Attempt to modify the [C:\\Program Files (x86)\\MySQL\\MySQL Server 5.0\\my.ini]
...
Try to stop MySQL...
Try to start MySQL...
MySQL is ok
create kbe mysql-account:
- username(Do not enter the default is ‘kbe‘)): kbe
- password(Do not enter the default is ‘kbe‘)): kbe
Create kbe-account: name=kbe, password=kbe successfully!
Create game database(Do not enter the default is ‘kbe‘):kbe
create database(kbe) is successfully!
- mysql: yes
3.服务端资源库及服务器启动
将demo程序的assets拷贝到kbengine目录下,然后执行其中的start_server.bat即可启动服务端。kill_server.bat则为关闭。
KBE的作者将搭建环境的流程都脚本化了,在Windows下搭建KBEngine环境非常方便。大赞!
两个KBE自带的U3D demo:
https://github.com/435886030/kbengine_unity3d_demo
https://github.com/435886030/kbengine_unity3d_warring
原文:http://www.cnblogs.com/kyokuhuang/p/5097652.html