Ir para conteúdo

Tutorial para criar Dedicated Server (DS) no Ubuntu 18.04 LTS com Bots - CS 1.6 Steam


crazynoob84

Recommended Posts

Compartilhando um método que criei, testei e funcionou para criação de DS para CS 1.6 Steam.

Depois de muito apanhar com velharias na internet (maioria dos posts de 2009 a 2015) criei esse tutorial simplificado pra montar o server pra CS 1.6 Steam.

Não fiz comentários no código pra ficar bem limpo, só seguir linha a linha. Pra entender o por que de cada coisa podem acessar os links na seção "Credits", que foram os que eu usei pra chegar nessa versão final da sequência de comandos.

Esse servidor fica bem bacana pra quem gosta de jogar casualmente com pouca gente, pois o podbot complementa com até 16 Bots caso não tenha entrado esse número de jogadores.
E os BOTS são bem difíceis (pelo menos pra quem é noob q nem eu), diversão garantida.

 

IMPORTANTE:

No tutorial não tem configurações de rede ou coisa parecida, então certifique-se de que o seu servidor é acessível pela internet e possui a porta 27015 aberta no firewall para receber conexões de entrada de qualquer host.
Se não configurar nenhum DNS para seu server vc vai ter q saber por qual IP público ele responde antes de conseguir acessa-lo.
Para configurar o firewall do server, localmente, segue uma dica do GuruQA.com: https://www.guruqa.com/topic.php?t=7484

 

Tutorial CS Server 1.6 Ubuntu 18.04 LTS with Bots (metamod/amxmodx/podbot)

# Credits:
# --------
# https://ixnfo.com/en/launching-and-configuring-counter-strike-1-6-server-on-linux.html
# https://ixnfo.com/en/how-to-install-and-use-screen.html
# https://www.youtube.com/watch?v=G9RQsRsr6xQ
# http://metamod.org/
# https://www.amxmodx.org/downloads.php
# http://podbotmm.bots-united.com/main_pb_page/downloads.htm
# http://podbotmm.bots-united.com/doc_v3/html/pbmm_install.html
# http://podbotmm.bots-united.com/doc_v3/html/pbmm_configuration.html
# https://support.steampowered.com/kb_article.php?ref=8571-GLVN-8711&l=portuguese

# Files:
# ------
http://filebase.bots-united.com/uploads/all_in_one 3.2a.zip

 

# Command sequence:

mkdir ~/SteamCMD && cd ~/SteamCMD
wget http://media.steampowered.com/client/steamcmd_linux.tar.gz && tar xfz steamcmd_linux.tar.gz
rm steamcmd_linux.tar.gz
chmod +x steamcmd.sh
sudo dpkg --add-architecture i386
sudo apt-get update && sudo apt-get install lib32gcc1 screen unzip -y

./steamcmd.sh
login anonymous
force_install_dir ../hlds
app_update 90 validate
app_update 10 validate
quit

mkdir ~/.steam
ln -s ~/SteamCMD/linux32 ~/.steam/sdk32
touch ~/hlds/cstrike/listip.cfg
touch ~/hlds/cstrike/banned.cfg
cd ~/hlds
curl "http://filebase.bots-united.com/uploads/all_in_one 3.2a.zip" -o all_in_one_3.2a.zip && unzip all_in_one_3.2a.zip

echo "screen -A -m -d -S csserver ./hlds_run -game cstrike -port 27015 +maxplayers 24 +map de_dust2 -secure -master" > startserver
chmod 755 startserver
sudo echo "cd ~/hlds && ./startserver" > /etc/rc.local
sudo chmod +x /etc/rc.local

 

# Configurações do PodBot pós instalação:

A configuração padrão adiciona apenas 7 Bots, ainda que esteja configurado para um máximo de 16 Bots no podbot.cfg.
Segue configuração original de adição automática de bots:

# These lines below are adding automatically the bots to the server when
# the new game is created on the listenserver or the dedicated server
# is starting.
# As many such lines like "pb add" is here as many bots will be added 
# to the server (unless You will not exceed pb_maxbots setting).
pb add 100
pb add 100
pb add 100
pb add 100
pb add 100
pb add 100
pb add 100

# To prevent put for example 16 lines like above ones, to just fill up 
# the server with pb_maxbots, just remove the comment from the line below.
# pb fillserver 100

 

Para consertar isso, edite o arquivo para deixa-lo da seguinte maneira (as confs ficam bem lá no fim do arquivo):

vim ~/hlds/cstrike/addons/podbot/podbot.cfg

https://canaltech.com.br/linux/conheca-e-aprenda-a-usar-o-editor-vim-no-linux/

# These lines below are adding automatically the bots to the server when
# the new game is created on the listenserver or the dedicated server
# is starting.
# As many such lines like "pb add" is here as many bots will be added 
# to the server (unless You will not exceed pb_maxbots setting).
#pb add 100
#pb add 100
#pb add 100
#pb add 100
#pb add 100
#pb add 100
#pb add 100

# To prevent put for example 16 lines like above ones, to just fill up 
# the server with pb_maxbots, just remove the comment from the line below.
pb fillserver 100

Se quiser diminuir a dificuldade dos BOTS, reduza o número de 100 para um inferior.

Outra configuração que recomendo alterar nesse mesmo arquivo é a de reiniciar a partida assim que o primeiro humano se conectar no server, caso contrário vc vai se conectar e ficar esperando os BOTS se matarem pra só então conseguir começar a jogar.
A configuração pb_firsthumanrestart deve ter o valor alterado de 0 pra 1, e se encontra na linha 102 do arquivo podbot.cfg.

# Set this to 1 to switch on the round restart
# after the first human joins the server 
# (when bots are playing there in 2 teams)
pb_firsthumanrestart 1

 

# Segurança e Configurações do Server:

É importante colocar uma senha para o rcon no seu server, ou qualquer um com a senha padrão pode arruinar tudo.
Opcionalmente é possível colocar uma senha pra entrar no server, caso queira fazer um DS privado ou por convite.
Também é possível definir algumas variáveis do jogo, como por exemplo a quantidade e o tempo limite do round, ou quanto tempo ou quantas vitórias até forçar trocar de mapa.
Mais informações: http://www.csro.com.br/outros/rcon_comandos.html

vim ~/hlds/cstrike/server.cfg

Um exemplo de server.cfg customizado:

// Use this file to configure your DEDICATED server. 
// This config file is executed on server start.

// disable autoaim
sv_aim 0

// disable clients' ability to pause the server
pausable 0

// default server name. Change to "Bob's Server", etc.
hostname "Dedicated Server for CS 1.6 - Invite Only"

// maximum client movement speed 
sv_maxspeed 320

// no cheats
sv_cheats 0

// load ban files
exec listip.cfg
exec banned.cfg

// 7 win limit
mp_winlimit 7

// 10 minute time limit
mp_timelimit 10

// 10 round limit
mp_roundlimit 10

// 3 minute round limit
mp_roundtime 3

// password
sv_password "123456789"
rcon_password "987654321"

 

# Run Forrest, Run!

Após tudo isso, você pode iniciar o seu server:

cd ~/hlds && ./startserver
screen -r csserver

 

# Adicional: Comandos para iniciar mapas diferentes

O mapa padrão é o de_dust2, como indicado no arquivo startserver criado anteriormente.

Use um dos comandos abaixo na shell pra iniciar o server com um mapa diferente:

cd ~/hlds && screen -A -m -d -S csserver ./hlds_run -game cstrike -port 27015 +maxplayers 24 +map as_oilrig -secure -master
cd ~/hlds && screen -A -m -d -S csserver ./hlds_run -game cstrike -port 27015 +maxplayers 24 +map cs_747 -secure -master
cd ~/hlds && screen -A -m -d -S csserver ./hlds_run -game cstrike -port 27015 +maxplayers 24 +map cs_assault -secure -master
cd ~/hlds && screen -A -m -d -S csserver ./hlds_run -game cstrike -port 27015 +maxplayers 24 +map cs_backalley -secure -master
cd ~/hlds && screen -A -m -d -S csserver ./hlds_run -game cstrike -port 27015 +maxplayers 24 +map cs_estate -secure -master
cd ~/hlds && screen -A -m -d -S csserver ./hlds_run -game cstrike -port 27015 +maxplayers 24 +map cs_havana -secure -master
cd ~/hlds && screen -A -m -d -S csserver ./hlds_run -game cstrike -port 27015 +maxplayers 24 +map cs_italy -secure -master
cd ~/hlds && screen -A -m -d -S csserver ./hlds_run -game cstrike -port 27015 +maxplayers 24 +map cs_militia -secure -master
cd ~/hlds && screen -A -m -d -S csserver ./hlds_run -game cstrike -port 27015 +maxplayers 24 +map cs_office -secure -master
cd ~/hlds && screen -A -m -d -S csserver ./hlds_run -game cstrike -port 27015 +maxplayers 24 +map cs_siege -secure -master
cd ~/hlds && screen -A -m -d -S csserver ./hlds_run -game cstrike -port 27015 +maxplayers 24 +map de_airstrip -secure -master
cd ~/hlds && screen -A -m -d -S csserver ./hlds_run -game cstrike -port 27015 +maxplayers 24 +map de_aztec -secure -master
cd ~/hlds && screen -A -m -d -S csserver ./hlds_run -game cstrike -port 27015 +maxplayers 24 +map de_cbble -secure -master
cd ~/hlds && screen -A -m -d -S csserver ./hlds_run -game cstrike -port 27015 +maxplayers 24 +map de_chateau -secure -master
cd ~/hlds && screen -A -m -d -S csserver ./hlds_run -game cstrike -port 27015 +maxplayers 24 +map de_dust -secure -master
cd ~/hlds && screen -A -m -d -S csserver ./hlds_run -game cstrike -port 27015 +maxplayers 24 +map de_dust2 -secure -master
cd ~/hlds && screen -A -m -d -S csserver ./hlds_run -game cstrike -port 27015 +maxplayers 24 +map de_inferno -secure -master
cd ~/hlds && screen -A -m -d -S csserver ./hlds_run -game cstrike -port 27015 +maxplayers 24 +map de_nuke -secure -master
cd ~/hlds && screen -A -m -d -S csserver ./hlds_run -game cstrike -port 27015 +maxplayers 24 +map de_piranesi -secure -master
cd ~/hlds && screen -A -m -d -S csserver ./hlds_run -game cstrike -port 27015 +maxplayers 24 +map de_prodigy -secure -master
cd ~/hlds && screen -A -m -d -S csserver ./hlds_run -game cstrike -port 27015 +maxplayers 24 +map de_survivor -secure -master
cd ~/hlds && screen -A -m -d -S csserver ./hlds_run -game cstrike -port 27015 +maxplayers 24 +map de_torn -secure -master
cd ~/hlds && screen -A -m -d -S csserver ./hlds_run -game cstrike -port 27015 +maxplayers 24 +map de_train -secure -master
cd ~/hlds && screen -A -m -d -S csserver ./hlds_run -game cstrike -port 27015 +maxplayers 24 +map de_vertigo -secure -master

 

#Adicional: Comandos para mudar de mapa durante uma partida

Os comandos abaixo devem ser executados no console do jogo (Tecla ').

Primeiro use rcon com a senha definida no arquivo server.cfg

rcon_password 987654321

Para testar se tá tudo certo use o comando

rcon status

Estando tudo OK (se não der bad password), use um dos comandos abaixo para forçar mudar o mapa no server:

rcon changelevel as_oilrig
rcon changelevel cs_747
rcon changelevel cs_assault
rcon changelevel cs_backalley
rcon changelevel cs_estate
rcon changelevel cs_havana
rcon changelevel cs_italy
rcon changelevel cs_militia
rcon changelevel cs_office
rcon changelevel cs_siege
rcon changelevel de_airstrip
rcon changelevel de_aztec
rcon changelevel de_cbble
rcon changelevel de_chateau
rcon changelevel de_dust
rcon changelevel de_dust2
rcon changelevel de_inferno
rcon changelevel de_nuke
rcon changelevel de_piranesi
rcon changelevel de_prodigy
rcon changelevel de_survivor
rcon changelevel de_torn
rcon changelevel de_train
rcon changelevel de_vertigo

 

Link para o comentário
Compartilhar em outros sites

  • 9 months later...
×
×
  • Criar Novo...