Skip to content

Commit

Permalink
Merge pull request #128 from nilsraccoon/new
Browse files Browse the repository at this point in the history
Improved formatting and fixed typos
  • Loading branch information
Snowiiii authored Oct 16, 2024
2 parents 05bcde4 + 4d2e637 commit b6c2b88
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 64 deletions.
9 changes: 4 additions & 5 deletions docs/about/benchmarks.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@

Here, I compare common Minecraft servers against Pumpkin.

Is this comparison fair?. Not really. While you could say Pumpkin currently has way fewer features than other Servers which should use less resources, You should also consider that other Servers had already Years for
Optimizations, Especially Vanilla forks, which don't have to go through the pain of rewriting the entire vanilla logic, are free to focus on optimizations
Is this comparison fair? Not really. While Pumpkin currently has far fewer features than other servers, which might suggest it uses fewer resources, it's important to consider that other servers have had years for optimization. Especially vanilla forks, which don’t need to rewrite the entire vanilla logic, can focus exclusively on optimizations.

ALL TESTS HAVE BEEN RAN MULTIPLE TIMES TO GUARANTEE CONSISTENT RESULTS

ALL PLAYERS DID NOT MOVE WHEN SPAWNING, ONLY THE INITIAL 8 CHUNKS WERE LOADED, THAT'S ALSO THE REASON CPU MAX IS USUALLY HIGH ON THE FIRST PLAYER
ALL SERVERS USED ITS OWN TERRAIN GENERATION, NO WORLD WAS PRE-LOADED
ALL SERVERS USED THEIR OWN TERRAIN GENERATION, NO WORLD WAS PRE-LOADED

![Screenshot From 2024-10-15 16-42-53](https://github.com/user-attachments/assets/e08fbb00-42fe-4479-a03b-11bb6886c91a)

Expand Down Expand Up @@ -49,7 +48,7 @@ ALL SERVERS USED ITS OWN TERRAIN GENERATION, NO WORLD WAS PRE-LOADED
- Online mode: false
- Rcon: false

<sub><sup>online mode was disabled, so i can easier test with non premium accounts</sup></sub>
<sub><sup>online mode was disabled for easier testing with non-premium accounts</sup></sub>

## Pumpkin

Expand All @@ -73,7 +72,7 @@ Run args:
| 5 | 26,0MB | 0,0% | 1,0% |
| 10 | 27,1MB | 0,0% | 1,5% |

<sub><sup>pumpkin does cache already loaded chunks, resulting in no extra RAM besides player data and minimal CPU usage</sup></sub>
<sub><sup>pumpkin does cache already loaded chunks, resulting in no extra RAM usage besides player data and minimal CPU usage</sup></sub>

#### Compile time
Compiling from Nothing
Expand Down
10 changes: 5 additions & 5 deletions docs/about/quick-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ git clone https://github.com/Snowiiii/Pumpkin.git
cd Pumpkin
```

You may also have to [install rust](https://www.rust-lang.org/tools/install) when you don't already have it.
You may also have to [install rust](https://www.rust-lang.org/tools/install) if you don't already have it.

You can place a vanilla world into the Pumpkin/ directory when you want. Just name the World to `world`
You can place a vanilla world into the Pumpkin/ directory if you want. Just name the World `world`

Then run:

> [!NOTE]
> This can take a while. Because we enabled heavy optimizations for release builds
> This can take a while because we enabled heavy optimizations for release builds
>
> To apply further optimizations specfic to your CPU and use your CPU features. You should set the target-cpu=native
> To apply further optimizations specific to your CPU and use your CPU features, you should set the target-cpu=native
> Rust flag.
```shell
Expand All @@ -34,7 +34,7 @@ The image is currently not published anywhere, but you can use the following com
docker build . -t pumpkin
```

To run, it use the following command:
To run it, use the following command:

```shell
docker run --rm -p 25565:25565 -v "./world:/pumpkin/world" pumpkin
Expand Down
33 changes: 14 additions & 19 deletions docs/developer/authentication.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,44 +2,39 @@

### Why Authentication

Minecraft is the most Popular game out there, And is very easy to play it without paying for it. In Fact, you don't pay for the Game, You pay for a Minecraft Account.
People who don't buy the Game, but play it online are using [Cracked Accounts](#cracked-accounts)
Minecraft is the most popular game out there and is very easy to play without paying for it. In fact, you don't pay for the game; you pay for a Minecraft account. People who don't buy the game but play it online are using [Cracked Accounts](#cracked-accounts).

#### Cracked Accounts

- Don't cost any Money
- Everyone can set their own Nickname
- Have no UUID
- Have no Skin/Cape
- Not Secure
- Don't cost any money.
- Everyone can set their own nickname.
- Have no UUID.
- Have no skin/cape.
- Not secure.

The Problem is that everyone can name themselves however they want, by, for example, allowing them to Join the Server as a Staff Member for example and having extended permissions.
Cracked accounts are also often used for Botting and [Denial of Service](https://de.wikipedia.org/wiki/Denial_of_Service) attacks.
The problem is that everyone can name themselves however they want, which allows them to join the server as a staff member, for example, and have extended permissions. Cracked accounts are also often used for botting and [Denial of Service](https://de.wikipedia.org/wiki/Denial_of_Service) attacks.

### Cracked Server

By default, the `online_mode` is enabled in the configuration, This enables Authentication disabling [Cracked Accounts](#cracked-accounts). When you are willing to allow Cracked Accounts, you can disable `online_mode`
in the `configuration.toml`
By default, `online_mode` is enabled in the configuration. This enables authentication, disabling [Cracked Accounts](#cracked-accounts). If you want to allow cracked accounts, you can disable `online_mode` in the `configuration.toml`.

### How Mojang Authentication works
### How Mojang Authentication Works

To ensure a player has a premium accounts:
To ensure a player has a premium account:

1. A client with a premium account sends a login request to the Mojang session server.
2. **Mojang's servers** verify the client's credentials and add the player to their servers.
3. Now, our server will send a Request to the Session servers and check if the Player has joined the Session Server.
4. If the request is successful, It will give use more information about the Player (e.g. UUID, Name, Skin/Cape...)
3. Our server sends a request to the session servers to check if the player has joined the session server.
4. If the request is successful, it will provide more information about the player (e.g., UUID, name, skin/cape...).

### Custom Authentication Server

Pumpkin does support custom Authentication servers, You can replace the Authentication URL in `features.toml`.
Pumpkin does support custom authentication servers. You can replace the authentication URL in `features.toml`.

#### How Pumpkin Authentication Works

1. **GET Request:** Pumpkin sends a GET request to the specified authentication URL.

2. **Status Code 200:** If the authentication is successful, the server responds with a status code of 200.

3. **Parse JSON Game Profile:** Pumpkin parses the JSON game profile returned in the response.

#### Game Profile
Expand All @@ -49,7 +44,7 @@ struct GameProfile {
id: UUID,
name: String,
properties: Vec<Property>,
profile_actions: Option<Vec<ProfileAction>>, // Optional, Only present when actions are applied
profile_actions: Option<Vec<ProfileAction>>, // Optional, only present when actions are applied
}
```

Expand Down
27 changes: 14 additions & 13 deletions docs/developer/networking.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
### Networking

Most of the Networking code in Pumpkin, can be found at [Pumpkin-Protocol](https://github.com/Snowiiii/Pumpkin/tree/master/pumpkin-protocol)
Most of the Networking code in Pumpkin can be found at [Pumpkin-Protocol](https://github.com/Snowiiii/Pumpkin/tree/master/pumpkin-protocol)

Serverbound: Client→Server

Expand All @@ -16,11 +16,11 @@ Packets in the Pumpkin protocol are organized by functionality and state.

### States

**Handshake**: Always the first packet being sent from the Client. This begins also determines the next state, usually to indicate if the player wants to perform a Status Request, Join the Server or want to be transferred.
**Handshake**: Always the first packet being sent from the Client. This also determines the next state, usually to indicate if the player wants to perform a Status Request, join the server or wants to be transferred.

**Status**: Indicates the Client wants to see a Status response (MOTD).

**Login**: The Login sequence. Indicates the Client wants to join to the Server
**Login**: The Login sequence. Indicates the Client wants to join to the Server.

**Config**: A sequence of Configuration packets is mostly sent from the Server to the Client. (Features, Resource Pack, Server Links, etc.)

Expand All @@ -29,7 +29,7 @@ Packets in the Pumpkin protocol are organized by functionality and state.
### Minecraft Protocol

You can find all Minecraft Java packets at https://wiki.vg/Protocol. There you also can see in which [State](#States) they are.
You can also can see all the information the Packets have, which we can either Write or Read depending on whether they Serverbound or Clientbound
You can also can see all the information the Packets have, which we can either Write or Read depending on whether they are Serverbound or Clientbound.

### Adding a Clientbound Packet

Expand All @@ -49,7 +49,7 @@ You can also can see all the information the Packets have, which we can either W

> [!IMPORTANT]
> Please start the Packet name with "C" for Clientbound.
> Also please add the State to the packet if its a Packet sended in multiple States, For example there are 3 Disconnect Packets.
> Also please add the State to the packet if its a Packet sent in multiple States, For example there are 3 Disconnect Packets.
>
> - CLoginDisconnect
> - CConfigDisconnect
Expand All @@ -69,7 +69,7 @@ pub struct CPlayDisconnect {
}
```

4. Also don't forgot to impl a new function for Clientbound Packets so we can actually send them by putting in the values
4. Also don't forgot to impl a new function for Clientbound Packets so we can actually send them by putting in the values.

Example:

Expand All @@ -81,7 +81,7 @@ impl CPlayDisconnect {
}
```

5. At the End, everything should come together.
5. In the end, everything should come together.

```rust
#[derive(Serialize)]
Expand All @@ -97,7 +97,7 @@ impl CPlayDisconnect {
}
```

6. You can also Serialize the Packet manually, Which can be useful if the Packet is more complex
6. You can also Serialize the Packet manually, which can be useful if the Packet is more complex.

```diff
-#[derive(Serialize)]
Expand Down Expand Up @@ -128,7 +128,7 @@ impl CPlayDisconnect {

> [!IMPORTANT]
> Please start the Packet name with "S" for Serverbound.
> Also please add the State to the packet if its a Packet sended in multiple States.
> Also please add the State to the packet if its a Packet sent in multiple States.
Create fields within your packet structure to represent the data that will be sent to the client.

Expand All @@ -146,7 +146,7 @@ pub struct SPlayerPosition {
}
```

4. At the End, everything should come together.
4. In the end, everything should come together.

```rust
#[derive(Deserialize)]
Expand All @@ -159,7 +159,7 @@ pub struct SPlayerPosition {
}
```

5. You can also Deserialize the Packet manually, Which can be useful if the Packet is more complex
5. You can also Deserialize the Packet manually, which can be useful if the Packet is more complex

```diff
-#[derive(Deserialize)]
Expand Down Expand Up @@ -267,9 +267,10 @@ For Players:
```

### Compression
Minecraft Packets **can** use the ZLib compression for decoding/ encoding. There is usually a threshold set when compression is applied, This most often affects Chunk Packets.
Minecraft Packets **can** use the ZLib compression for decoding/encoding. There is usually a threshold set when compression is applied, this most often affects Chunk Packets.

### Porting

To port to a new Minecraft version, You can compare difference in Protocol on wiki.vg https://wiki.vg/index.php?title=Protocol&action=history
To port to a new minecraft version, you can compare difference in Protocol on [wiki.vg](https://wiki.vg/index.php?title=Protocol&action=history)

Also change the `CURRENT_MC_PROTOCOL` in `src/lib.rs`
43 changes: 21 additions & 22 deletions docs/developer/rcon.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,39 @@

### What is RCON

RCON (Remote Console) is a protocol designed by Valve to allow administrators to control and manage game servers remotely.
It provides a way to execute commands on a server from a different location, such as a phone or a separate computer.
RCON (Remote Console) is a protocol designed by Valve to allow administrators to control and manage game servers remotely. It provides a way to execute commands on a server from a different location, such as a phone or a separate computer.

### Why RCON

- Convenience: Manage your server from anywhere with an internet connection.
- Flexibility: Execute commands without needing to be physically present at the server's location.
- Efficiency: Automate tasks and streamline server management.
- **Convenience:** Manage your server from anywhere with an internet connection.
- **Flexibility:** Execute commands without needing to be physically present at the server's location.
- **Efficiency:** Automate tasks and streamline server management.

### SSH vs RCON

**SSH**

- Offers strong encryption to protect data transmitted between the client and server
- Primarily designed for secure remote login and execution of commands on a remote machine
- Common for managing Linux/Unix systems, configuring networks, and running scripts.
- Provides a shell-like environment, allowing you to execute various commands and interact with the remote system
- Offers strong encryption to protect data transmitted between the client and server.
- Primarily designed for secure remote login and execution of commands on a remote machine.
- Commonly used for managing Linux/Unix systems, configuring networks, and running scripts.
- Provides a shell-like environment, allowing you to execute various commands and interact with the remote system.

**RCON**

- Specifically designed for remote administration of game servers, allowing you to control and manage the server's settings and operations
- Typically less secure than SSH, as it often relies on plain text passwords
- Primarily used by game server administrators to manage game servers
- Limited set of game-specific commands
- Specifically designed for remote administration of game servers, allowing you to control and manage the server's settings and operations.
- Typically less secure than SSH, as it often relies on plain text passwords.
- Primarily used by game server administrators to manage game servers.
- Has a limited set of game-specific commands.

### Packets

RCON is a very simple Protocol it has a few Packets. That's how a RCON Packet looks
RCON is a very simple protocol with a few packets. Here's how an RCON packet looks:

| Field | Description |
| ----- | ----------------------------------------------- |
| ID | For example used when auth failed or succeed |
| Type | That way we know what Packet this is |
| Body | A Message (String) (e.g. A Command, A Password) |
| ID | Used to indicate whether authentication failed or succeeded |
| Type | Identifies the packet type |
| Body | A message (String), e.g., a command or a password |

#### Server Bound Packets <sub><sub>(Client→Server)</sub></sub>

Expand All @@ -51,15 +50,15 @@ RCON is a very simple Protocol it has a few Packets. That's how a RCON Packet lo
| 2 | AuthResponse |
| 0 | Output |

### How RCON works
### How RCON Works

1. Authentication:
1. **Authentication:**

- The RCON client sends an authentication packet with the desired password.
- The server verifies the password and responds with an authentication response packet.
- If successful, the response packet includes the same ID as the client send. If unsuccessful, the ID is -1.
- If successful, the response packet includes the same ID as the one sent by the client. If unsuccessful, the ID is -1.

2. Command Execution:
2. **Command Execution:**

- The authenticated client can now send command execution packets, Each packet contains the command to be executed.
- The authenticated client can now send command execution packets, with each packet containing the command to be executed.
- The server processes the command and sends back an output packet containing the result or any error messages.

0 comments on commit b6c2b88

Please sign in to comment.