Skip to content

Full documentation

Pardons Julien edited this page Sep 25, 2013 · 25 revisions

Information

This document is for developpers / integrator for the eBot tools. If you are a common user, just don't read it, it will confuse yourself ! :)

eBot Scheme

To understand how eBot works, you need to understand the scheme. eBot has 2 distingued parts:

  • The PHP daemon + NodeJS server
  • The web pannel

eBot can works without the web pannel, this is just to control eBot and see the results / stats. You can develop one on your own !

CS:GO & log stream

To understand how the eBot works, you need to know how the bot grab the datas. CS:GO have a log stream in UDP that we read. With a simple rcon commands, the bot add his own server address/port that it listen and the server begin to send the data.

Major common issue is a firewall who is blocking the UDP stream between the server and eBot, if you don't have any output on the eBot daemon, it's that kind of issue.

eBot runtime

eBot deamon

The eBot daemon works like this:

  • Each 3 seconds, it check in the database for new matchs
  • Each loop time, it read from the UDP Socket
  • Each loop time, the TaskManager is executed to process all tasks

eBot has a control interface trought the UDP server. Here is the list of the commands available:

  • stop
  • stopNoRs
  • executeCommand
  • passknife
  • forceknife
  • forceknifeend
  • forcestart
  • stopback
  • pauseunpause
  • fixsides
  • streamerready
  • goBackRounds
  • skipmap

We will see later how to communicate and send this kind of command

NodeJS server

The NodeJS server is just a forwarder, it forward some messages to all connected users. It's the bot who send the datas.

The server can send too some commands to the eBot server, it's not required, you can make it on your own. The NodeJS server is required for the auto demos upload, when a match end, the demos it pushed to the server, who archive and rename the file into the right dir.

Since Socket.io update, we dropped native WebSocket support for better performance. We won't have no more issue with strange disconnection or something like that

Database scheme

Matchs structure

Teams & Seasons

Adverts

Query sample

Interact with eBot

Information

To interact with eBot, we have developped an encrypted system to send secured message to eBot. As eBot is listenning a public server IP/PORT, anybody can send an UDP packet to the server. To secure the whole, we use AES encryption with an unique key per match.

It's simple, each match have his own cryptkey, and to detect the match_id / encrypted message, we use a JSON string. You will need to send a string like this:

The cryptkey field on the database is "config_authkey"

["COMMAND ENCRYPTED", "#MATCH_ID"]

The order is very important, as for now we don't use an associative array for the data. It's an upgrade that we will do in the future

eBot-WEB / NodeJS / eBot

For now, when you send a command from the eBot-WEB, the command is sent via the NodeJS server who forward it to the eBot server.

You can too send this kind of packet to the eBot server directly instead of sending the message to the NodeJS server.

As we are PHP Developper, we will put some example soon online :)

Commands & structure

When you encrypt your message, you have to follow a format. We plan to change this format soon.

Commands list

  • stopNoRs: Stop the match without restart round | #matchid stopNoRs #serverip | sample: 1 stopNoRs 192.168.1.1:27015
  • stop: Stop the match with a restart round | #matchid stop #serverip | sample: 1 stop 192.168.1.1:27015
  • executeCommand: Send an rcon command to the game server, reply will follow on the NodeJS server on the rcon channels | #matchid executeCommand #serverip #command | sample: 1 executeCommand 192.168.1.1:27015 mp_restartgame 1
  • passknife: Pass the knife round (if in warmup knife) | #matchid passknife #serverip | sample: 1 passknife 192.168.1.1:27015
  • forceknife: Force the start of the knife round | #matchid forceknife #serverip | sample: 1 forceknie 192.168.1.1:27015
  • forceknifeend: End the knife round and go on the warmup | #matchid forceknifeend #serverip | sample: 1 forceknifeend 192.168.1.1:27015
  • forcestart: For the start of a match (if in warmup) | #matchid forcestart #serverip | sample: 1 forcestart 192.168.1.1:27015
  • stopBack: Stop the match | #matchid stopBack #serverip | sample: 1 stopBack 192.168.1.1:27015
  • pauseunpause: If match is paused, it will unpause, if match is unpaused, it will pause | #matchid pauseunpause #serverip | sample: 1 pauseunpause 192.168.1.1:27015
  • fixsides: Force to send the team names on the server | #matchid fixsides #serverip | sample: 1 fixsides 192.168.1.1:27015
  • streamerready: If the config stream ready is set, it will send a message to set that streamer are ready | #matchid streamready #serverip | sample: 1 streamerready 192.168.1.1:27015
  • goBackRounds: Load a backup round, be carrefull when using this func ! | #matchid goBackRounds #serverip #roundId | sample: 1 goBackRounds 192.168.1.1:27015 5

Send command via JS

On the eBot-WEB platform, we integrated an encryption class for JavaScript.

Here is a sample code: javascript function encryptCommand(matchId, eventData, serverIp, authkey) { var data = matchId + " " + eventData + " " + serverIp; data = Aes.Ctr.encrypt(data, authkey, 256); var content = JSON.stringify([data, ip]); return content; }

If the socket.io is declared, you just need to make this to send the packet: javascript socket.emit("matchCommandSend", encryptedData);

NodeJS server

eBot-WEB information

Clone this wiki locally