Skip to content
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
4 changes: 4 additions & 0 deletions automated_updates_data.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@
{
"date": "2026-02-24",
"summary": "Fixed custom behavior lifecycle method names (onStepPreEvents/onStepPostEvents → doStepPreEvents/doStepPostEvents) and updated collisions doc to reference Physics 2 instead of deprecated Physics behavior"
},
{
"date": "2026-02-25",
"summary": "Improved network docs with HTTP methods, content-type, error handling, CORS warning, and async note; improved gamepad docs with trigger pressure, stick axes, deadzone, and LastButton expressions"
}
]
}
29 changes: 28 additions & 1 deletion docs/gdevelop5/all-features/gamepad/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,37 @@ Detecting pressed buttons can be done with the **Gamepad button pressed** (or **

#### Handle sticks

`Gamepads::StickAngle` and `Gamepads::StickForce` [expressions](/gdevelop5/all-features/expressions) can be used to apply a force on an object.
Several [expressions](/gdevelop5/all-features/expressions) are available for analog sticks:

- `Gamepads::StickAngle(gamepad, stick)` – the angle (in degrees) the stick is pushed toward, useful for rotating an object or setting a movement direction.
- `Gamepads::StickForce(gamepad, stick)` – the magnitude of the stick push, from 0 (centre) to 1 (full deflection). Useful as a speed multiplier.
- `Gamepads::StickForceX(gamepad, stick)` – the horizontal component, from -1 (left) to 1 (right).
- `Gamepads::StickForceY(gamepad, stick)` – the vertical component, from -1 (up) to 1 (down).

The `stick` parameter is `"left"` or `"right"`.

![](gamepad-stick-expression.png)

#### Handle triggers (LT / RT)

Triggers are analog and return a pressure value between 0 (not pressed) and 1 (fully pressed):

`Gamepads::TriggerPressure(gamepad, trigger)` – where `trigger` is `"LT"` / `"L2"` for the left trigger and `"RT"` / `"R2"` for the right trigger.

This is useful for games where you want variable speed (e.g. acceleration in a racing game).

#### Configuring the deadzone

Analog sticks rarely return exactly 0 when at rest. A **deadzone** ignores small unintentional inputs near the centre. The default deadzone is `0.2` (20 % of the full range).

Use the action **Set gamepad deadzone for sticks** to change it. You can also read the current value with `Gamepads::Deadzone(gamepad)`.

A lower deadzone gives more precise control but may cause drift; a higher deadzone filters out more noise but reduces the usable range of the stick.

#### Detecting the last pressed button

`Gamepads::LastButtonString(gamepad, layout)` returns the name of the last button pressed (e.g. `"A"` or `"CROSS"`), useful to display button hints that match the connected controller. `Gamepads::LastButtonID(gamepad)` returns its numeric index instead.

## Handle several players on the same device

### Detect connected gamepads
Expand Down
35 changes: 35 additions & 0 deletions docs/gdevelop5/all-features/network/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,24 @@ GDevelop provides the action called "Send a request to a web page". You can spec

When the server sends the response, it is saved in a variable so that you can read what was sent.

## HTTP methods

In addition to **GET** and **POST**, the action supports other HTTP methods such as **PUT**, **DELETE**, and **PATCH**. These are commonly used when talking to REST APIs:

- **GET** – retrieve data from the server (no body)
- **POST** – submit data to the server (e.g., create a record)
- **PUT** / **PATCH** – update an existing record
- **DELETE** – delete a record

Choose the method expected by the API you are calling.

## Content-Type

The **Content-Type** field tells the server how the body of the request is formatted. The two most common values are:

- `application/x-www-form-urlencoded` (the default) – use this with query-string bodies for GET/POST forms
- `application/json` – use this when the body is a JSON string (required by many modern APIs)

## How to format the content

* For GET requests, parameters have to be sent in the content in the format of a "query string":
Expand All @@ -33,6 +51,23 @@ You can send data from a variable, for example:
You can either construct it yourself:
`"{\"score\": " + VariableString(Score) + " }"` (note the use of backslash before the quote `\"`, to allow the quote to be used inside a text) or use the expression to convert a variable structure to JSON: `ToJSON(VariableWithData)` (see more about this below).

## Handling the server response and errors

The action stores the server's reply in the **response variable** you specify. If the request fails, the **error variable** is filled instead:

- If the server returns an HTTP error (status code ≥ 400), the error variable is set to that status code (e.g., `404` or `500`).
- If the request could not be sent at all (network error, CORS block, etc.), the error variable is set to `"REQUEST_NOT_SENT"`.

You can use a condition checking the error variable to detect failures and react accordingly (show a retry message, fall back to cached data, etc.).

!!! warning

Requests are **asynchronous**: the response variable is not filled on the same frame the request is sent. Use the [Wait for request to finish action](/gdevelop5/events/async/) or check the error/response variables in a following event triggered on the next frames.

!!! note

**CORS (Cross-Origin Resource Sharing)**: Browsers block requests to servers that do not explicitly allow them from a web page. If your game runs in a browser and you receive `"REQUEST_NOT_SENT"`, the target server may not have CORS enabled. This is not an issue when the game is exported as a desktop or mobile app.

## Converting variables to JSON and back to variables

### Variable to JSON
Expand Down