Custom dedicated server commands in console window

Hello,

I’m making a game where I wanna integrate dedicated server in it, and I want to let the host users to be able to write commands into the console window and let the server reply with something.

Think of it as minecraft’s server commands, for example:
list - would return a string containing current players/total players
tell [player] - the server would send a message to a player
kick/ban/warn [player] - would do stuff according to the command.

I know how to code all that functionality, what I don’t know is where to put the code. Is it a simple exec function? Or I need to modify the engine?

Best regards,
YoungWolf

your likely better off making an Rcon type thing where your server listens on a certain port for commands, then from a program you can use or write yourself send those commands to the server on the right port to the right address with the correct credentials. This will allow remote access to those functions down the line rather then only being able to use the console window.

Hmm, I get your point… yes that would be good workaround. But… is there something rcon integrated in UE4? Or I gotta implement it myself? I take it RCON is a special protocol, or I can just create a TCP Socket and listen on it for commands?

Did you ever made progress on this, cause I’m also interested.

While I didn’t make anything that is working state, I did manage to make simple commands. Integrating such a system with UE4 turned out a bit harder for me. But I can give you tips on how to do it:

  1. Make a 3rd party client application (I used C#) - simple console application that connects to a tcp server, send and recieves messages
  2. Listen a tcp socket in ue4 on any port.
  3. Bind event to recieve data, on recieve data determine which command is called by string and call it

What’s cool about it is you can pass any parameters in a .ini way and you can parse them like a string and pass them to the function you want to execute.

My personal idea for this was to write an rcon like plugin, which is secured with RSA-2048 and AES256 keys to encrypt data transfer between the client and the server, which I made working, but problem was I couldn’t implement stuff like showing the console output of the server on the client application and other stuff just because I don’t know how.

I believe there must be a better way to do this, but I’m not sure what and how.

Best regards,
YoungWolf

Do you mind sharing the project on github? I have this idea and i cant find any resources to start with, i believe i can create a rcon server to receive the command and send back the response, i made a c++ library to make a rcon client as well but i dont know where to start how to tie everything up to use it on my dedicated server, im currently looking to make a plugin now and create custom c++ function to use it inside ue