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

Fix typos #49

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ representative at an online or offline event.

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
arthur.pacaud@hotmail.fr.
<arthur.pacaud@hotmail.fr>.
All complaints will be reviewed and investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the
Expand Down Expand Up @@ -116,13 +116,13 @@ the community.

This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.0, available at
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
<https://www.contributor-covenant.org/version/2/0/code_of_conduct.html>.

Community Impact Guidelines were inspired by [Mozilla's code of conduct
enforcement ladder](https://github.com/mozilla/diversity).

[homepage]: https://www.contributor-covenant.org

For answers to common questions about this code of conduct, see the FAQ at
https://www.contributor-covenant.org/faq. Translations are available at
https://www.contributor-covenant.org/translations.
<https://www.contributor-covenant.org/faq>. Translations are available at
<https://www.contributor-covenant.org/translations>.
7 changes: 4 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Thanks for your interest in contributing to THNK! We value them a lot, and hope to see you stick around :)

Although THNK is a program, non-code contributions are very welcome too! If you do not feel confortable writing code, you can also contribute to the project by:
Although THNK is a program, non-code contributions are very welcome too! If you do not feel comfortable writing code, you can also contribute to the project by:

- Creating and sharing an example
- Publishing video tutorials
Expand All @@ -15,7 +15,7 @@ Although THNK is a program, non-code contributions are very welcome too! If you
- Hunting for bugs
- Code-reviewing PRs
- Sending supportive messages to all contributors :)
- Staring the repository
- Starring the repository

With that said, let's look at how to contribute to THNK!

Expand Down Expand Up @@ -57,11 +57,12 @@ The GDevelop extensions are contained in `extensions`. You can install the lates
## Building - Test your changes

You will need the following tools to build THNK:

- NodeJS (Preferably v16 LTS)
- Yarn
- A system that can run FlatBuffer's `flatc`

When you first download the repository, you will need to install dependencies by running `yarn`. Remember to run it again regularely to ensure you are using the same version and dependencies as everyone else!
When you first download the repository, you will need to install dependencies by running `yarn`. Remember to run it again regularly to ensure you are using the same version and dependencies as everyone else!

To launch a full build of THNK, run `yarn build`. You can also run the build step-by-step:

Expand Down
2 changes: 1 addition & 1 deletion code/adapters/local.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace THNK {
);
const bc = new BroadcastChannel("thnk-local-server");
bc.addEventListener("messageerror", (e) =>
logger.error("An error occured while sending a message!", e)
logger.error("An error occurred while sending a message!", e)
);
const ownID = "" + Date.now() + Math.random() * 1000;

Expand Down
2 changes: 1 addition & 1 deletion code/relay/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Each room can optionally have a variable with data set by the owner of a room. T

## Room tags (TODO)

A room's owne can add and remove tags from their room. Any player can query rooms by one or multiple tags. The amount of rooms returned by a query can be limited.
A room's owner can add and remove tags from their room. Any player can query rooms by one or multiple tags. The amount of rooms returned by a query can be limited.

This can be used for discovering rooms, matchmaking, and cumulating filters on the former two.

Expand Down
2 changes: 1 addition & 1 deletion code/server/SnaphsotManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { serializeRGB } from "./SerializeRGB";
export class SnapshotsManager {
/** The number of diffs to keep */
diffsCount: number;
/** The list of previous difs in case one gets missed by the client. */
/** The list of previous diffs in case one gets missed by the client. */
diffs: Array<Snapshot>;
/** The index of the current diff. */
currentDiff = 0;
Expand Down
2 changes: 1 addition & 1 deletion code/server/THNKServerContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export class THNKServerContext {
runServerCode: boolean = true;
/** List of users that already know this scene, used when unpausing a scene to only send a snapshot to those who do not have it in memory already. */
previouslyConnectedUsers?: Set<string>;
/** Stores snapshots of the diffs of a hanful of previous frames. */
/** Stores snapshots of the diffs of a handful of previous frames. */
snapshotsManager = new SnapshotsManager();

constructor(adapter: ServerAdapter, stateVariables: StateVariables) {
Expand Down
2 changes: 1 addition & 1 deletion code/tests-utils/gdjs-mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ export class Variable {
}

/**
* Unserialize a JSON string into this variable.
* Deserialize a JSON string into this variable.
*
* This just logs an error if the JSON is invalid.
*
Expand Down
2 changes: 1 addition & 1 deletion code/types/thnk.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ declare global {
/** A reference to the `State` variable of the object, if it is replicated and on the server. */
stateVariables: StateVariables;

// Previous values are stored to not send unecessary data
// Previous values are stored to not send unnecessary data
prevX: number;
prevY: number;
prevAngle: number;
Expand Down
8 changes: 4 additions & 4 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ Contributing is simple and welcome! Just submit a PR with your changes.

### Installation

```
$ yarn
```bash
yarn
```

### Display the website with local changes

```
$ yarn start
```bash
yarn start
```

This command starts a local development server and opens it up in a browser window. Most changes are reflected live without having to restart the server.
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/concepts/game-state.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ THNK takes care of synchronizing the game state from the server to the client. F

### Objects

Objects can be marked as game state in THNK by adding the "Synchronize" behvaior on them. This behavior will watch for changes on the object and automatically sync those on clients.
Objects can be marked as game state in THNK by adding the "Synchronize" behavior on them. This behavior will watch for changes on the object and automatically sync those on clients.

:::note

Expand Down
4 changes: 2 additions & 2 deletions docs/docs/getting-started/local-networking.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
sidebar_position: 4
description: A game is never totally the same in multiplayer than it is in single player. Learn how to preview and test out your game's multiplayer locally in this fouth part of the getting started tutorial!
description: A game is never totally the same in multiplayer than it is in single player. Learn how to preview and test out your game's multiplayer locally in this fourth part of the getting started tutorial!
keywords:
- get started
- platformer
Expand Down Expand Up @@ -32,6 +32,6 @@ Before implementing an adapter to connect your players together, it's useful to

## Setup the local adapter

Simply install the [local adapter extension](https://raw.githubusercontent.com/arthuro555/THNK/master/extensions/THNK_Local.json), create a new scene (I like to call it something aalong the lines of `MultiplayerQuickStart`), and put the action from the local adapter to start a server with 2 clients at thee beginning of the scene.
Simply install the [local adapter extension](https://raw.githubusercontent.com/arthuro555/THNK/master/extensions/THNK_Local.json), create a new scene (I like to call it something along the lines of `MultiplayerQuickStart`), and put the action from the local adapter to start a server with 2 clients at the beginning of the scene.

That's it! Now, previewing this scene will start a server with the scene and the amount of clients you requested, each in a separate window, for you to test out the game in multiplayer mode.
10 changes: 5 additions & 5 deletions docs/docs/getting-started/setup-p2p.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Screenshots and videos are still missing, come back later if you need them!

:::

To connect players together, an adapter is required. Each have different tradeoffs, and you can learn [more about each of them here](../misc/picking-an-adapter.md). We'll use P2P as you might already be somewhat familliar with it, as it is integrated in GDevelop.
To connect players together, an adapter is required. Each have different tradeoffs, and you can learn [more about each of them here](../misc/picking-an-adapter.md). We'll use P2P as you might already be somewhat familiar with it, as it is integrated in GDevelop.

## Setting up P2P

Expand All @@ -48,13 +48,13 @@ Then, to connect,

---

First, let's create a menu scene that contains a "Connceting to server" text in the middle. While we are not connected to the broker, it is useless to propose any other option as starting a server or connecting to one is impossible without a P2P ID provided by the broker.
First, let's create a menu scene that contains a "Connecting to server" text in the middle. While we are not connected to the broker, it is useless to propose any other option as starting a server or connecting to one is impossible without a P2P ID provided by the broker.

We can, at the beginning of the scene, simply call the "Connect to the default broker server" action.

:::info TURN/STUN servers

If you are going to add TURN/STUN servers as ICE candidates (recomended as a fallback if the player's firewall block P2P connections), they must be called just before connecting to the broker, not after!
If you are going to add TURN/STUN servers as ICE candidates (recommended as a fallback if the player's firewall block P2P connections), they must be called just before connecting to the broker, not after!

:::

Expand All @@ -81,7 +81,7 @@ That next step is to display two buttons: one for client, one for server.

The client connection should allow typing in an ID. A text input object is the best: it allows to manually write the ID if needed, but also allows pasting in the ID.

Once the player finishes entering the ID, they need to be able to innitiate the connection. You can use a button from the GDevelop asset store for this.
Once the player finishes entering the ID, they need to be able to initiate the connection. You can use a button from the GDevelop asset store for this.

When the button is pressed, simply use the P2P adapter's "Connect to server at < P2P ID >". Use the text input's expressions to get the entered ID.

Expand All @@ -92,7 +92,7 @@ In order for clients to connect, a THNK server needs to be started first. The se
In this game, it makes sense to allow players to join and leave the game anytime after it started, akin to minecraft. Therefore, we'll just start the game scene directly as a THNK P2P server, using the corresponding action from the P2P adapter.

To allow clients to connect, we'll add a _read-only and disabled text input object_ containing the P2P ID in the platformer scene.
This is the best way to make selectable text, allowing to easily copy-paste it in an intuitive manner, while allowoing to also simply read it out to a friend.
This is the best way to make selectable text, allowing to easily copy-paste it in an intuitive manner, while allowing to also simply read it out to a friend.

:::tip Lobby

Expand Down
6 changes: 3 additions & 3 deletions docs/docs/getting-started/simple-platformer.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ Here, player animations:
Therefore, it should be in the client section!

<video
title="IS THIS A MFing HARRY POTTER REFFERENCE?!?"
title="IS THIS A MFing HARRY POTTER REFERENCE?!?"
width="100%"
muted
loop
Expand Down Expand Up @@ -128,7 +128,7 @@ While the player might be controlling fine in single-player, as it stands, the m

The reason is that the behaviors run on both the client, and on the server. Since the server cannot read a player's input though, as that is a client task. The platformer behavior will not receive any inputs as far as the server is concerned, and therefore other clients will not see any movement.

Clients still can move their own character as the client code, which does have access to player inputs, also runs the platformer behavior. Only the server can move objects for all players, hence this movement will not be synchornized.
Clients still can move their own character as the client code, which does have access to player inputs, also runs the platformer behavior. Only the server can move objects for all players, hence this movement will not be synchronized.

In THNK, all player interactions with the game state, from player movement to using an item in the inventory, needs to be sent as a command from the client to the server. It is then the server's job to validate and process the command, updating the game state accordingly for everyone to see.

Expand Down Expand Up @@ -177,7 +177,7 @@ The second issue is the kind of message we are sending. When sending messages, y
Those events are being sent every frame where a key is pressed. That is a lot of messages, and this takes a lot of bandwidth!
If for some reason a message is not received by the server before each tick, e.g. because of short disconnects due to connection instability, then as far as the server is concerned, it is as if the player keeps on pressing and unpressing the button, where, in fact, they are still holding it.

To fix that, let's take another approach: We'll only send 1 message when pressing and 1 when releasing the button. That way, we can send way less messages, and if the connection is or becomes unstable, the server will assume the client is continueing to do what they were doing instead of assuming they stopped doing anything.
To fix that, let's take another approach: We'll only send 1 message when pressing and 1 when releasing the button. That way, we can send way less messages, and if the connection is or becomes unstable, the server will assume the client is continuing to do what they were doing instead of assuming they stopped doing anything.

import smartInput1 from "./img/platformer/smart-input-1.png";
import smartInput2 from "./img/platformer/smart-input-2.png";
Expand Down
4 changes: 2 additions & 2 deletions docs/docs/misc/picking-an-adapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ The best advantage is that it can find the networking method that's the fastest

THNK Rooms allow any player to start a server with any given code, and clients will be able to connect to it over the THNK Relay.

The relay uses µWebSockets, which is a fast networking method, albeit uses TCP and therefore gets more laggy on an reliable network than other adapters. That is its biggest flaw.
The relay uses µWebSockets, which is a fast networking method, albeit uses TCP and therefore gets more laggy on a reliable network than other adapters. That is its biggest flaw.

The biggest advantage is that it uses standard TCP connections, which are never ever blocked by any network.

Expand All @@ -67,6 +67,6 @@ You likely would want to use THNK Rooms (Relay) instead: It allows you to create

### Jackbox games

Jackbox uses a room code system. Since Jackbox is more of a party game, it is something most people will play with their friends and familly, so there is little risk in players knowing each other's IP address. Since multiple games are likely to be played in a row, it's also handy if the code does not change between each game. If the Jackbox game in question needs good reflexes or is otherwise time-based, it's especially important to have a quick connection too. Therefore, it'd be a good fit for P2P. Since players are likely on the local network as well, LAN connections are rarely blocked by the router/firewall as well.
Jackbox uses a room code system. Since Jackbox is more of a party game, it is something most people will play with their friends and family, so there is little risk in players knowing each other's IP address. Since multiple games are likely to be played in a row, it's also handy if the code does not change between each game. If the Jackbox game in question needs good reflexes or is otherwise time-based, it's especially important to have a quick connection too. Therefore, it'd be a good fit for P2P. Since players are likely on the local network as well, LAN connections are rarely blocked by the router/firewall as well.

Note that you might want to add a "Streamer mode" that uses the THNK Rooms adapter instead, though, as a streamer will not want members of their audience to know their IP address, and they'll likely want to get a new room for new audience members to join after each game. This would also help avoid having to install a TURN server.
4 changes: 2 additions & 2 deletions docs/docs/why-thnk.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ THNK by itself doesn't force your game into being a multiplayer game. By default
The real magic of THNK lies in its numerous adapter extensions. An adapter extension allows you to launch a server or client for a specific networking backend in 1 action. The currently available adapters include:

- P2P (World-Wide LAN-like experience)
- Geckos.io (Connect with IP/Hostanme and port)
- Geckos.io (Connect with IP/Hostname and port)
- THNK Rooms (Connect with room codes)

This allows for a variety of types of multiplayer to be implemented without any efforts in mere minutes!
Expand Down Expand Up @@ -72,7 +72,7 @@ THNK is as optimized as it gets for making your games server and client superfas

- It uses a custom binary protocol based on [FlatBuffers](https://google.github.io/flatbuffers/) and [msgpackr](https://github.com/kriszyp/msgpackr), instead of much heavier formats like JSON, and additionally, all messages are compressed using the deflate algorithm, the same as the one used in zip files, to use the most minimal bandwidth and provide faster packing and unpacking of messages.
- It only synchronizes exactly what you tell it to
- It only synchronises things that have changed since the last synchronisation
- It only synchronizes things that have changed since the last synchronization
- It allows having a server update rate slower than the client, and interpolate results on the client, to use up less server resources and bandwidth. (Coming soon!)
- It is written in TypeScript using internal GDevelop APIs to be as fast as a built-in feature

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ THNK takes care of synchronizing the game state from the server to the client. F

### Objects

Objects can be marked as game state in THNK by adding the "Synchronize" behvaior on them. This behavior will watch for changes on the object and automatically sync those on clients.
Objects can be marked as game state in THNK by adding the "Synchronize" behavior on them. This behavior will watch for changes on the object and automatically sync those on clients.

:::note

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
sidebar_position: 4
description: A game is never totally the same in multiplayer than it is in single player. Learn how to preview and test out your game's multiplayer locally in this fouth part of the getting started tutorial!
description: A game is never totally the same in multiplayer than it is in single player. Learn how to preview and test out your game's multiplayer locally in this fourth part of the getting started tutorial!
keywords:
- get started
- platformer
Expand Down Expand Up @@ -32,6 +32,6 @@ Before implementing an adapter to connect your players together, it's useful to

## Setup the local adapter

Simply install the [local adapter extension](https://raw.githubusercontent.com/arthuro555/THNK/master/extensions/THNK_Local.json), create a new scene (I like to call it something aalong the lines of `MultiplayerQuickStart`), and put the action from the local adapter to start a server with 2 clients at thee beginning of the scene.
Simply install the [local adapter extension](https://raw.githubusercontent.com/arthuro555/THNK/master/extensions/THNK_Local.json), create a new scene (I like to call it something along the lines of `MultiplayerQuickStart`), and put the action from the local adapter to start a server with 2 clients at the beginning of the scene.

That's it! Now, previewing this scene will start a server with the scene and the amount of clients you requested, each in a separate window, for you to test out the game in multiplayer mode.
Loading