https://github.com/sundream/aoi
九宫格和十字链表两种实现
https://github.com/sundream/aoi
aoi c game lua-bindings skynet
Last synced: 19 days ago
JSON representation
九宫格和十字链表两种实现
- Host: GitHub
- URL: https://github.com/sundream/aoi
- Owner: sundream
- Created: 2018-11-27T02:18:37.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-04-18T10:46:15.000Z (almost 7 years ago)
- Last Synced: 2024-03-20T16:32:02.563Z (almost 2 years ago)
- Topics: aoi, c, game, lua-bindings, skynet
- Language: C
- Size: 13.7 KB
- Stars: 21
- Watchers: 5
- Forks: 10
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## 介绍
* aoi的九宫格和十字链表两种实现
## 状态
* 尚未经过线上项目验证
## API
* 见grid/src/aoi.h或者crosslink/src/aoi.h
* 另外lua-bind相关见grid/lua-bind/laoi.c或者crosslink/lua-bind/laoi.c
## 编译和运行
以九宫格实现为例说明,十字链表实现编译方式完全相同
* c源码:
* 编译: cd grid/src && make clean && make all
* 运行: ./aoi
* lua绑定:
* 编译: cd grid/lua-bind && make clean && make all
* 运行: lua test.lua
## 用法
* 见各目录下的test.c/test.lua
## 优缺点
* 九宫格
* 优点: cpu消耗小
* 缺点: 内存开销大,内存消耗不仅和实体数有关,还和场景大小成正比
* 十字链表
* 优点: 内存开销小,内存消耗仅和实体数有关,和场景大小无关
* 缺点: cpu消耗高,每次移动都需要计算视野差,当实体在小区域堆积严重时效率更差
## 参考
* [aoi](https://github.com/cloudwu/aoi)
* [十字链表实现](http://github.com/lichuang/AOI)