Skip to content

Commit 9c1b126

Browse files
author
kbengine
committed
up
1 parent 7dca5e7 commit 9c1b126

File tree

3 files changed

+111
-3
lines changed

3 files changed

+111
-3
lines changed
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
请注意,如果KBEngine插件使用的是多线程模式,kbe_scripts默认在子线程处理,请不要和u3d_scripts直接交互,应该通过KBE提供的事件机制交互。
1+
请注意,如果KBEngine插件使用的是多线程模式,kbe_scripts默认在子线程处理与插件处于同一线程,请不要和u3d_scripts直接交互,应该通过KBE提供的事件机制交互。
22

33
这个文件夹(kbe_scripts)中的脚本类似于KBEngine资产库中(https://github.com/kbengine/kbengine_demos_assets)scripts/client文件夹的Python逻辑脚本。
4-
KBEngine的理想环境是都使用Python实现游戏逻辑,https://github.com/kbengine/kbengine_demos_assets中scripts之下存在client、base、cell三个文件夹分别对应client、baseapp、cellapp进程的逻辑
4+
KBEngine的理想环境是都使用Python实现游戏逻辑,https://github.com/kbengine/kbengine_demos_assets中scripts之下存在client、base、cell三个文件夹分别对应client(客户端)、baseapp(服务器)、cellapp(服务器)进程的逻辑脚本
55
https://github.com/kbengine/kbengine_ogre_demo例子演示了KBE的理想环境,客户端插件(kbengine.dll封装的client_lib)由C++编写,自带了Python解释器与entitydef的分析模块还有网络与消息协议处理等等,
6-
由C++插件驱动scripts/client中的脚本逻辑。
6+
由C++客户端插件驱动来scripts/client中的脚本逻辑。
77

88
但这种理想环境在Unity3d中无法很好的实现,因此实现了轻量级的Unity3d专用插件(协议与entitydef由服务端网络导入),在Unity3d中使用主流的C#来完成客户端部分的脚本逻辑,
99
此时KBEngine资产库可以不需要client文件夹。如果没有scripts/client文件夹需要注意一些事项http://www.kbengine.org/cn/docs/configuration/entities.html。

README.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,62 @@ http://www.kbengine.org
9898
https://github.com/kbengine/unity3d_nav_critterai
9999

100100

101+
##Structure and interpretation:
102+
103+
The relationship between plug-ins(KBE) and U3D and servers:
104+
Plug-in and servers: Responsible for processing and server network packet. account login/logout process.
105+
By server notification logic entities are created and destroyed. Processing synchronous logical entity attribute data. etc.
106+
Plug-in and U3D: The plug-in will trigger some events to the U3D graphics layer, the graphics layer determines whether to capture some events,
107+
get data to render performance (for example: create a monster, a NPC move-speed increase, HP changes).
108+
U3D graphics layer will input the event trigger to the plug-in layer (for example: the player moved, hit the relive button UI),
109+
the plug-in logic script layer determines whether the need to transfer to the server. etc.
110+
111+
112+
Plugins\kbengine\kbengine_unity3d_plugins:
113+
Client plug-in core codes.
114+
115+
Scripts\kbe_scripts:
116+
KBE client logic scripts(in this implementation of the server side of the entity script, the entity's bag data structure, skills in client condition checks, etc.).
117+
118+
Scripts\kbe_scripts\Account.cs:
119+
Corresponds to the client side of the KBE server account entity.
120+
121+
Scripts\kbe_scripts\Avatar.cs:
122+
Corresponds to the client side of the KBE server avatar entity.
123+
124+
Scripts\kbe_scripts\Monster.cs:
125+
Corresponds to the client side of the KBE server monster entity.
126+
127+
Scripts\kbe_scripts\clientapp.cs:
128+
In the system of KBE abstraction of a client APP, which contains the KBE client plug-in initialization and destruction, etc.
129+
130+
Scripts\kbe_scripts\interfaces:
131+
Corresponding to the module defined in KBE(entity_defs\interfaces).
132+
133+
Scripts\u3d_scripts:
134+
Unity graphics layer (including scene rendering, UI, object, character model, monster model).
135+
136+
Scripts\u3d_scripts\GameEntity.cs:
137+
Monster/NPC or player script (management model and animation, etc.).
138+
139+
Scripts\u3d_scripts\World.cs:
140+
Manage a map of the game script, for example: to create a specific 3D monster into the scene.
141+
142+
Scripts\u3d_scripts\UI.cs:
143+
the game's UI processing script.
144+
145+
Scenes\start.unity:
146+
Start the scene, which starts to enter the game.
147+
148+
Scenes\_scenes\login.unity:
149+
login map.
150+
151+
Scenes\_scenes\selavatars.unity:
152+
Game character selection map.
153+
154+
Scenes\_scenes\world.unity:
155+
A map of the scene in the game.
156+
101157
##Screenshots:
102158
![screenshots1](http://www.kbengine.org/assets/img/screenshots/unity3d_demo9.jpg)
103159
![screenshots2](http://www.kbengine.org/assets/img/screenshots/unity3d_demo10.jpg)

README_CN.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,58 @@ http://www.kbengine.org
102102
https://github.com/kbengine/unity3d_nav_critterai
103103

104104

105+
##结构与释义:
106+
107+
KBE插件与U3D和服务器之间的关系:
108+
插件与服务器:负责处理与服务端之间的网络消息包、账号登陆/登出流程、由服务端通知创建和销毁逻辑实体、维护同步的逻辑实体属性数据等等。
109+
插件与U3D:插件将某些事件触发给U3D图形层,图形层决定是否需要捕获某些事件获得数据进行渲染表现(例如:创建怪物、某个NPC的移动速度增加、HP变化)、
110+
U3D图形层将输入事件触发到插件层(例如:玩家移动了、点击了复活按钮UI),插件逻辑脚本层决定是否需要中转到服务器等等。
111+
112+
Plugins\kbengine\kbengine_unity3d_plugins:
113+
KBE客户端插件的核心层代码。
114+
115+
Scripts\kbe_scripts:
116+
KBE客户端的逻辑脚本(在此实现对应服务端的实体脚本、实体的背包数据结构、技能客户端判断等)。
117+
118+
Scripts\kbe_scripts\Account.cs:
119+
对应KBE服务端的账号实体的客户端部分。
120+
121+
Scripts\kbe_scripts\Avatar.cs:
122+
对应KBE服务端的账游戏中玩家实体的客户端部分。
123+
124+
Scripts\kbe_scripts\Monster.cs:
125+
对应KBE服务端的怪物实体的客户端部分。
126+
127+
Scripts\kbe_scripts\clientapp.cs:
128+
在KBE的体系中抽象出一个客户端APP,其中包含KBE客户端插件的初始化和销毁等等。
129+
130+
Scripts\kbe_scripts\interfaces:
131+
对应KBE中entity_defs\interfaces中所声明的模块。
132+
133+
Scripts\u3d_scripts:
134+
Unity3D图形层(包括场景渲染、UI、物体部件、人物模型、怪物模型、一切关于显示的东西等等)。
135+
136+
Scripts\u3d_scripts\GameEntity.cs:
137+
无论是怪物还是玩家都由此脚本负责模型动画等表现部分。
138+
139+
Scripts\u3d_scripts\World.cs:
140+
管理游戏中大地图或副本的渲染层脚本,例如:负责将具体的3D怪物创建到场景中。
141+
142+
Scripts\u3d_scripts\UI.cs:
143+
维护游戏的UI处理脚本。
144+
145+
Scenes\start.unity:
146+
起始场景,由此启动进入游戏。
147+
148+
Scenes\_scenes\login.unity:
149+
登陆场景。
150+
151+
Scenes\_scenes\selavatars.unity:
152+
角色选取场景。
153+
154+
Scenes\_scenes\world.unity:
155+
游戏中大地图/副本场景。
156+
105157
##演示截图:
106158
![screenshots1](http://www.kbengine.org/assets/img/screenshots/unity3d_demo9.jpg)
107159
![screenshots2](http://www.kbengine.org/assets/img/screenshots/unity3d_demo10.jpg)

0 commit comments

Comments
 (0)