Skip to content

Commit ada49c6

Browse files
committed
增加aoi, trap等初步机制
1 parent 77833c0 commit ada49c6

20 files changed

Lines changed: 605 additions & 9 deletions

‎kbe/res/server/kbengine_defs.xml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,9 @@
153153
<ghostDistance> 500.0 </ghostDistance>
154154
<ghostingMaxPerCheck> 64 </ghostingMaxPerCheck> <!-- Type: Integer -->
155155
<ghostUpdateHertz> 50 </ghostUpdateHertz> <!-- Type: Integer -->
156+
157+
<!-- 是否使用坐标系统 如果为false, aoi,trap, move等功能将不再维护 -->
158+
<coordinate_system> true </coordinate_system>
156159
</cellapp>
157160

158161
<baseapp>

‎kbe/src/lib/cstdkbe/cstdkbe.hpp‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -207,9 +207,9 @@ typedef int8 CLIENT_CTYPE;
207207
// 前端是否支持浮点数
208208
#define CLIENT_NO_FLOAT
209209

210-
/** 一个cell边界能够看到另一个cell边界的最大范围 */
211-
#define CELL_BORDER_WIDTH 500
212-
210+
// 一个cell的默认的边界或者最小大小
211+
#define CELL_DEF_MIN_AREA_SIZE 500.0f
212+
213213
/** 一个空间的一个chunk大小 */
214214
#define SPACE_CHUNK_SIZE 100
215215

‎kbe/src/lib/entitydef/scriptdef_module.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ name_(name)
4646
detailLevel_.level[DETAIL_LEVEL_FAR] = new DetailLevel::Level();
4747
detailLevel_.level[DETAIL_LEVEL_UNKNOW] = new DetailLevel::Level();
4848

49-
detailLevel_.level[DETAIL_LEVEL_NEAR]->radius = CELL_BORDER_WIDTH;
49+
detailLevel_.level[DETAIL_LEVEL_NEAR]->radius = CELL_DEF_MIN_AREA_SIZE;
5050
detailLevel_.level[DETAIL_LEVEL_NEAR]->hyst = 0.0f;
5151

5252
detailLevel_.level[DETAIL_LEVEL_MEDIUM]->radius = 0.0f;

‎kbe/src/lib/server/serverconfig.cpp‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,11 @@ bool ServerConfig::loadConfig(std::string fileName)
354354
if(node != NULL){
355355
_cellAppInfo.ghostUpdateHertz = xml->getValInt(node);
356356
}
357+
358+
node = xml->enterNode(rootNode, "coordinate_system");
359+
if(node != NULL){
360+
_cellAppInfo.use_coordinate_system = (xml->getValStr(node) == "true");
361+
}
357362
}
358363

359364
rootNode = xml->getRootNode("baseapp");

‎kbe/src/lib/server/serverconfig.hpp‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ typedef struct EngineComponentInfo
8686
{
8787
tcp_SOMAXCONN = 5;
8888
notFoundAccountAutoCreate = false;
89+
use_coordinate_system = true;
8990
}
9091

9192
~EngineComponentInfo()
@@ -106,6 +107,8 @@ typedef struct EngineComponentInfo
106107
float ghostDistance; // ghost区域距离
107108
uint16 ghostingMaxPerCheck; // 每秒检查ghost次数
108109
uint16 ghostUpdateHertz; // ghost更新hz
110+
111+
bool use_coordinate_system; // 是否使用坐标系统 如果为false, aoi,trap, move等功能将不再维护
109112

110113
char internalInterface[MAX_NAME]; // 内部网卡接口名称
111114
char externalInterface[MAX_NAME]; // 外部网卡接口名称

‎kbe/src/server/cellapp/Makefile‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
BIN = cellapp
22
SRCS = \
33
all_clients \
4+
aoi_trigger \
45
cell \
56
cells \
67
cellapp \
@@ -14,12 +15,14 @@ SRCS = \
1415
main \
1516
space \
1617
spaces \
18+
trap_trigger \
1719
updatable \
1820
updatables \
1921
witness \
2022
profile \
2123
range_node \
22-
range_list
24+
range_list \
25+
range_trigger
2326

2427
ASMS =
2528

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/*
2+
This source file is part of KBEngine
3+
For the latest info, see http://www.kbengine.org/
4+
5+
Copyright (c) 2008-2012 KBEngine.
6+
7+
KBEngine is free software: you can redistribute it and/or modify
8+
it under the terms of the GNU Lesser General Public License as published by
9+
the Free Software Foundation, either version 3 of the License, or
10+
(at your option) any later version.
11+
12+
KBEngine is distributed in the hope that it will be useful,
13+
but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
GNU Lesser General Public License for more details.
16+
17+
You should have received a copy of the GNU Lesser General Public License
18+
along with KBEngine. If not, see <http://www.gnu.org/licenses/>.
19+
*/
20+
21+
#include "aoi_trigger.hpp"
22+
23+
namespace KBEngine{
24+
25+
26+
//-------------------------------------------------------------------------------------
27+
AOITrigger::AOITrigger(RangeNode* origin, float xz, float y):
28+
RangeTrigger(origin, xz, y)
29+
{
30+
}
31+
32+
//-------------------------------------------------------------------------------------
33+
AOITrigger::~AOITrigger()
34+
{
35+
}
36+
37+
//-------------------------------------------------------------------------------------
38+
void AOITrigger::onEnter(RangeNode * pNode)
39+
{
40+
}
41+
42+
//-------------------------------------------------------------------------------------
43+
void AOITrigger::onLeave(RangeNode * pNode)
44+
{
45+
}
46+
47+
//-------------------------------------------------------------------------------------
48+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*
2+
This source file is part of KBEngine
3+
For the latest info, see http://www.kbengine.org/
4+
5+
Copyright (c) 2008-2012 KBEngine.
6+
7+
KBEngine is free software: you can redistribute it and/or modify
8+
it under the terms of the GNU Lesser General Public License as published by
9+
the Free Software Foundation, either version 3 of the License, or
10+
(at your option) any later version.
11+
12+
KBEngine is distributed in the hope that it will be useful,
13+
but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
GNU Lesser General Public License for more details.
16+
17+
You should have received a copy of the GNU Lesser General Public License
18+
along with KBEngine. If not, see <http://www.gnu.org/licenses/>.
19+
*/
20+
21+
#ifndef __KBE_AOI_TRIGGER_HPP__
22+
#define __KBE_AOI_TRIGGER_HPP__
23+
24+
#include "range_trigger.hpp"
25+
26+
namespace KBEngine{
27+
28+
class AOITrigger : public RangeTrigger
29+
{
30+
public:
31+
AOITrigger(RangeNode* origin, float xz = 0.0f, float y = 0.0f);
32+
virtual ~AOITrigger();
33+
34+
35+
36+
/**
37+
某个节点进入或者离开了rangeTrigger
38+
*/
39+
virtual void onEnter(RangeNode * pNode);
40+
virtual void onLeave(RangeNode * pNode);
41+
protected:
42+
};
43+
44+
}
45+
46+
#ifdef CODE_INLINE
47+
#include "aoi_trigger.ipp"
48+
#endif
49+
#endif
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
This source file is part of KBEngine
3+
For the latest info, see http://www.kbengine.org/
4+
5+
Copyright (c) 2008-2012 KBEngine.
6+
7+
KBEngine is free software: you can redistribute it and/or modify
8+
it under the terms of the GNU Lesser General Public License as published by
9+
the Free Software Foundation, either version 3 of the License, or
10+
(at your option) any later version.
11+
12+
KBEngine is distributed in the hope that it will be useful,
13+
but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
GNU Lesser General Public License for more details.
16+
17+
You should have received a copy of the GNU Lesser General Public License
18+
along with KBEngine. If not, see <http://www.gnu.org/licenses/>.
19+
*/
20+
21+
22+
namespace KBEngine{
23+
24+
//-------------------------------------------------------------------------------------
25+
}

‎kbe/src/server/cellapp/cellapp90.vcproj‎

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,10 @@
187187
RelativePath=".\all_clients.cpp"
188188
>
189189
</File>
190+
<File
191+
RelativePath=".\aoi_trigger.cpp"
192+
>
193+
</File>
190194
<File
191195
RelativePath=".\cell.cpp"
192196
>
@@ -247,6 +251,10 @@
247251
RelativePath=".\range_node.cpp"
248252
>
249253
</File>
254+
<File
255+
RelativePath=".\range_trigger.cpp"
256+
>
257+
</File>
250258
<File
251259
RelativePath=".\space.cpp"
252260
>
@@ -255,6 +263,10 @@
255263
RelativePath=".\spaces.cpp"
256264
>
257265
</File>
266+
<File
267+
RelativePath=".\trap_trigger.cpp"
268+
>
269+
</File>
258270
<File
259271
RelativePath=".\updatable.cpp"
260272
>
@@ -283,6 +295,10 @@
283295
RelativePath=".\all_clients.hpp"
284296
>
285297
</File>
298+
<File
299+
RelativePath=".\aoi_trigger.hpp"
300+
>
301+
</File>
286302
<File
287303
RelativePath=".\cell.hpp"
288304
>
@@ -343,6 +359,10 @@
343359
RelativePath=".\range_node.hpp"
344360
>
345361
</File>
362+
<File
363+
RelativePath=".\range_trigger.hpp"
364+
>
365+
</File>
346366
<File
347367
RelativePath=".\space.hpp"
348368
>
@@ -351,6 +371,10 @@
351371
RelativePath=".\spaces.hpp"
352372
>
353373
</File>
374+
<File
375+
RelativePath=".\trap_trigger.hpp"
376+
>
377+
</File>
354378
<File
355379
RelativePath=".\updatable.hpp"
356380
>
@@ -368,6 +392,10 @@
368392
RelativePath=".\aoi.ipp"
369393
>
370394
</File>
395+
<File
396+
RelativePath=".\aoi_trigger.ipp"
397+
>
398+
</File>
371399
<File
372400
RelativePath=".\entity.ipp"
373401
>
@@ -380,10 +408,18 @@
380408
RelativePath=".\range_node.ipp"
381409
>
382410
</File>
411+
<File
412+
RelativePath=".\range_trigger.ipp"
413+
>
414+
</File>
383415
<File
384416
RelativePath=".\ReadMe.txt"
385417
>
386418
</File>
419+
<File
420+
RelativePath=".\trap_trigger.ipp"
421+
>
422+
</File>
387423
<File
388424
RelativePath=".\witness.ipp"
389425
>

0 commit comments

Comments
 (0)