Integrations
Used as the server framework for backend communication with RESTful API endpoints to support the virtual house environment
Powers the multi-player backend server infrastructure that enables real-time server communication in the virtual environment
Connects to an image system that selects and displays images from the server/openai-server/public/image directory on the virtual TV
MCP游戏
一款具有 Node.js 后端的多人控制面板游戏,具有带交互元素的虚拟房屋环境。
特征
- 具有户外环境的沉浸式第一人称 3D 虚拟房屋
- 精美的房子,内部和外部都有特色
- 进出房屋的互动门
- 有树木、植物和装饰元素的花园区
- 具有图像生成功能的交互式电视
- 用于访问MCP系统的计算机终端
- 逼真的运动和碰撞检测
- 实时服务器通信
设置
- 安装依赖项:
Copy
- 运行服务器:
Copy
或者对于具有自动重启功能的开发:
Copy
服务器将在端口 3002 上启动。
游戏控制
- 移动:WASD键
- 环顾四周:鼠标移动(单击游戏即可启用)
- 互动:靠近互动物体时按 ENTER
- 退出界面:ESC键
- 退出鼠标锁:ESC键
互动元素
户外环境
- 探索树木和花坛的地形
- 沿着小路走到房子入口
- 靠近门时按 ENTER 键进入/离开房屋
电视系统
- 靠近电视并按下 ENTER 键来访问遥控器
- 生成将在电视屏幕上显示的图像
- 在终端界面输入图像生成的提示
MCP 终端
- 找到电脑桌并按 ENTER 进入终端
- 向 MCP 系统发送命令
- 访问各种虚拟工具(电子邮件、网络搜索等)
技术细节
- 使用 Three.js 构建,用于 3D 渲染
- 带有指针锁定控制的第一人称视角
- 带有程序化放置树木的户外环境
- 用于后端通信的 Express.js 服务器
- 用于图像生成的 Canvas 库
- 用于服务器通信的 RESTful API
MCP游戏图像系统
本文档解释了 MCP 游戏中图像显示系统的工作原理。
概述
系统会在虚拟房屋的电视上显示来自server/openai-server/public/image
目录的现有图像。系统现在不再生成新图像(这会导致 500 内部服务器错误),而是检查指定目录中是否存在现有图像。
工作原理
- 虚拟房屋中的电视显示存在于
server/openai-server/public/image
目录中的图像。 - 系统每 10 秒检查一次新图像。
- 当用户通过电视遥控界面请求新图像时,系统会从目录中随机选择一张图像。
添加新图像
要将新图像添加到电视:
- 将图像文件(jpg、jpeg、png、gif、webp)放在
server/openai-server/public/image
目录中。 - 系统会自动检测并显示它们。
- 文件应具有适合网络显示的合理大小(建议:800x450像素)。
用法
- 走近虚拟房屋中的电视。
- 按 Enter 键进入电视遥控器界面。
- 输入任何与显示图像相关的命令。
- 系统将从目录中可用的图像中选择并显示一张。
故障排除
- 如果没有显示图像,请检查
server/openai-server/public/image
目录是否存在并包含图像文件。 - 确保服务器在正确的端口上运行(默认值:3002)。
- 检查浏览器控制台中是否有与图像加载相关的错误消息。
技术细节
- 系统不再尝试直接生成图像,从而避免出现 500 内部服务器错误。
- 请求时从目录中随机选择图像。
- 当没有可用图像时,系统会提供适当的反馈。
连接到 MCP 后端服务器
MCPGame 可以连接到外部 MCP 后端服务器,以实现终端和电视交互的高级 AI 功能。
配置
- 打开
main.js
文件并找到顶部的配置部分:
Copy
- 更新
MCP_BACKEND_URL
以指向您的 MCP 后端服务器:- 对于本地开发:
http://localhost:PORT
(将 PORT 替换为您的后端端口) - 对于生产:使用已部署后端服务器的完整 URL
- 对于本地开发:
所需的 API 端点
您的 MCP 后端服务器应实现以下端点:
GET /api/status
- 返回 MCP 系统的状态POST /api/query
- 接受用户查询并返回 AI 响应
响应格式
查询端点应返回以下格式的 JSON:
Copy
测试连接
- 启动 MCP 后端服务器
- 启动 MCPGame 服务器(
node server.js
) - 在浏览器中打开游戏
- 与虚拟房屋中的计算机终端进行交互
- 当您使用终端时,游戏将连接到您的 MCP 后端服务器
Related MCP Servers
- AsecurityAlicenseAqualityA command-line tool that enables the use of MCP with the Room protocol, allowing agents to create and interact in peer-to-peer virtual rooms for goal-oriented collaboration.Last updated -565JavaScriptApache 2.0
- -securityAlicense-qualityAn MCP server that generates 2D and 3D game assets from text prompts using AI models from Hugging Face Spaces, allowing developers to easily create game art through Claude Desktop or other MCP clients.Last updated -34JavaScriptMIT License
- -securityAlicense-qualityA MCP server that provides browser automation tools, allowing users to navigate websites, take screenshots, click elements, fill forms, and execute JavaScript through Playwright.Last updated -PythonApache 2.0
- AsecurityAlicenseAqualityAn MCP server that creates a virtual traveling environment on Google Maps, allowing users to guide an avatar on journeys with photo reports and SNS integration.Last updated -214011TypeScriptMIT License