Commit d9c023b882083f03aeb9fea8da9c462625d6cb57
1 parent
c27cb54b
压测
Showing
3 changed files
with
15 additions
and
12 deletions
Show diff stats
robot/robot.lua
@@ -131,7 +131,8 @@ end | @@ -131,7 +131,8 @@ end | ||
131 | -- 登录成功开始任务 | 131 | -- 登录成功开始任务 |
132 | function CMD.task() | 132 | function CMD.task() |
133 | heartBeat() | 133 | heartBeat() |
134 | - skynet.sleep(math.randomInt(100, 1000)) | 134 | + -- 20 秒后开始执行任务 错开登录 |
135 | + skynet.sleep(math.randomInt(2000, 3000)) | ||
135 | startUnit() | 136 | startUnit() |
136 | end | 137 | end |
137 | 138 |
robot/robot_config.lua
@@ -18,21 +18,21 @@ return { | @@ -18,21 +18,21 @@ return { | ||
18 | online = 100, -- 稳定状态在线人数 | 18 | online = 100, -- 稳定状态在线人数 |
19 | inpre = 10, -- 稳定前每秒进入人数 -- 必须小于online数 | 19 | inpre = 10, -- 稳定前每秒进入人数 -- 必须小于online数 |
20 | max = 200, -- 最大玩家数 必须大于 online 数 | 20 | max = 200, -- 最大玩家数 必须大于 online 数 |
21 | - online_time = {10, 60}, -- 在线时间控制 秒 | 21 | + online_time = {10 * 60, 20 * 60}, -- 在线时间控制 秒 |
22 | 22 | ||
23 | uname_prefix = "robothehe", --机器名称前缀 | 23 | uname_prefix = "robothehe", --机器名称前缀 |
24 | 24 | ||
25 | 25 | ||
26 | -- 机器上线后的行为 | 26 | -- 机器上线后的行为 |
27 | units = { | 27 | units = { |
28 | - chat = {weight = 1}, -- 聊天 | ||
29 | - item = {weight = 1}, -- 物品操作 | ||
30 | - hero = {weight = 1}, -- 英雄 | ||
31 | - hang = {weight = 1}, -- 挂机战斗 | ||
32 | - tower = {weight = 1}, -- 爬塔 | ||
33 | - car = {weight = 1}, -- 爬塔 | ||
34 | - pvp = {weight = 1}, -- pvp | ||
35 | - email = {weight = 1}, -- 邮件 | ||
36 | - adv = {weight = 1}, -- 冒险 | 28 | + chat = {weight = 100}, -- 聊天 |
29 | + item = {weight = 100}, -- 物品操作 | ||
30 | + hero = {weight = 500}, -- 英雄 | ||
31 | + hang = {weight = 1000}, -- 挂机战斗 | ||
32 | + tower = {weight = 500}, -- 爬塔 | ||
33 | + car = {weight = 100}, -- 爬塔 | ||
34 | + pvp = {weight = 500}, -- pvp | ||
35 | + email = {weight = 100}, -- 邮件 | ||
36 | + adv = {weight = 200}, -- 冒险 | ||
37 | } | 37 | } |
38 | } | 38 | } |
robot/start.lua
@@ -25,7 +25,6 @@ end | @@ -25,7 +25,6 @@ end | ||
25 | function MSG.close(fd) | 25 | function MSG.close(fd) |
26 | if fd2serv[fd] and not fd2serv[fd].closing then | 26 | if fd2serv[fd] and not fd2serv[fd].closing then |
27 | fd2serv[fd].closing = true | 27 | fd2serv[fd].closing = true |
28 | - print(fd2serv[fd].agent) | ||
29 | skynet.call(fd2serv[fd].agent, "lua", "exit") | 28 | skynet.call(fd2serv[fd].agent, "lua", "exit") |
30 | pcall(skynet.send, poold, "lua", "feed") | 29 | pcall(skynet.send, poold, "lua", "feed") |
31 | 30 | ||
@@ -131,6 +130,9 @@ local function start(pooldp, pooldObj, onlineCountp, startIdp, endIdp, inprep) | @@ -131,6 +130,9 @@ local function start(pooldp, pooldObj, onlineCountp, startIdp, endIdp, inprep) | ||
131 | 130 | ||
132 | for i = 1, onlineCount, inpre do | 131 | for i = 1, onlineCount, inpre do |
133 | for j = 1, inpre do | 132 | for j = 1, inpre do |
133 | + if i + j - 1 > onlineCount then | ||
134 | + break | ||
135 | + end | ||
134 | add_robot() | 136 | add_robot() |
135 | end | 137 | end |
136 | skynet.sleep(100) | 138 | skynet.sleep(100) |