查看: 194|回复: 1

[手工架设] 远征ol源代码转换linux系统

[复制链接]

尚未签到

1961

主题

13

回帖

3万

积分

总版主

名望
0
星币
22012
星辰
0
好评
0
发表于 半小时前 | 显示全部楼层 |阅读模式

注册登录后全站资源免费查看下载

您需要 登录 才可以下载或查看,没有账号?立即注册

×

  • <font color="#ff0000">这个版本被我全部替换linux系统来修复 不过问题很多我修复差不多 注意我只替换C++11 移植到 Linux 的难度太大,支持 Linux 的开源游戏服务器框架,我个人修复问题特别多在 Linux 上安装 VirtualBox 或 VMware,运行 Windows 虚拟机进行编译</font> 没有一/定的技术别下载 这个源代码很多东西有问题

复制代码

  • ================================================================================
    Xgame 游戏源码 - VS2022 & C++11 改造完成
    ================================================================================
    修改日期: 2026-02-21
    修改版本: 1.0
    ================================================================================
    一、服务和客户端改造内容
    ================================================================================
    1. 項目文件转换 (VS2008 -> VS2022)
    &#10003; 将 .vcproj 转换为 .vcxproj 格式
    &#10003; 更新工具集到 v143 (Visual Studio 2022)
    &#10003; 更新解决方案文件到 VS2022 格式
    &#10003; 添加 x86/x64 平台支持
    &#10003; 设置 C++20 语言标准
    2. C++11/C++20 支持
    &#10003; 添加 C++11 标准头文件:
    - <atomic>
    - <chrono>
    - <thread>
    - <mutex>
    - <condition_variable>
    - <memory>
    - <functional>
    &#10003; 设置 LanguageStandard 为 stdcpp20
    3. 编译配置
    &#10003; Debug/Release 配置
    &#10003; Win32/x64 平台支持
    &#10003; Unicode 字符集
    &#10003; Windows 10 SDK
    ================================================================================
    二、服务器架构
    ================================================================================
    服务端 (SrcServer):
    ├── Cluster/ # 集悍�务�&#65533;
    │ ├── GatewayServer # 网关服务器
    │ ├── LoginServer # 登录服务器
    │ ├── CenterServer # 中/心服务器
    │ ├── WorldServer # 世界服务器
    │ ├── VoiceServer # 语音服务器
    │ 俯ぉ&#65533; ...
    ├── SceneServer/ # 场景服务器
    │ ├── EntityServer # 实体服务器
    │ ├── SkillServer # 技能服务器
    │ ├── TaskServer # 任务服务器
    │ ├── ChatServer # 聊天服务器
    │ └── ...
    ├── Social/ # 社交服务器
    │ ├── ChatService # 聊天服务
    │ ├── FriendService # 好友服务
    │ ├── TeamService # 队伍服务
    │ └── ...
    └── DBSvr/ # 数据库服务器
    客户端 (SrcClient):
    ├── Client/ # 主客户端
    │ ├── Game # 游戏主程序
    │ ├── GameUI # 游戏UI
    │ └── ...
    ├── RenderEngine/ # 渲染引擎
    ├── UI/ # UI系统
    └── ...
    ================================================================================
    三、编译说明
    ================================================================================
    Windows (Visual Studio 2022):
    1. 安装 Visual Studio 2022
    2. 安装 "使用 C++ 的桌面开发" 工作负载
    3. 打开解决方案文件 (.sln)
    4. 选择配置 (Debug/Release) 和平台 (x86/x64)
    5. 按 F7 编译
    ================================================================================
    四、文件统计
    ================================================================================

复制代码

  • [root@192 gameserver]# # 重新编译
    [root@192 gameserver]# cd /opt/moleserver
    [root@192 moleserver]# make 2>&1 | tail -30
    from CServerServiceManager.h:4,
    from CServerServiceManager.cpp:1:
    ../../include/molnet/dataprovider.h:59:3: warning: dynamic exception specifications are deprecated in C++11 [-Wdeprecated]
    throw (std::runtime_error) = 0;
    ^~~~~
    ../../include/molnet/dataprovider.h:62:3: warning: dynamic exception specifications are deprecated in C++11 [-Wdeprecated]
    throw (std::runtime_error) = 0;
    ^~~~~
    ../../include/molnet/dataprovider.h:65:3: warning: dynamic exception specifications are deprecated in C++11 [-Wdeprecated]
    throw (std::runtime_error) = 0;
    ^~~~~
    In file included from ../../include/molnet/Network.h:18:0,
    from cdefines.h:4,
    from CServerServiceManager.h:4,
    from CServerServiceManager.cpp:1:
    ../../include/molnet/mysqldataprovider.h:58:3: warning: dynamic exception specifications are deprecated in C++11 [-Wdeprecated]
    throw (std::runtime_error);
    ^~~~~
    ../../include/molnet/mysqldataprovider.h:61:3: warning: dynamic exception specifications are deprecated in C++11 [-Wdeprecated]
    throw (std::runtime_error);
    ^~~~~
    ../../include/molnet/mysqldataprovider.h:64:3: warning: dynamic exception specifications are deprecated in C++11 [-Wdeprecated]
    throw (std::runtime_error);
    ^~~~~
    g++ -std=c++11 -o ../../bin/games/libgame_ddz.so objs/*.o -I ../../include/molnet -O2 -shared -fexceptions -fPIC -DLINUX -lpthread -L ../../libs -lmolnet -lmysqlclient -ljsoncpp

复制代码

  • [root@192 moleserver]# make 2>&1 | tail -50
    from cdefines.h:4,
    from crobotlogicframe.h:4,
    from crobotlogicframe.cpp:1:
    ../../include/molnet/mysqldataprovider.h:58:3: warning: dynamic exception specifications are deprecated in C++11 [-Wdeprecated]
    throw (std::runtime_error);
    ^~~~~
    ../../include/molnet/mysqldataprovider.h:61:3: warning: dynamic exception specifications are deprecated in C++11 [-Wdeprecated]
    throw (std::runtime_error);
    ^~~~~
    ../../include/molnet/mysqldataprovider.h:64:3: warning: dynamic exception specifications are deprecated in C++11 [-Wdeprecated]
    throw (std::runtime_error);
    ^~~~~
    g++ -std=c++11 -c -I ../../include/molnet -O2 -shared -fexceptions -fPIC -DLINUX -lpthread -L ../../libs -lmolnet -lmysqlclient -ljsoncpp CServerServiceManager.cpp -o objs/CServerServiceManager.o
    In file included from /opt/rh/devtoolset-7/root/usr/include/c++/7/ext/hash_map:60:0,
    from ../../include/molnet/common.h:53,
    from ../../include/molnet/Network.h:7,
    from cdefines.h:4,
    from CServerServiceManager.h:4,
    from CServerServiceManager.cpp:1:
    /opt/rh/devtoolset-7/root/usr/include/c++/7/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header which may be removed without further notice at a future date. Please use a non-deprecated interface with equivalent functionality instead. For a listing of replacement headers and interfaces, consult the file backward_warning.h. To disable this warning use -Wno-deprecated. [-Wcpp]
    #warning \
    ^~~~~~~
    In file included from ../../include/molnet/Network.h:16:0,
    from cdefines.h:4,
    from CServerServiceManager.h:4,
    from CServerServiceManager.cpp:1:
    ../../include/molnet/dataprovider.h:59:3: warning: dynamic exception specifications are deprecated in C++11 [-Wdeprecated]
    throw (std::runtime_error) = 0;
    ^~~~~
    ../../include/molnet/dataprovider.h:62:3: warning: dynamic exception specifications are deprecated in C++11 [-Wdeprecated]
    throw (std::runtime_error) = 0;
    ^~~~~
    ../../include/molnet/dataprovider.h:65:3: warning: dynamic exception specifications are deprecated in C++11 [-Wdeprecated]
    throw (std::runtime_error) = 0;
    ^~~~~
    In file included from ../../include/molnet/Network.h:18:0,
    from cdefines.h:4,
    from CServerServiceManager.h:4,
    from CServerServiceManager.cpp:1:
    ../../include/molnet/mysqldataprovider.h:58:3: warning: dynamic exception specifications are deprecated in C++11 [-Wdeprecated]
    throw (std::runtime_error);
    ^~~~~
    ../../include/molnet/mysqldataprovider.h:61:3: warning: dynamic exception specifications are deprecated in C++11 [-Wdeprecated]
    throw (std::runtime_error);
    ^~~~~
    ../../include/molnet/mysqldataprovider.h:64:3: warning: dynamic exception specifications are deprecated in C++11 [-Wdeprecated]
    throw (std::runtime_error);
    ^~~~~
    g++ -std=c++11 -o ../../bin/games/libgame_dzpk.so objs/*.o -I ../../include/molnet -O2 -shared -fexceptions -fPIC -DLINUX -lpthread -L ../../libs -lmolnet -lmysqlclient -ljsoncpp
    make[1]: 离开目录“/opt/moleserver/games/dzpk”

复制代码

  • [root@192 bin]# find /opt/moleserver -name "*.sh" 2>/dev/null
    find /opt/moleserver -type f -executable 2>/dev/null | grep -E "(server|start|run)" | head -20
    /opt/moleserver/CMS/vendor/paragonie/random_compat/build-phar.sh
    [root@192 bin]# find /opt/moleserver -type f -executable 2>/dev/null | grep -E "(server|start|run)" | head -20
    /opt/moleserver/.git/hooks/applypatch-msg.sample
    /opt/moleserver/.git/hooks/commit-msg.sample
    /opt/moleserver/.git/hooks/post-update.sample
    /opt/moleserver/.git/hooks/pre-applypatch.sample
    /opt/moleserver/.git/hooks/pre-commit.sample
    /opt/moleserver/.git/hooks/pre-rebase.sample
    /opt/moleserver/.git/hooks/prepare-commit-msg.sample
    /opt/moleserver/.git/hooks/update.sample
    /opt/moleserver/bin/games/libgame_ddz.so
    /opt/moleserver/bin/games/libgame_lhd.so
    /opt/moleserver/bin/games/libgame_lunpan.so
    /opt/moleserver/bin/games/libgame_sszp.so
    /opt/moleserver/bin/games/libgame_bcbm.so
    /opt/moleserver/bin/games/libgame_brnn.so
    /opt/moleserver/bin/games/libgame_hlddz.so
    /opt/moleserver/bin/games/libgame_xzmj.so
    /opt/moleserver/bin/games/libgame_zjh.so
    /opt/moleserver/bin/games/libgame_dzpk.so
    /opt/moleserver/bin/account_server
    /opt/moleserver/bin/game_server
    [root@192 bin]# cd /opt/moleserver/bin
    [root@192 bin]#
    [root@192 bin]#
    [root@192 bin]# ls configs/
    database.ini
    [root@192 bin]#
    [root@192 bin]#
    [root@192 bin]# ./account_server &
    [1] 60462
    [root@192 bin]#
    [root@192 bin]# # 3. 启动游戏主服务器
    [root@192 bin]# ./game_server &
    [2] 60463
    [root@192 bin]# 使用方法:account_server 账号服务器配置ID
    使用方法:game_server 游戏服务器配置ID

复制代码
更新Windows Visual Studio 2022 源代码本身是Visual 2008 现在2008很多库没有 无法实现 我已经全部升级 有什么问题留言
通过网盘分享的文件:Xgame2001_source.rar
链接: https://pan.baidu.com/s/1DDwn4dDPi4NmXfhBKGhtcg 提取码: g26b
安装 MySQL

  • sudo yum install mysql-server mysql -y
    sudo yum install mariadb-server mariadb -y

复制代码
创建数据库
# 登录 MySQL
mysql -u root -p
# 创建数据库
CREATE DATABASE moleweb CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
# 导入数据(如果有 SQL 文件)
mysql -u root -p moleweb < /opt/moleserver/database/moleweb.sql
检查 database.ini
cat /opt/moleserver/bin/configs/database.ini
确保配置与 MySQL 设置匹配
| id | servername | serverport | serverip | createtime | serverstate | curplayercount |
+----+------------------+------------+-----------+---------------------+-------------+----------------+
| 1 | 验证服务器2 | 3333 | 127.0.0.1 | 2019-12-24 14:06:35 | 0 | 0 |
+----+------------------+------------+-----------+---------------------+-------------+----------------+
[root@192 bin]#
[root@192 bin]# # 检查 mol_gameroom 表
[root@192 bin]# mysql -u root -p123456 -e "SELECT * FROM moleweb.mol_gameroom WHERE id=1;"
+----+--------+--------------------------+------------+------------+------------------+-----------+------------+-----------+-----------+-------------+--------------------+---------------------+---------------------+-------+-------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------+--------+
| id | gameid | servername | serverport | tablecount | tableplayercount | serverip | gamingtype | lastmoney | pielement | roomrevenue | currealplayercount | currobotplayercount | createtime | state | QueueGaming | serverparameter | gstate |
+----+--------+--------------------------+------------+------------+------------------+-----------+------------+-----------+-----------+-------------+--------------------+---------------------+---------------------+-------+-------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------+--------+
} | 0 |
+----+--------+--------------------------+------------+------------+------------------+-----------+------------+-----------+-----------+-------------+--------------------+---------------------+---------------------+-------+-------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------+--------+
[root@192 bin]# cd /opt/moleserver/bin
[root@192 bin]# ./account_server 1
[14:57][2026-02-23 14:57:17] opening '/opt/moleserver/bin/logs/account1_server_normal.log'
[14:57][2026-02-23 14:57:17] opening '/opt/moleserver/bin/logs/account1_server_error.log'
./game_server 1
[14:57] [BSC] account_server.cpp:63 main 数据库:localhost root 123456 moleweb 连接成功。
[14:57] [BSC] account_server.cpp:83 main 登陆服务器:127.0.0.1,端口:3333 启动成功。
[14:57] [BSC] account_server.cpp:85 main 服务器启动成功,开始处理...
要做运行移植工具
需要 C++ Windows/Linux 双平台专家 我个人可以解决好他了
我全部移植支持Linux
[root@192 Xgame2001_source]#
[root@192 Xgame2001_source]# chmod +x port_to_linux.sh
[root@192 Xgame2001_source]# cd /home/Xgame2001_source
[root@192 Xgame2001_source]# bash port_to_linux.sh
========================================
Xgame2001 Windows to Linux 移植工具
========================================
> # 9. 统计信息
> echo "[9/10] 统计信息..."
> echo "源文件数量: $(find SrcServer -name "*.cpp" | wc -l)"
> echo "头文件数量: $(find SrcServer -name "*.h" | wc -l)"
>
> # 10. 完成
> echo "[10/10] 移植准备完成!"
> echo ""
> echo "使用方法:"
> echo " 1. cd /home/Xgame2001_source"
> echo " 2. bash build_linux_auto.sh"
> echo ""
> echo "如果编译失败,需要手动修复剩余的错误。"
> echo "========================================"
>
> ENDSCRIPT
[root@192 Xgame2001_source]#
[root@192 Xgame2001_source]# chmod +x port_to_linux.sh
[root@192 Xgame2001_source]# cd /home/Xgame2001_source
[root@192 Xgame2001_source]# bash port_to_linux.sh
========================================
Xgame2001 Windows to Linux 移植工具
========================================
> # 9. 统计信息
> echo "[9/10] 统计信息..."
> echo "源文件数量: $(find SrcServer -name "*.cpp" | wc -l)"
> echo "头文件数量: $(find SrcServer -name "*.h" | wc -l)"
>
> # 10. 完成
> echo "[10/10] 移植准备完成!"
> echo ""
> echo "使用方法:"
> echo " 1. cd /home/Xgame2001_source"
> echo " 2. bash build_linux_auto.sh"
> echo ""
> echo "如果编译失败,需要手动修复剩余的错误。"
> echo "========================================"
>
> ENDSCRIPT
[root@192 Xgame2001_source]#
[root@192 Xgame2001_source]# chmod +x port_to_linux.sh
[root@192 Xgame2001_source]# cd /home/Xgame2001_source
[root@192 Xgame2001_source]# bash port_to_linux.sh
========================================
Xgame2001 Windows to Linux 移植工具
========================================
[1/10] 创建 Linux 兼容层...
[2/10] 创建 Windows API 兼容层...
[3/10] 替换 Windows 头文件...
[4/10] 替换 Windows 关键字...
[9/10] 统计信息...
源文件数量: 1706
头文件数量: 2338
[10/10] 移植准备完成!

温馨提示:本帖内容来自网络分享,帖内若出现联系方式请勿相信,谨防上当受骗。


温馨提示:本帖内容来自网络分享,帖内若出现联系方式请勿相信,谨防上当受骗。
默认签名:偏爱是我家,发展靠大家! 社区反馈邮箱Mail To:paijishu@outlook.com
回复

使用道具 举报

尚未签到

2

主题

367

回帖

397

积分

偏爱AI机器人

名望
0
星币
82
星辰
0
好评
0
发表于 半小时前 | 显示全部楼层
Linux移植难度真大,虚拟机方式靠谱~
默认签名:偏爱是我家,发展靠大家! 社区反馈邮箱Mail To:paijishu@outlook.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关注公众号
Archiver|手机版|偏爱技术社区-偏爱技术吧-源码-科学刀-我爱辅助-娱乐网--教开服-游戏源码

相关侵权、举报、投诉及建议等,请发 E-mail:paijishu@outlook.com

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖
关注公众号
返回顶部