Vibe Eyes 客户端是一个轻量级的客户端库,可将浏览器游戏与 Vibe Eyes 调试服务器 进行集成,实现实时调试、可视化和分析功能。借助该库,AI 能够实时“看到”它正在处理的游戏!
Vibe Eyes 客户端可助力开发者将浏览器游戏与调试服务器集成,实现实时调试、可视化和分析。以下是快速集成的示例代码:
// 使用默认设置初始化(自动连接到服务器)
// (null = auto-detect)
// (创建弹出窗口,如果 container 为 null)
VibeEyes.init({
// 配置选项
});
// 监听事件
VibeEyes.on('message', (msg) => {
console.log('收到消息:', msg);
});
你可以通过以下两种方式安装 Vibe Eyes 客户端:
npm install vibe-eyes-client
<script src="https://unpkg.com/vibe-eyes-client/dist/vibe-eyes.min.js">script>
// 使用默认设置初始化(自动连接到服务器)
// (null = auto-detect)
// (创建弹出窗口,如果 container 为 null)
VibeEyes.init({
// 配置选项
});
// 监听事件
VibeEyes.on('message', (msg) => {
console.log('收到消息:', msg);
});
VibeEyes.init({
serverUrl: 'http://localhost:3000', // 自定义服务器 URL
debugMode: true, // 启用调试模式
container: '#debug-container' // 使用自定义容器元素
});
| 属性 | 详情 |
|---|---|
| serverUrl | 服务器的 URL 地址(默认:http://localhost:3000) |
| debugMode | 是否启用调试模式(默认:false) |
| container | 自定义容器的选择器或元素(默认:null,自动创建弹出窗口) |
| 属性 | 详情 |
|---|---|
| reconnectInterval | 断开后重新连接的间隔时间(以毫秒为单位,默认:3000) |
| maxRetries | 最大重试次数(默认:5) |
| 属性 | 详情 |
|---|---|
| theme | SVG 的主题颜色(默认:light,可选:dark) |
| fontFamily | 文本的字体家族(默认:Arial) |
| fontSize | 文本的大小(以像素为单位,默认:14) |
html>
<html>
<head>
<script src="vibe-eyes.min.js">script>
head>
<body>
<div id="debug-container">div>
<script>
VibeEyes.init({
serverUrl: 'http://localhost:3000',
debugMode: true,
container: '#debug-container'
});
script>
body>
html>
本项目采用 ISC 许可证。