Download the PHP package codryn/phpturntracker without Composer
On this page you can find all versions of the php package codryn/phpturntracker. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download codryn/phpturntracker
More information about codryn/phpturntracker
Files in codryn/phpturntracker
Package phpturntracker
Short Description Flexible turn order tracking library for tabletop RPG combat systems
License MIT
Informations about the package phpturntracker
PHPTurnTracker
Flexible turn order tracking library for tabletop RPG combat systems
PHPTurnTracker is a zero-dependency PHP library that provides robust turn order management for tabletop RPG combat encounters. It supports all major RPG systems through configurable timeline profiles, handling everything from D&D's individual initiative to Shadowrun's pass-based combat.
Features
- ๐ฒ Universal RPG Support: D&D all editions, Pathfinder, Shadowrun, GURPS, Savage Worlds, Genesys, Marvel Heroic, OSR, and more
- ๐ Multiple Turn Order Models: Round-based individual/side, pass-based with decay, slot-based, popcorn initiative
- ๐ State Tracking: Automatic tracking of acted/unacted actors per round/pass
- ๐ฏ Dynamic Management: Add reinforcements, remove defeated actors, change initiative mid-combat
- โ Error Handling: Clear, specific error messages with location information
- ๐ Type Safe: Full PHP 8.1+ type declarations and strict mode
- โก Zero Dependencies: Pure PHP 8.1+ implementation using only stdlib and json extension
- ๐งช Well Tested: Unit tests with comprehensive coverage
- ๐ฆ PSR-12 Compliant: Modern PHP coding standards
Requirements
- PHP 8.1 or higher
- json PHP extension enabled
Installation
Quick Start and Usage
Basic D&D-Style Combat
Dynamic Combat Management
Supported RPG Systems
| System | Turn Order Type | Timeline Profile |
|---|---|---|
| D&D 5e / Pathfinder | Individual initiative, round-based | ROUND_INDIVIDUAL |
| Shadowrun 4e | Pass-based with 10-point decay | PASS (decay: 10) |
| Shadowrun 5e/6e | Pass-based with 5-point decay | PASS (decay: 5) |
| Genesys / Star Wars FFG | Slot-based initiative | SLOT |
| Marvel Heroic / Popcorn | Narrative designation | POPCORN |
| B/X D&D / OSR | Side-based initiative | ROUND_SIDE |
Configuration Examples
D&D 5e with Dexterity Tie-Breaker
Shadowrun 4e Multi-Pass Combat
Genesys Slot-Based Initiative
Popcorn Initiative (Marvel Heroic)
OSR Side-Based Initiative
State Tracking
State Save and Restore
Save and restore complete encounter state for persistence, UI synchronization, or undo/rewind features:
The state snapshot includes:
- Timeline configuration (profile, turn order type, all settings)
- All actors (IDs, names, initiatives, attributes)
- Actor states (acted/unacted, passes remaining, temporary initiative changes)
- Encounter state (active status, current round/pass, current actor)
Use cases:
- Persistence: Save state between sessions
- UI Synchronization: Ensure UI always reflects exact game state
- Rewind/Undo: Implement advanced undo features using state snapshots
- State Transfer: Move encounters between different systems or implementations
Documentation
- Examples - Complete code examples for each RPG system
Development
See CONTRIBUTING.md for development guidelines.
Architecture
The library uses the Strategy Pattern for turn order calculation:
Encounter- Main coordinator classActor- Represents a participant in combatTimelineProfile- Configuration for turn order rulesTurnOrderInterface- Strategy interface for turn order models- Strategies:
RoundBasedIndividual,RoundBasedSide,PassBased,SlotBased,Popcorn
Performance
- Encounters with 20 actors: Complete 10 rounds in <100ms
- State queries: <1ms response time
- Concurrent encounters: Multiple independent encounters without performance degradation
Quality Standards
- โ PHPStan Level 10: Strictest static analysis level from PHPSTan 2.1
- โ PSR-12: PHP coding standards compliance
- โ
Strict Types:
declare(strict_types=1)in all files - โ TDD: Test-driven development methodology
- โ Type Hints: Full type declarations on all methods
- โ PHPDoc: Complete documentation blocks
Contributing
Contributions are welcome! See CONTRIBUTING.md for:
- Development workflow
- Coding standards
- Testing requirements
- Pull request process
License
This project is licensed under the MIT License - see the LICENSE file for details.
Changelog
See CHANGELOG.md for version history and migration guides.
Support
- ๐ Documentation
- ๐ Issue Tracker
- ๐ฌ Discussions
- ๐ง Email
Credits
Created and maintained by Marco for Codryn.
Special thanks to:
- The PHP community
- PHPUnit, PHPStan, and PHP-CS-Fixer maintainers
Game Systems Copyright
This library implements initiative and turn order mechanics from various tabletop RPG systems for non-commercial use. All game system names, mechanics, and related intellectual property remain the property of their respective copyright holders. See GAME_SYSTEMS_COPYRIGHT.md for detailed copyright notices and attributions.
Built for the tabletop RPG community ๐ฒ