> For the complete documentation index, see [llms.txt](https://moratelli.gitbook.io/moratellis-toolbelt-for-tcg-engine/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://moratelli.gitbook.io/moratellis-toolbelt-for-tcg-engine/tools/game-state-visualizer.md).

# Game State Visualizer

## Setup

Add the following text on `ServerManagerLocal.cs` to allow GSV to get server data and compare with client data.

```csharp
public GameServer GameServer { get { return server; } }
```

Remember to add `using GSV;`of top files to be able to use Attributes.

## Attributes

* GSVField:&#x20;
  * Description: set special name to override field's name, also could be used as header of arrays/lists.
  * MaxWidth: set max width to make room for more fields in lines.
  * CompareField: set the field used to compare object from server and client data.
  * StripeLines: enable stripe lines for specific list.
  * CompareUI: set the field on CardUI to find respective object.

{% hint style="info" %}
You must run the game to the tool get game data. After it was started once, it will keep the last updated data.
{% endhint %}

## Examples

<figure><img src="/files/mOqJK364E8MsRo2FCNox" alt=""><figcaption></figcaption></figure>

Game.cs

```csharp
[GSVField]
public GameState state = GameState.Connecting;
[GSVField]
public GamePhase phase = GamePhase.None;

//Players
[GSVField(description:"Players", compare_field: "player_id")]
public Player[] players;

//Selector
[GSVField]
public SelectorType selector = SelectorType.None;
[GSVField]
public int selector_player_id = 0;
[GSVField]
public string selector_ability_id;
[GSVField]
public string selector_caster_uid;
```

Player.cs

```csharp
[GSVField]
public int player_id;
[GSVField]
public int hp;
[GSVField]
public int hp_max;
[GSVField]
public int mana = 0;
[GSVField]
public int mana_max = 0;
[GSVField]
public int kill_count = 0;

[GSVField(description: "Deck", stripe_lines:true)]
public List<Card> cards_deck = new List<Card>();
[GSVField(description: "Hand", stripe_lines: true)]
public List<Card> cards_hand = new List<Card>();
[GSVField(description: "Board", stripe_lines: true)]
public List<Card> cards_board = new List<Card>();
```

Card.cs

```csharp
[GSVField]
public string card_id;
[GSVField(max_width: 75)]
public Slot slot;

[GSVField]
public string card_id;
[GSVField(max_width: 75)]
public Slot slot;
[GSVField(max_width: 75)]
public int mana = 0;
[GSVField(max_width: 75)]
public int attack = 0;
[GSVField(max_width: 75)]
public int hp = 0;
```

{% hint style="info" %}
The following code was added on Slot.cs to make it show a better value at GSV.
{% endhint %}

<pre class="language-csharp"><code class="lang-csharp">public override string ToString()
{
<strong>    return $"[{x},{y}]";
</strong>}
</code></pre>
