Download the PHP package pfinalclub/asyncio-gamekit without Composer

On this page you can find all versions of the php package pfinalclub/asyncio-gamekit. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package asyncio-gamekit

pfinal-asyncio-gamekit

Version PHP Version

基于 pfinal-asyncio 的轻量级异步游戏逻辑框架

一个面向 Workerman + pfinal-asyncio 的异步游戏框架,让你用 async/await 编排游戏逻辑,就像写故事剧本一样。

✨ 特性

核心功能

高级功能 🆕

框架定位

专为 小型多人游戏实时对战游戏 设计,适用于:

📦 安装

📋 要求

注意: 如果您的项目已安装 workerman/workerman v5.x,请确保 pfinalclub/asyncio 也支持 Workerman v5。如果遇到依赖冲突,请使用 composer require pfinalclub/asyncio-gamekit --with-all-dependencies 安装。

🚀 快速开始

1. 创建你的第一个游戏房间

2. 完整的 WebSocket 游戏服务器

客户端连接:

📚 核心 API

Room 类

房间是游戏逻辑的核心容器,提供完整的生命周期管理。

配置选项

生命周期钩子

常用方法

Player 类

封装玩家通信和状态管理。

RoomManager 类

管理多个游戏房间。

GameServer 类

WebSocket 游戏服务器。

内置系统事件

客户端可以发送以下系统事件:

事件 说明 数据
set_name 设置玩家名称 {name: "PlayerName"}
create_room 创建房间 {room_class: "ClassName", config: {...}}
join_room 加入房间 {room_id: "room_id"}
leave_room 离开房间 {}
quick_match 快速匹配 {room_class: "ClassName", config: {...}}
get_rooms 获取房间列表 {}
get_stats 获取统计信息 {}

🎯 示例

示例 1:简单倒计时游戏

运行:

示例 2:卡牌游戏

运行:

示例 3:WebSocket 猜数字游戏

启动服务器:

然后在浏览器中打开 examples/client.html 连接游戏服务器。

示例 4:高级游戏(新特性展示)🆕

展示日志、异常处理、持久化等新特性:

🆕 新特性使用

日志系统

异常处理

状态持久化

负载均衡

单元测试

🏗️ 高级用法

自定义定时任务

异步任务编排

超时控制

房间间通信

🎮 完整游戏示例

查看 examples/ 目录了解更多完整示例:

🔧 配置建议

生产环境配置

调试模式

📚 文档

用户文档

运维文档

项目文档

📖 与 Python asyncio 对比

功能 Python asyncio pfinal-asyncio-gamekit
协程定义 async def function(): mixed
等待协程 await expr await(expr)
睡眠 await asyncio.sleep(1) sleep(1)
并发任务 asyncio.gather() gather()
创建任务 asyncio.create_task() create_task(fn())
事件循环 asyncio.run() run()

🤝 贡献

欢迎提交 Issue 和 Pull Request!

📄 许可证

MIT License

🔗 相关链接

💡 示例截图

WebSocket 客户端示例:

客户端示例

🎓 教程

更多教程和文档正在编写中...


Made with ❤️ by PFinal Club


All versions of asyncio-gamekit with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
pfinalclub/asyncio Version ^3.0.0
workerman/gateway-worker Version ^3.0
workerman/channel Version ^1.1
workerman/workerman Version ^4.1|^5.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package pfinalclub/asyncio-gamekit contains the following files

Loading the files please wait ...