# Scripts Overview

### Important Scripts

If you're planning on editing the code. A good place to start with is everything inside the Scripts/GameLogic folder.

**GameLogic.cs**&#x20;

Is probably one of the most important script. Defines all the core gameplay logic and game rules. It is used by both the server (to resolve actions received) and by the AI (to make predictions).&#x20;

Game Actions are sent by the GameClient.cs, and received by the GameServer.cs to then be executed by GameLogic, GameServer connects to callbacks inside GameLogic.cs, to know when it should send a refresh to all clients.

I would strongly suggest to edit directly this script to create your own rules, and not try to change the game rules by creating a separate script. This will keep your project simpler in the long term, and you probably won't need to update this script to future version of the engine so much since it doesn't contain anything related to systems like networking message, ui, visuals or other. It is purely game rule logic.&#x20;

If you edit the code, do not access this script directly from a client-side script, and do not try to change the visuals or run audio fx from there, since this script is run by the server and AI and not the client. Namespaces serve as a reminder (client side scripts are in a different namespace than server ones).

#### Game.cs  Player.cs  Card.cs Slot.cs

Contains data for the current state of the game, Game.cs is the data sent to clients during a network refresh (and it contains players and cards).&#x20;

If you need to add new stats to your cards, you will need to edit Card.cs (as well as edit CardData.cs). Unlike CardData.cs which represent the card original fixed stats, Card.cs represent the current state of a card (with edited values, status effects, owner, and position on the board). So a stat that never changes during the game (such as the card rarity) do not need to be added to Card.cs and can only be added to CardData.cs. But a stat that can be affected by abilities (attack) need to be in both scripts.

#### BoardCard.cs, HandCard.cs, BoardSlot.cs

All scripts in GameClient folder are usually just the visual representation of the data. So for example, BoardCard.cs will take the values contained in Card.cs and display it with sprites and ui text. These scripts are never relevant to the AI, GameLogic or Server, since their only role is to display the data received from the server.

#### GameUI.cs and PlayerUI.cs

Main scripts for the in-game UI. GameUI is only there once while PlayerUI has one for each player.

#### GameClient.cs

Main script for the client side of the game, this script is only in the game scene. It will connect to the server and send the various actions executed by the player, it will also receives refresh from the server, update the state, and let the other client-side scripts update what is shown on the board.

**ServerManager.cs and GameServer.cs**

Main scripts for the server, ServerManager is the top-level script that will receive connections, client messages and redirect them to the appropriate game, if a server run multiple games at the same time, it will contain a list of GameServer, each with a different UID, and each network message received will be sent to the correct game server instance. &#x20;

There is also a script ServerManagerLocal.cs which simulates the server in local when playing in solo, this one only contain 1 GameServer instead of a list.
