serverparam.cpp
来自「2009 ROBOCUP 仿真2DSERVER 源码」· C++ 代码 · 共 1,306 行 · 第 1/4 页
CPP
1,306 行
/* -*- Mode: c++ -*- *//* *Copyright: Copyright (C) 1996-2000 Electrotechnical Laboratory. Itsuki Noda, Yasuo Kuniyoshi and Hitoshi Matsubara. Copyright (C) 2000, 2001 RoboCup Soccer Server Maintainance Group. Patrick Riley, Tom Howard, Daniel Polani, Itsuki Noda, Mikhail Prokopenko, Jan Wendler This file is a part of SoccerServer. This code is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *EndCopyright: */#ifdef HAVE_CONFIG_H#include "config.h"#endif#include "serverparam.h"#include "playerparam.h"#include "csvsaver.h"#include <rcssbase/conf/builder.hpp>#include <rcssbase/conf/parser.hpp>#include <rcssbase/conf/streamstatushandler.hpp>#include <rcssbase/conf/paramsetter.hpp>#include <rcssbase/conf/paramgetter.hpp>#include <algorithm>#include <string>#include <iostream>#include <sstream>#include <cstring>#include <cstdlib>#ifdef HAVE_SYS_PARAM_H#include <sys/param.h> /* needed for htonl, htons, ... */#endif#ifdef HAVE_NETINET_IN_H#include <netinet/in.h>#endif#ifdef HAVE_WINSOCK2_H#include <Winsock2.h> /* needed for htonl, htons, ... */#endif#if defined(_WIN32) || defined(__WIN32__) || defined (WIN32) || defined (__CYGWIN__)# ifndef WIN32# define WIN32# endif#endifbool ServerParam::S_in_init = false;std::string ServerParam::S_program_name = "rcssserver";const int ServerParam::DEFAULT_PORT_NUMBER = 6000;const int ServerParam::COACH_PORT_NUMBER = 6001;const int ServerParam::OLCOACH_PORT_NUMBER = 6002;const int ServerParam::SIMULATOR_STEP_INTERVAL_MSEC = 100;const int ServerParam::UDP_RECV_STEP_INTERVAL_MSEC = 10;const int ServerParam::UDP_SEND_STEP_INTERVAL_MSEC = 150;const int ServerParam::SENSE_BODY_INTERVAL_MSEC = 100;const int ServerParam::SEND_VISUALINFO_INTERVAL_MSEC = 100;const int ServerParam::HALF_TIME = 300;const int ServerParam::DROP_TIME = 200;const double ServerParam::PITCH_LENGTH = 105.0;const double ServerParam::PITCH_WIDTH = 68.0;const double ServerParam::PITCH_MARGIN = 5.0;const double ServerParam::CENTER_CIRCLE_R = 9.15;const double ServerParam::PENALTY_AREA_LENGTH = 16.5;const double ServerParam::PENALTY_AREA_WIDTH = 40.32;const double ServerParam::GOAL_AREA_LENGTH = 5.5;const double ServerParam::GOAL_AREA_WIDTH = 18.32;const double ServerParam::GOAL_WIDTH = 14.02;const double ServerParam::GOAL_DEPTH = 2.44;const double ServerParam::PENALTY_SPOT_DIST = 11.0;const double ServerParam::CORNER_ARC_R = 1.0;const double ServerParam::KICK_OFF_CLEAR_DISTANCE = CENTER_CIRCLE_R;const double ServerParam::CORNER_KICK_MARGIN = 1.0;const double ServerParam::KEEPAWAY_LENGTH = 20.0;const double ServerParam::KEEPAWAY_WIDTH = 20.0;const double ServerParam::BALL_SIZE = 0.085;const double ServerParam::BALL_DECAY = 0.94;const double ServerParam::BALL_RAND = 0.05;const double ServerParam::BALL_WEIGHT = 0.2;const double ServerParam::BALL_T_VEL = 0.001;const double ServerParam::BALL_SPEED_MAX = 3.0; // [12.0.0] 2.7 -> 3.0;const double ServerParam::BALL_ACCEL_MAX = 2.7;const double ServerParam::PLAYER_SIZE = 0.3;const double ServerParam::PLAYER_WIDGET_SIZE = 1.0;const double ServerParam::PLAYER_DECAY = 0.4;const double ServerParam::PLAYER_RAND = 0.1;const double ServerParam::PLAYER_WEIGHT = 60.0;const double ServerParam::PLAYER_SPEED_MAX = 1.05; // [13.0.0] 1.2 -> 1.05// th 6.3.00const double ServerParam::PLAYER_ACCEL_MAX = 1.0;//const double ServerParam::IMPARAM = 5.0;const double ServerParam::STAMINA_MAX = 8000.0; // [13.0.0] 4000.0 -> 8000.0const double ServerParam::STAMINA_INC_MAX = 45.0;const double ServerParam::RECOVERY_DEC_THR = 0.3;const double ServerParam::RECOVERY_DEC = 0.002;const double ServerParam::RECOVERY_MIN = 0.5;const double ServerParam::EFFORT_DEC_THR = 0.3;const double ServerParam::EFFORT_DEC = 0.005;const double ServerParam::EFFORT_MIN = 0.6;const double ServerParam::EFFORT_INC_THR = 0.6;const double ServerParam::EFFORT_INC = 0.01;const double ServerParam::KICK_RAND = 0.1; // [12.0.0] 0.0 -> 0.1const double ServerParam::PRAND_FACTOR_L = 1.0;const double ServerParam::PRAND_FACTOR_R = 1.0;const double ServerParam::KICK_RAND_FACTOR_L = 1.0;const double ServerParam::KICK_RAND_FACTOR_R = 1.0;const double ServerParam::GOALIE_CATCHABLE_POSSIBILITY = 1.0;const double ServerParam::GOALIE_CATCHABLE_AREA_LENGTH = 1.2; // [12.0.0] 2.0 -> 1.2const double ServerParam::GOALIE_CATCHABLE_AREA_WIDTH = 1.0;const int ServerParam::GOALIE_CATCH_BAN_CYCLE = 5;const int ServerParam::GOALIE_MAX_MOVES = 2;const double ServerParam::VISIBLE_ANGLE = 90.0;const double ServerParam::VISIBLE_DISTANCE = 3.0;const double ServerParam::AUDIO_CUT_OFF_DIST = 50.0;const double ServerParam::DASHPOWERRATE = 0.006;const double ServerParam::KICKPOWERRATE = 0.027;const double ServerParam::MAXPOWER = 100.0;const double ServerParam::MINPOWER = -100.0;const double ServerParam::KICKABLE_MARGIN = 0.7;const double ServerParam::CONTROL_RADIUS = 2.0;const double ServerParam::DIST_QSTEP = 0.1;const double ServerParam::LAND_QSTEP = 0.01;const double ServerParam::DIR_QSTEP = 0.1;const double ServerParam::MAXMOMENT = 180;const double ServerParam::MINMOMENT = -180;const double ServerParam::MAX_NECK_MOMENT = 180;const double ServerParam::MIN_NECK_MOMENT = -180;const double ServerParam::MAX_NECK_ANGLE = 90;const double ServerParam::MIN_NECK_ANGLE = -90;const int ServerParam::DEF_SAY_COACH_MSG_SIZE = 128;const int ServerParam::DEF_SAY_COACH_CNT_MAX = 128;const double ServerParam::WIND_DIR = 0.0;const double ServerParam::WIND_FORCE = 0.0;const double ServerParam::WIND_RAND = 0.0;const double ServerParam::WIND_WEIGHT = 10000.0;const double ServerParam::OFFSIDE_ACTIVE_AREA_SIZE = 2.5;const double ServerParam::OFFSIDE_KICK_MARGIN = 9.15;#ifdef WIN32const std::string ServerParam::LANDMARK_FILE = "~\\.rcssserver-landmark.xml";const std::string ServerParam::CONF_DIR = "~\\.rcssserver\\";const std::string ServerParam::SERVER_CONF = "server.conf";const std::string ServerParam::OLD_SERVER_CONF = "~\\.rcssserver-server.conf";#elseconst std::string ServerParam::LANDMARK_FILE = "~/.rcssserver-landmark.xml";const std::string ServerParam::CONF_DIR = "~/.rcssserver/";const std::string ServerParam::SERVER_CONF = "server.conf";const std::string ServerParam::OLD_SERVER_CONF = "~/.rcssserver-server.conf";#endifconst int ServerParam::SEND_COMMS = false;const int ServerParam::TEXT_LOGGING = true;const int ServerParam::GAME_LOGGING = true;const int ServerParam::GAME_LOG_VERSION = DEFAULT_REC_VERSION;const std::string ServerParam::TEXT_LOG_DIR = "./";const std::string ServerParam::GAME_LOG_DIR = "./";const std::string ServerParam::TEXT_LOG_FIXED_NAME = "rcssserver";const std::string ServerParam::GAME_LOG_FIXED_NAME = "rcssserver";const int ServerParam::TEXT_LOG_FIXED = false;const int ServerParam::GAME_LOG_FIXED = false;const int ServerParam::TEXT_LOG_DATED = true;const int ServerParam::GAME_LOG_DATED = true;const std::string ServerParam::LOG_DATE_FORMAT = "%Y%m%d%H%M-";const int ServerParam::LOG_TIMES = false;const int ServerParam::RECORD_MESSAGES = false;const int ServerParam::TEXT_LOG_COMPRESSION = 0;const int ServerParam::GAME_LOG_COMPRESSION = 0;const bool ServerParam::PROFILE = false;const int ServerParam::KAWAY_LOGGING = true;const std::string ServerParam::KAWAY_LOG_DIR = "./";const std::string ServerParam::KAWAY_LOG_FIXED_NAME = "rcssserver";const int ServerParam::KAWAY_LOG_FIXED = false;const int ServerParam::KAWAY_LOG_DATED = true;const int ServerParam::KAWAY_START = -1;const int ServerParam::POINT_TO_BAN = 5;const int ServerParam::POINT_TO_DURATION= 20;const unsigned int ServerParam::SAY_MSG_SIZE = 10;const unsigned int ServerParam::HEAR_MAX = 1;const unsigned int ServerParam::HEAR_INC = 1;const unsigned int ServerParam::HEAR_DECAY = 1;const double ServerParam::TACKLE_DIST = 2.0;const double ServerParam::TACKLE_BACK_DIST = 0.0; // [12.0.0] 0.5 -> 0.0const double ServerParam::TACKLE_WIDTH = 1.25; // [12.0.0] 1.0 -> 1.25const double ServerParam::TACKLE_EXPONENT = 6.0;const unsigned int ServerParam::TACKLE_CYCLES = 10;const double ServerParam::TACKLE_POWER_RATE = 0.027;const int ServerParam::NR_NORMAL_HALFS = 2;const int ServerParam::NR_EXTRA_HALFS = 2;const bool ServerParam::PENALTY_SHOOT_OUTS = true;const int ServerParam::PEN_BEFORE_SETUP_WAIT = 30;const int ServerParam::PEN_SETUP_WAIT = 100;const int ServerParam::PEN_READY_WAIT = 50;const int ServerParam::PEN_TAKEN_WAIT = 200;const int ServerParam::PEN_NR_KICKS = 5;const int ServerParam::PEN_MAX_EXTRA_KICKS = 10;const double ServerParam::PEN_DIST_X = 42.5;const bool ServerParam::PEN_RANDOM_WINNER = false;const double ServerParam::PEN_MAX_GOALIE_DIST_X = 14;const bool ServerParam::PEN_ALLOW_MULT_KICKS = true;const bool ServerParam::PEN_COACH_MOVES_PLAYERS = true;const unsigned int ServerParam::FREEFORM_WAIT_PERIOD = 600;const unsigned int ServerParam::FREEFORM_SEND_PERIOD = 20;const bool ServerParam::FREE_KICK_FAULTS = true;const bool ServerParam::BACK_PASSES = true;const bool ServerParam::PROPER_GOAL_KICKS = false;const double ServerParam::STOPPED_BALL_VEL = 0.01;const int ServerParam::MAX_GOAL_KICKS = 3;const int ServerParam::CLANG_DEL_WIN = 1;const int ServerParam::CLANG_RULE_WIN = 1;const bool ServerParam::S_AUTO_MODE = false;const int ServerParam::S_KICK_OFF_WAIT = 100;const int ServerParam::S_CONNECT_WAIT = 300;const int ServerParam::S_GAME_OVER_WAIT = 100;const std::string ServerParam::S_TEAM_L_START = "";const std::string ServerParam::S_TEAM_R_START = "";// #ifdef MODULEDIR// const std::string ServerParam::S_MODULE_DIR = MODULEDIR;// #else// const std::string ServerParam::S_MODULE_DIR = "/usr/local/lib/rcssserver/modules";// #endif// 11.0.0const double ServerParam::BALL_STUCK_AREA = 3.0;// 12.0.0const double ServerParam::MAX_TACKLE_POWER = 100.0;const double ServerParam::MAX_BACK_TACKLE_POWER = 0.0; // [13.0.0] 50.0 -> 0.0const double ServerParam::PLAYER_SPEED_MAX_MIN = 0.75; // [13.0.0] 0.8 -> 0.75const double ServerParam::EXTRA_STAMINA = 50.0; // [13.0.0] 0.0 -> 50.0const int ServerParam::SYNCH_SEE_OFFSET = 30;// 12.1.3const int ServerParam::EXTRA_HALF_TIME = 100; // [13.0.0] 300 -> 100// 13.0.0const double ServerParam::STAMINA_CAPACITY = 148600.0; //127000.0;const double ServerParam::MAX_DASH_ANGLE = +180.0;const double ServerParam::MIN_DASH_ANGLE = -180.0;const double ServerParam::DASH_ANGLE_STEP = 90.0;const double ServerParam::SIDE_DASH_RATE = 0.25;const double ServerParam::BACK_DASH_RATE = 0.5;const double ServerParam::MAX_DASH_POWER = +100.0;const double ServerParam::MIN_DASH_POWER = -100.0;ServerParam &ServerParam::instance(){ static ServerParam rval( S_program_name ); return rval;}boolServerParam::init( const int & argc, const char * const * argv ){ S_in_init = true; S_program_name = argv[0]; instance(); S_in_init = false; std::string conf_dir = ServerParam::CONF_DIR; const char * env_conf_dir = std::getenv( "RCSS_CONF_DIR" ); if ( env_conf_dir ) { conf_dir = env_conf_dir; }
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?