百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
L

luacluster

> 编程语言
开源

MMO 游戏服务器: Unity 包含 10,000 名玩家的场景

362 stars0 点赞2 次浏览
访问官网GitHub

工具介绍

MMO 游戏服务器: Unity 包含 10,000 名玩家的场景

luacluster

概要

luacluster分布式游戏服务器框架。特色是实现了万人同屏,实现了无缝大地图,用户开发方式为lua的rpc调用模式,已经接入mongodb。近期计划是写技术白皮书。QQ群:927073440。

Lucluster distributed game server framework. The feature is to achieve the same screen for ten thousand people and a big seamless world. The user development mode is the rpc call mode of lua. Mongodb is already available. The immediate plan is to write a technical white paper.

1. BUILDING AND INSTALLATION

CMake (Windows)

Install CMake:

cmd
$ md build && cd build
$ cmake -G "Visual Studio 10" ..   # Or use any generator you want to use. Run cmake --help for a list
$ cmake --build . --config Release # Or "start libevent.sln" and build with menu in Visual Studio.

See Documentation/Building#Building on Windows for more information

CMake (Ubuntu 18,20)

cmd
$ apt-get install -y build-essential libreadline-dev
$ cd core && mkdir build
$ cd core/build && cmake ..     # Default to ubuntu Makefiles.
$ cd core && cmake --build build

CMake (optional)

cmd
$ cmake -DLUA_USE_LUAJIT=ON #使用luajit

2. START RUNING (Windows)

服务器

启动流程:redis.bat, luacluter(_d).exe, bots.bat

在bots.bat中修改要启动的机器人数量

机器人

cmd
# --btcp的参数为连接服务器的 Ip port 总数量
$ luacluter_d.exe --bots --noudp --inside --btcp 127.0.0.1 9577 500 #服务器ip, 端口,总数量

# --btcp2的参数为连接服务器的 Ip port 数量 ip数量
$ luacluter_d.exe --bots --noudp --inside --btcp2 127.0.0.1 9577 500 #服务器ip, 端口,数量, ip的数量

两种模式的配置

服务器的默认配置文件core\res\server\config_defaults.json

压力测试模式

…

单线程调试模式

cmd
{
  "log_config": {
    "ruleDefault": {

    }
  },
  "base_config": {
    "inside": 1
  },
  "docke_config":{
    "dockerRandomSize":1,#随机线程的数量
    "dockerGlobeSize":0,#全局线程的数量
    "popNodeSize":200000,
    "congestion":4000000
  },
  "tcp":{
    "tcp4":[
      {
      "tcp4BindAddr":"0.0.0.0",#tcp的线程和ip端口
      "tcp4Port":9577
      }
    ]
  }
}

数据库存储的测试

在luacluster中使用mongodb

sc.lua全局配置中已经添加了"dbsvr"全局服务对象。

lua
sc.cluster.serves = {"space","bigworld","dbsvr"}--集群启动时要启动的服务列表

在任意节点控制台输入命令创建一个dbentity对象

cmd
#命令new
#参数1:在什么地方创建对象
	DockerCurrent = 0, //当前线程的docker
	DockerRandom,//当前节点的随机ddocker
	NodeInside,//任意内部节点
	NodeOutside,//任意有对外部通信节点
	NodeRandom,//随机节点
	DockerGlobe//放入全局对象池
#参数2:创建对象的名字“dbentity”
#参数3:创建对象的初始化数据格式为json
>new 1 dbentity {}
>New tentity:   18302840717262782469

使用call命令调用dbentity对象的fun函数返回dbid。

cmd
>call 18302840717262782469 fun
>test entity fun
db      6253f48671099513a0f5165f

#命令call
#参数1:entityid
#参数2:entity的函数,这里为dbentity.lua中的“fun”
#剩余参数:为函数参数,类型为数字,字符串,json。例如call 18302840717262782469 fun2 111 {"a":1} aaa

3. luacluster白皮书纲要

  1. luacluster组织架构及名词定义
  2. entity对象的创建,继承,多重继承,多态,健事件。
  3. luarpc调用及封包结构。
  4. 全局对象的创建和全局对象的功能插件
  5. bigworld无缝大地图全局对象。
  6. sudoku九宫格空间全局对象。
  7. space全局对象
  8. dbsvr数据存储全局对象
  9. 命令以及参数
  10. docker的脚本api
  11. 如何使用luacluster创建一个MMO游戏

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Cdistributed-systemsgameserverlualuacluster

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言