Create Command System #5
Labels
enhancement
New feature or request
good first issue
Good for newcomers
help wanted
Extra attention is needed
Idea
I love playing TF2. Like if I were to give an award for some of the best games of all time, my top three would probably be Wii Sports, TF2, and CS:GO. There are a couple of things that make these games great. But, one of the best things (mostly for TF2 and CS:GO) is the ability for users to create their own experiences. In these two games, the way this is done is through server commands. There are command prompts for users to enter in commands, and if the command is to affect everyone on the server (like altering gravity), the client just sends the command to the server. From here, the server determines if the user has the right permissions, and if they do, the command is executed. The results from the command are then sent back to the user as well, but that is not as important.
Implementation
So, the console system needs to be fairly straightforward. The user sends a UDP packet to the server, and the server responds with another UDP packet. I am more of a visual learner, and probably more of a visual teacher too, so I will just show examples below and write notes below them.
Client
The user wants the server to read a message from it, so it needs to start with '0x03'. After that, all of the following message is written in plaintext and will be interpreted as a string.
Server
The user is not an administrator, so they are unable to run the command. The server must reply with a code of '0x00' to show that the command has failed, and an error message following it. The error message will always be a string.
Server
The user has the right permissions, so the command was successfully run. The first byte is '0x01' to show that it was a success, and from there, the server can leave whatever message it wants.
Requirements
The text was updated successfully, but these errors were encountered: