> For the complete documentation index, see [llms.txt](https://tetrisfriends.benzoft.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://tetrisfriends.benzoft.com/world-mechanics.md).

# World Mechanics

### Grid system

In order for multiple game instances to be running concurrently TetrisFriends makes use of a custom grid based system which spins up new instances on demand. Take a look at the image below:

![](/files/-Ly_xiih56BVPMdttbm-)

It first tries to start a game in the cell in the upper right corner. If that is not possible it proceeds to the next cell and checks. It will continue to do so until it finds a free cell. If it reaches the end of the red arrow it will try in the 16 cells in the next ring and then the 24 cells in the third ring and so on.

### Note on performance

The plugin has a "warm-up" related to the cells. Each cell contains a copy of the selected schematic in the default case each cell has a large arcade machine. When a schematic is pasted it'll spike the server shortly, however, the schematic is only pasted once in each cell. Here's an example:

The plugin has been installed and one player is playing in the first cell where the schematic has been pasted. A second player starts a game which results in a schematic being pasted in the second cell spiking the server shortly. Now both players are done playing and two new players want to play. A schematic has been pasted in the first two cells so there is no need for a schematic to be pasted again thus no spike.

{% hint style="info" %}
You can skip the "warm-up" with the pregeneration command found [here](https://tetrisfriends.benzoft.com/commands-and-permissions#admin-commands-tetrisfriendsadmin).
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://tetrisfriends.benzoft.com/world-mechanics.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
