暗黑破坏神2 Docker容器
这个Docker容器为运行Project Diablo 2提供了一个完整的环境,包括VNC远程访问、内存监控和用于AI辅助的MCP服务器集成。
特性
- 无头游戏:在虚拟X11显示器上运行Project Diablo 2
- 远程访问:用于远程桌面连接的VNC服务器
- 人工智能集成:用于Claude Desktop集成的MCP服务器
- 内存监控:实时游戏状态监控
- 自定义分辨率:针对容器环境优化了1068x600分辨率
- 3dfx支持:通过3dfx仿真增强图形渲染
先决条件
- 已安装Docker和Docker Compose
- 暗黑破坏神2游戏文件
pd2/目录 - VNC客户端(可选,用于远程访问)
快速开始
- 构建并运行容器:
docker-compose up --build- 通过VNC连接:
- 主持人: localhost - 端口: 5901 - 无需密码
- 访问服务:
- VNC: localhost:5901 - MCP服务器: localhost:8765 - 健康检查: localhost:3000
目录结构
Diablo2/
├── Dockerfile # Container definition
├── docker-compose.yml # Service orchestration
├── README.md # This documentation file
├── INSTALL.md # Installation and setup guide
├── start_diablo2.sh # Main startup script (executable)
├── diablo2_monitor.py # Memory monitoring service
├── diablo2_mcp_server.py # MCP server for AI integration
├── screenshots/ # Directory for game screenshots
├── memory_dumps/ # Directory for memory analysis dumps
└── pd2/ # Project Diablo 2 game files (user provided)
├── Base Game Files (Root Level):
├── D2.LNG # Language file
├── d2char.mpq # Base character data
├── d2data.mpq # Base game data
├── d2exp.mpq # Expansion pack data
├── d2music.mpq # Base music files
├── d2sfx.mpq # Base sound effects
├── d2speech.mpq # Base voice files
├── d2video.mpq # Base video files
├── D2xMusic.mpq # Expansion music
├── d2xtalk.mpq # Expansion voice files
├── D2xVideo.mpq # Expansion videos
├── Patch_D2.mpq # Base game patches
├── Save/ # Save Directory
│
└── ProjectD2/ # Project D2 mod directory
├── Executables:
├── Game.exe # Main game executable
├── Diablo II.exe # Original Diablo 2 executable
├── PD2Launcher.exe # Project D2 launcher
├── D2VidTst.exe # Video test utility
│
├── Core Game Libraries:
├── D2Client.dll # Client library
├── D2Common.dll # Common game functions
├── D2Game.dll # Core game library
├── D2gfx.dll # Graphics library
├── D2Lang.dll # Language support
├── D2Launch.dll # Game launcher
├── D2Net.dll # Network functionality
├── D2sound.dll # Audio system
├── D2Win.dll # Windows interface
├── D2CMP.dll # Compression library
├── D2Multi.dll # Multiplayer support
├── D2MCPClient.dll # Battle.net client
├── Fog.dll # Blizzard utility library
├── Storm.dll # Blizzard core library
│
├── Graphics & Display:
├── D2DDraw.dll # DirectDraw wrapper
├── D2Direct3D.dll # Direct3D wrapper
├── D2Gdi.dll # GDI graphics
├── D2Glide.dll # 3dfx Glide wrapper
├── D2HD.dll # HD graphics support
├── ddraw.dll # DirectDraw implementation
├── glide3x.dll # 3dfx Glide library
├── SGD2FreeRes.dll # Resolution mod library
├── SGD2FreeDisplayFix.dll # Display fix library
│
├── Media & Codec Libraries:
├── binkw32.dll # Bink video codec
├── SmackW32.dll # Smacker video codec
├── ijl11.dll # Intel JPEG library
├── sciter.dll # HTML/CSS engine
├── WebView2Loader.dll # Modern web integration
├── libcrypto-1_1.dll # Cryptography library
│
├── Project D2 Mods:
├── ProjectDiablo.dll # Main Project D2 modifications
├── PD2_EXT.dll # Project D2 extensions
├── BH.dll # BH maphack integration
├── Bnclient.dll # Battle.net client mod
├── StormLib.dll # MPQ archive library
│
├── Game Data Archives:
├── d2gl.mpq # D2GL graphics mod
├── D2MultiRes.mpq # Multi-resolution support
├── patch_d2.mpq # Game patches
├── pd2assets.mpq # Project D2 assets
├── pd2data.mpq # Project D2 data
├── pd2maps.mpq # Project D2 maps
├── SGD2FreeRes.mpq # Resolution mod data
├── SlashDiabloHD.mpq # HD graphics pack
├── ver-IX86-1.mpq # Version-specific data
│
├── Configuration Files:
├── BH.json # BH maphack settings
├── BH.json.bak # BH settings backup
├── d2gl.json # D2GL graphics settings
├── d2gl.yaml # D2GL YAML config
├── ddraw.ini # DirectDraw settings
├── D2HD.ini # HD graphics settings
├── default.filter # Default item filter
├── loot.filter # Loot filter settings
├── local_metadata.json # File integrity checksums
├── ProjectDiablo.cfg # Project D2 configuration
├── ProjectDiablo.json # Project D2 JSON config
├── ProjectDiablo.json.bak # Config backup
├── SGD2FreeResolution.json # Resolution settings
├── SGD2FreeRes.json # Resolution config
└── UI.ini # UI positioning configuration文件类别
基本游戏文件
基础暗黑破坏神2安装 (in pd2/):
*.mpq档案-原始游戏数据档案D2.LNG-语言支持文件
D2型项目 (in pd2/ProjectD2/):
Game.exe-修改后的游戏可执行文件D2*.dll-核心游戏库ProjectDiablo.dll-主要模块功能- 修改过的
*.mpq文件-特定于Mod的内容
增强文件
BH.dll-BH maphack集成SGD2FreeRes.mpq+SGD2FreeResolution.json-分辨率modWebView2Loader.dll-现代网络集成
配置文件
UI.ini-接口定位SGD2FreeResolution.json-显示设置
环境变量
| 变量 | 默认值 | 描述 |
|---|---|---|
WINEPREFIX | /root/.wine | Wine安装目录 |
WINEARCH | win32 | Wine架构(32位) |
WINEDEBUG | -all | 禁用Wine调试消息 |
DISPLAY | :1 | X11显示编号 |
港口
| 端口 | 服务 | 描述 |
|---|---|---|
| 5901 | VNC | 远程桌面访问 |
| 8080 | 网络VNC | 可选的基于网络的VNC |
| 3000 | 健康检查 | 容器健康端点 |
| 8765 | MCP服务器 | AI集成端点 |
游戏启动参数
游戏以以下参数启动:
wine Game.exe -ns -3dfx-ns:无启动画面-3dfx:启用3dfx图形加速
桌面集成
容器创建桌面快捷方式和菜单项:
- 桌面快捷方式:
/root/Desktop/Diablo2.desktop - Fluxbox菜单:右键单击桌面以访问游戏启动器
- 应用程序菜单:可用
/root/.local/share/applications/
故障排除
常见问题
- 游戏无法开始:
- 检查游戏文件是否存在于 pd2/ProjectD2/ - 验证Wine初始化已成功完成 - 检查容器日志中的错误消息
- VNC连接失败:
- 确保端口5901未被防火墙阻止 - 尝试连接到 0.0.0.0:5901 而不是 localhost:5901
- 解决问题:
- 修改 SGD2FreeResolution.json 针对不同的分辨率 - 调整Xvfb分辨率 start_diablo2.sh
- 性能问题:
- 尝试不同的Wine D3D渲染器设置 - 在docker-compose.yml中调整容器资源限制
调试命令
访问正在运行的容器:
docker exec -it diablo2_container /bin/bash检查正在运行的进程:
docker exec diablo2_container ps aux查看日志:
docker-compose logs diablo2发展
添加新功能
- 内存监控:扩展
diablo2_monitor.py - MCP服务器:修改
diablo2_mcp_server.py - 游戏配置:更新中的配置文件
pd2/ProjectD2/
自定义分辨率
要使用不同的分辨率:
- 更新
SGD2FreeResolution.json:
"Ingame Resolutions": ["1920x1080"]- 在中修改Xvfb
start_diablo2.sh:
Xvfb $DISPLAY -screen 0 1920x1080x16 &安全说明
- VNC服务器无需密码即可运行(仅适用于本地开发)
- 容器以root身份运行(考虑非root用户用于生产)
- 所有端口都是暴露的(在生产环境中受到限制)
许可证
此容器设置用于教育和开发目的。确保您拥有所有游戏文件的合法副本。
