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.

WorldLogic.cs and BattleLogic.cs

Is probably one of the most important scripts. Defines all the core gameplay logic and game rules. It is run by the server or host. WorldLogic is for everything that happens outside of battles (map events, moving on the map, game setup...), while BattleLogic is for battles.

Game Actions are sent by the GameClient.cs, and received by the GameServer.cs to then be executed by WorldLogic/BattleLogic, GameServer connects to callbacks, 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.

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).

World.cs Battle.cs Player.cs Character.cs Card.cs Slot.cs

Contains data for the current state of the game, World.cs is the data sent to clients during a network refresh (and it contains everything related to the current state of the game). One of the variable inside World.cs is Battle, during battles, only this needs to be refresh as it contains the whole state of the current battle.

World.cs is also the class that will be serialized to a file when saving the game.

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). 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.

BoardCharacter.cs, HandCard.cs, BoardSlot.cs

All scripts in GameClient folder are usually just the visual representation of the data. So for example, BoardCharacter.cs will take the values contained in Character.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.

MapUI.cs, BattleUI.cs

Main scripts for the in-game UI. MapUI.cs is for the map scene. While BattleUI is for the battle scenes.

GameClient.cs

Main script for the client side of the game, this script is only in the game scenes. 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.

LobbyClient.cs

This is the client script but for the menu. It will connect to the server to find other players if using the lobby features.

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.

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.

Last updated