This is the backend client for Talishar.net - completely separate from the frontend. In order to test Talishar locally, you will need to install both the frontend and backend projects.
- Talishar-FE - Frontend client built with TypeScript and React
- CardImages - Card image processing and management
- Players: Visit Talishar.net to start playing
- Developers: See Docker setup instructions below
- Contributors/Bug Reports: Join our Discord community
- Documentation: Quickstart Guide and Full Docs
- Docker
- Talishar-FE
Easier to do on *nix OS than on MS OS. It's important if you want to run ad-hoc scripts like zzCardCodeGenerator.php to have Talishar-FE and CardImages repositories located in the same directory as Talishar.
The docker-compose file is set up to mount the ../Talishar-FE directory into the container. In order to generate new cards and images, those are generated in ../CardImages directory.
First clone the repo:
git clone https://github.com/Talishar/Talishar.git
Into the directory we go:
cd Talishar
Run the script to do the setup and start the docker containers
bash start.sh
- NOTE: If you're on windows, the newline characters might mess up this script. It's only two lines so you can just run them manually in Windows Powershell or git Bash:
cp -n HostFiles/RedirectorTemplate.php HostFiles/Redirector.php
docker compose up -d
The containers are running in detached (background) mode. If you need to stop them:
bash stop.sh
or
docker compose down
- As noted in the Quickstart Guide below you need a unique Redirector file setup. You can customise it, it's required, but it's not checked into the repo. So the script makes a copy of the Redirector file before launching the containers.
- The stop script just stops the containers by calling
docker compose down - After the first time making the Redirector file, you can bring the docker containers up and down using
docker compose upanddocker compose downand whatever else you're used to.
- Xdebug is added to the container and can be configured through the
docker/docker-php-ext-xdebug.inifile. The xdebug port is9003. You can use the Xdebug helper browser extension to set breakpoints and debug the code. You can also attach to the debugger from your IDE. - The
idekeyallows you to filter out requests to the Xdebug server. Theidekeyis set toPHPSTORMby default. You can change this to anything you want. Just make sure it matches theidekeyin your IDE settings.
- Create a PHP Remote Debug configuration in PHPStorm
- Check to Filter debug connection by IDE key and set the IDE key to PHPSTORM (or whatever you've changed this to in the xdebug configuration)
- Open up the
...for the Server and create a new Server - Set the Host to
0.0.0.0and the port to9003(or whatever you've set the xdebug port to) as well as the debugger to Xdebug - Check the
Use path mappingsand map the root of the project to the root of the container/var/www/html/game - Now you should be able to run this configuration, and it will wait for a connection from the xdebug server in the container. You can set a breakpoint somewhere in the code and it should stop there when you make a request to the server.
- Xdebug halts execution and can cause issues in the files where we have infinite loops. You can skip these files in PHPStorm by going to
Settings -> Languages & Frameworks -> PHP -> Debug -> Skipped Pathsand adding the paths to the files you want to skip as well as to theSettings -> Languages & Frameworks -> PHP -> Debug -> Step Filters -> Skipped Files. - OPCache is included to speed up performance, but it can have issues with Xdebug. You can always disable OPCache in the ini file
- Install the PHP Debug extension
- Create a launch.json file in the .vscode directory
- Add the following configuration to the launch.json file:
{
"version": "0.2.0",
"configurations": [
{
"name": "Listen for XDebug",
"type": "php",
"request": "launch",
"port": 9003,
"pathMappings": {
"/var/www/html/game": "${workspaceFolder}"
}
}
]
}
- Set a breakpoint in the code
- Start the debugger by selecting the
Listen for XDebugconfiguration and clicking the green play button
Talishar consists of three main components working together:
- Talishar (PHP) - Game engine, logic, and API
- Talishar-FE (TypeScript/React) - User interface and state management
- CardImages - Card definition and image processing
GetNextTurn.php- Main API endpoint that serializes and returns the current game state to the frontendProcessInput.php- Handles all user input and triggers appropriate game logicGameLogic.php- Core game mechanics and turn flowCoreLogic.php- Essential game engine functionsConstants.php- Game constants, zones (HAND, BANISH, GRAVEYARD, PLAY, DECK), and player IDs
CardDictionary.php- Card data lookup and utilitiesCardDictionaries/- Card definitions organized by set- Each set folder/files (e.g.,
WelcomeToRathe/,WTRShared.php) contains card abilities - Card logic uses switch statements keyed by
cardNumber(lowercase with underscores) - Example:
"fyendals_spring_tunic","command_and_conquer_red","energy_potion_blue"
- Each set folder/files (e.g.,
CardLogic.php- Card-specific ability implementationsCharacterAbilities.php- Hero character abilitiesItemAbilities.php- Item card abilitiesAuraAbilities.php- Aura card abilitiesAllyAbilities.php- Ally card abilitiesPermanentAbilities.php- Permanent card abilitiesLandmarkAbilities.php- Landmark card abilitiesWeaponLogic.php- Weapon card logic
ParseGamestate.php- Parses persisted game state filesWriteGamestate.php- Persists game state to filesWriteLog.php- Writes game event logs for debugging
GetNextTurn.php- Main response to frontend with current game stateProcessInputAPI.php- API version of ProcessInput for frontend requests
Frontend Component
↓ (User Action)
ProcessInput.php (validates & processes)
↓ (Triggers logic)
GameLogic.php / CardLogic.php / Ability Files (executes game rules)
↓ (Updates state)
WriteGamestate.php (persists to file)
↓ (Frontend polls)
GetNextTurn.php (serializes current state)
↓ (Returns JSON)
ParseGameState.ts (transforms backend data)
↓ (Updates Redux)
GameSlice.ts (Redux store)
↓ (Components subscribe)
React Components (render UI)
$currentPlayer- Indicates who has priority (1 or 2)$turn[0]- Current phase (M=Main, A=Action, D=Defense, etc.)
If you would like to contribute, be sure to join the Discord community to chat with fellow contributors.
For information on deploying Talishar to production, including SSL/TLS certificate configuration, reverse proxy setup, and security best practices, see PRODUCTION_SSL_SETUP.md.
Key Production Considerations:
- SSL certificate must cover all domains:
talishar.net,www.talishar.net,api.talishar.net,fe.talishar.net,legacy.talishar.net - Use Let's Encrypt for free, auto-renewable certificates
- Configure Apache/Nginx reverse proxy for SSL termination
- Docker containers handle HTTP only - SSL handled by host machine
All artwork and card images © Legend Story Studios.
Talishar.net is in no way affiliated with Legend Story Studios. Legend Story Studios®, Flesh and Blood™, and set names are trademarks of Legend Story Studios. Flesh and Blood characters, cards, logos, and art are property of Legend Story Studios.
