C++实现的分布式游戏服务端引擎实现的分布式游戏服务端引擎KBEngine详解详解
主要详细介绍了C++实现的分布式游戏服务端引擎KBEngine的概念以及使用方法,非常的实用,有需要的小伙伴可以
参考下
KBEngine 是一款开源的游戏服务端引擎,使用简单的约定协议就能够使客户端与服务端进行交互,
使用KBEngine插件能够快速与(Unity3D, OGRE, Cocos2d, HTML5, 等等)技术结合形成一个完整的客户端。
服务端底层框架使用c++编写,游戏逻辑层使用Python(支持热更新),开发者无需重复的实现一些游戏服务端通用的底层技术,
将精力真正集中到游戏开发层面上来,快速的打造各种网络游戏。
(经常被问到承载上限,kbengine底层架构被设计为多进程分布式动态负载均衡方案,
理论上只需要不断扩展硬件就能够不断增加承载上限,单台机器的承载上限取决于游戏逻辑本身的复杂度。)
cstdkbe.hpp
/*
This source file is part of KBEngine
For the latest info, see http://www.kbengine.org/
Copyright (c) 2008-2012 KBEngine.
KBEngine is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
KBEngine is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with KBEngine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef KBE_CSTDKBE_HPP
#define KBE_CSTDKBE_HPP
#include "cstdkbe/platform.hpp"
#include "cstdkbe/singleton.hpp"
#include "cstdkbe/kbeversion.hpp"
#include "cstdkbe/kbemalloc.hpp"
#include "cstdkbe/stringconv.hpp"
#include "cstdkbe/format.hpp"
namespace KBEngine{
/** 安全的释放一个指针内存 */
#define SAFE_RELEASE(i) \
if (i) \
{ \
delete i; \
i = NULL; \
}
/** 安全的释放一个指针数组内存 */
#define SAFE_RELEASE_ARRAY(i) \
if (i) \
{ \
delete[] i; \
i = NULL; \
}
#ifdef CODE_INLINE
#define INLINE inline
#else
#define INLINE
#endif
/** kbe时间 */
extern GAME_TIME g_kbetime;
/** 账号的类别 */
enum ACCOUNT_TYPE
{
ACCOUNT_TYPE_NORMAL = 1, // 普通账号
ACCOUNT_TYPE_MAIL = 2, // email账号(需激活)
ACCOUNT_TYPE_SMART = 3 // 智能识别
};
enum ACCOUNT_FLAGS
{
ACCOUNT_FLAG_NORMAL = 0x00000000,
ACCOUNT_FLAG_LOCK = 0x000000001,
ACCOUNT_FLAG_NOT_ACTIVATED = 0x000000002
评论0