跳到主要内容

game_server.test_robot

简介

服务器端基于engine层实现的测试机器人管理模块

组件接口

test_robot.gs

服务器端基于engine层实现的测试机器人管理模块

主要是对接pkg.test_client的压测机器人的流程,提供一个标准的对接实现

函数原型函数作用
void setup(object game_server = nil, function init_robot_user_func = nil, function destroy_robot_user_func = nil)初始化本模块
void init_robot_user(int control_id, string test_name, object user_ob)机器人玩家执行初始化函数
void destroy_robot_user(int control_id, object user_ob)销毁机器人玩家
void send_to(int control_id, string msg, ...)向某个测试客户端发送消息
void broadcast(string msg, ...)向所有测试客户端发送消息
mixed get_test_clients()返回所有测试客户端
object find_test_client(int control_id)根据测试客户端id找到对应的处理对象
mixed get_control_id(object conn)根据给定的测试客户端处理对象找到测试客户端id
int login_test_client(object conn)测试客户端登录处理
void logout_test_client(int control_id)测试客户端登出处理
void create_robots_in(int control_id, string test_name, int count, ...)在某个测试客户端上执行创建机器人
void create_robots_in_all(string test_name, int count, ...)在所有测试客户端上执行创建机器人
void destroy_robots_in(int control_id, string test_name, int count, ...)在某个测试客户端上执行销毁机器人
void destroy_robots_in_all(string test_name, int count, ...)在所有测试客户端上执行移除机器人
void iterate_robots_in(int control_id, function func)遍历指定测试客户端上创建的所有机器人玩家
void iterate_robots_in_all(function func)遍历所有测试客户端上的所有机器人玩家
void add_robot_user(int control_id, string test_name, string user_rid)增加一个机器人玩家
void remove_robot_user(int control_id, string user_rid)移除一个机器人玩家

样例

// TODO