matze997/pathfinder
Composer 安装命令:
composer require matze997/pathfinder
包简介
PocketMine-MP Pathfinder
README 文档
README
VIRION IS CURRENTLY IN ALPHA PHASE!
TO-DO:
- More default rules (Help is appreciated!)
Features:
- Async Pathfinding
- Sync Pathfinding
- Path smoothing
- Easy to use API
About asynchron pathfinding:
Async pathfinding is always the method I recommend due to it´s huge performance benefit. But you have to consider that pathfinding on another thread can lead to wrong paths due to block updates during pathfinding. Additionally, async pathfinding takes a bit longer then running the pathfinder on the main thread (Depends on the distance and chunks required to compute the path). But on the other hand the main thread doesn´t even recognize any path computation. You also consider adding a queue if many paths have to be calculated, otherwise stuff like chunk loading & packet compression will take longer.
Code examples:
Finding a path between two points:
// Set some settings $settings = \matze\pathfinder\setting\Settings::get() ->setPathSmoothing(false) ->setMaxTravelDistanceDown(2) ->setMaxTravelDistanceUp(1); // Initialize pathfinder $pathfinder = new \matze\pathfinder\Pathfinder([ // Rules will be executed from PRIORITY_HIGHEST to PRIORITY_LOWEST new \matze\pathfinder\rule\default\EntitySizeRule(new \pocketmine\entity\EntitySizeInfo(2, 1), \matze\pathfinder\rule\Rule::PRIORITY_NORMAL),//Define rules and set priorities ], $settings); // Find path synchron $result = $pathfinder->findPath($from, $to, $world, $timeout); if($result === null) { //Path not found } else { //Path found } // Find path asynchron $pathfinder->findPathAsync($from, $to, $world, function(?\matze\pathfinder\result\PathResult $result): void { if($result === null) { //Path not found } else { //Path found } }, $timeout);
You´re always welcome to contribute!
Contact me:
Discord: matze998
matze997/pathfinder 适用场景与选型建议
matze997/pathfinder 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3 次下载、GitHub Stars 达 44, 最近一次更新时间为 2023 年 03 月 17 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 matze997/pathfinder 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 matze997/pathfinder 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 3
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 44
- 点击次数: 11
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: gpl-3.0-or-later
- 更新时间: 2023-03-17