# System

Systems are responsible for updating the components of entities. Each system will have an update method that will be called every frame and will handle the logic for a specific aspect of the game, such as rendering or movement.

```cpp
class System {
public:
    /**
     * @brief Virtual update method to be implemented by derived systems.
     * 
     * This method will contain the logic to update entities based on their components.
     * It is called every frame with the time elapsed since the last frame, allowing
     * systems to perform time-based updates.
     * 
     * @param dt Delta time since the last update call.
     * @param components A reference to the map storing all components associated with their entity IDs.
     */
    virtual void update(float dt, std::unordered_map<std::pair<std::type_index, int>, std::shared_ptr<Component>, PairHash>& components) = 0;
};
```


---

# Agent Instructions: 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:

```
GET https://r-type-5.gitbook.io/r-type/development-guidelines/ecs/system.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
