Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create Command System #5

Open
9 tasks done
William-McGonagle opened this issue Jun 28, 2021 · 1 comment
Open
9 tasks done

Create Command System #5

William-McGonagle opened this issue Jun 28, 2021 · 1 comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@William-McGonagle
Copy link
Collaborator

William-McGonagle commented Jun 28, 2021

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

0x03      spawn cow

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

0x00      Invalid Permissions

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

0x01      Cow Successfully Spawned

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

  • Request
    • There are no buffer overflow or errors generated by the function
    • The commands are interpreted as strings and have a shell-like syntax
    • The developer can create custom commands that have an express-like syntax
  • Response
    • The responses can have a code ranging anywhere from 0x00 to 0xFF.
    • They can be easily interpreted by clients
    • All response messages have a code to start them
    • All replies have a reason for failure or information if its a success
@William-McGonagle William-McGonagle added enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed labels Jun 29, 2021
@William-McGonagle
Copy link
Collaborator Author

Although I didn't document its development, the command system is now done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant