找回密码
 立即注册
查看: 92|回复: 0

远征ol源代码转换linux系统

[复制链接]
  • 打卡等级:无名新人
  • 打卡总天数:2
  • 打卡月天数:0
  • 打卡总奖励:14
  • 最近打卡:2023-08-27 18:19:54

206

主题

0

回帖

206

积分

中级会员

积分
206
发表于 2026-3-27 11:06:05 | 显示全部楼层 |阅读模式
    <font color=&quot;#ff0000&quot;>这个版本被我全部替换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. 安装 &quot;使用 C++ 的桌面开发&quot; 工作负载
  •     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 -ljsoncppmake[1]: 离开目录“/opt/moleserver/games/dzpk”

  • [root@192 bin]# find /opt/moleserver -name &quot;*.sh&quot; 2>/dev/null
  • find /opt/moleserver -type f -executable 2>/dev/null | grep -E &quot;(server|start|run)&quot; | 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 &quot;(server|start|run)&quot; | 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

更新rgbrgbrgb
通过网盘分享的文件: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 &quot;SELECT * FROM moleweb.mol_gameroom WHERE id=1;&quot;
+----+--------+--------------------------+------------+------------+------------------+-----------+------------+-----------+-----------+-------------+--------------------+---------------------+---------------------+-------+-------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------+--------+
| 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 &quot;[9/10] 统计信息...&quot;
> echo &quot;源文件数量: $(find SrcServer -name &quot;*.cpp&quot; | wc -l)&quot;
> echo &quot;头文件数量: $(find SrcServer -name &quot;*.h&quot; | wc -l)&quot;
>
> # 10. 完成
> echo &quot;[10/10] 移植准备完成!&quot;
> echo &quot;&quot;
> echo &quot;使用方法:&quot;
> echo &quot;  1. cd /home/Xgame2001_source&quot;
> echo &quot;  2. bash build_linux_auto.sh&quot;
> echo &quot;&quot;
> echo &quot;如果编译失败,需要手动修复剩余的错误。&quot;
> echo &quot;========================================&quot;
>
> 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 &quot;[9/10] 统计信息...&quot;
> echo &quot;源文件数量: $(find SrcServer -name &quot;*.cpp&quot; | wc -l)&quot;
> echo &quot;头文件数量: $(find SrcServer -name &quot;*.h&quot; | wc -l)&quot;
>
> # 10. 完成
> echo &quot;[10/10] 移植准备完成!&quot;
> echo &quot;&quot;
> echo &quot;使用方法:&quot;
> echo &quot;  1. cd /home/Xgame2001_source&quot;
> echo &quot;  2. bash build_linux_auto.sh&quot;
> echo &quot;&quot;
> echo &quot;如果编译失败,需要手动修复剩余的错误。&quot;
> echo &quot;========================================&quot;
>
> 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] 移植准备完成!



免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|小黑屋|白黑论坛 |网站地图

GMT+8, 2026-8-5 01:16 , Processed in 0.022834 second(s), 25 queries , Gzip On.

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

快速回复 返回顶部 返回列表