> ## Documentation Index
> Fetch the complete documentation index at: https://docs.rollingquest.kramgames.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Score Info

> How the RollingQuest editor calculates and displays real-time score information based on placed elements.

The editor displays real-time score information in the HUD as you build your level. This helps you balance difficulty and reward structure.

## Displayed Information

| Metric             | Description                                     |
| ------------------ | ----------------------------------------------- |
| **Max Score**      | Total score from all blocks, items, and enemies |
| **Treasures**      | Number of treasure items placed                 |
| **Fruits**         | Number of fruit items placed                    |
| **Keys**           | Number of key items placed                      |
| **Best Timestamp** | Best completion time from testing               |

## How Score Is Calculated

The score is recalculated whenever elements are added, removed, or modified. The calculation iterates over all sections and their blocks:

### Block Scores

* **Side templates**: Each side contributes its `EditorScore` value
* **BlockOnly templates**: The block itself contributes its `EditorScore` value
* **Bonus themes**: Blocks with `VisitRequired` contribute 50 points each

### Item Scores

* Each item contributes its template's `EditorScore` value
* Items are also counted as treasures, fruits, or keys based on their template properties

### Enemy Scores

* Each enemy contributes its template's `EditorScore` value

## Lazy Evaluation

The score is not recalculated every frame. Instead, a `_scoreInfoDeprecated` flag marks when recalculation is needed:

* Set to `true` when elements are added/removed/modified
* Calculated in `UpdateScoreInfo()` during `Update()`
* Reset to `false` after calculation

This prevents unnecessary computation when nothing has changed.

## Score Data Structure

```csharp theme={null}
public struct ScoreInfoData
{
    public long Score;      // Total score
    public long Treasures;  // Treasure count
    public uint Fruits;     // Fruit count
    public uint Keys;       // Key count
}
```

The `ScoreInfoData` struct implements equality comparison for efficient change detection in the HUD.

## Best Editor Time

The `BestEditorElapsedTime` tracks the fastest completion time from testing sessions. It is:

* Updated when a test playthrough completes
* Persisted with the level data
* Displayed in the HUD as "Best Timestamp"
