Mobile Card Game Development
Card games are a genre highly dependent on data balance and match state reliability. If a fighter's animation bug goes unnoticed, incorrect card effect calculation in card game destroys experience immediately.
Match state stack
Each turn is a transaction. Player played card → chain of effects → new board state. If crash or connection break occurs mid-chain, state shouldn't remain "half-applied."
Implementation: Command pattern for all game actions. PlayCardCommand, AttackCommand, DrawCardCommand—each command has Execute() and Undo(). Entire turn is command stack that either fully applies or rolls back. This also gives replay functionality for free: save command stack + initial seed—get reproducible match.
Real-time vs asynchronous PvP
Synchronous PvP (both players online): Photon Realtime with custom Room State. Turns transmitted as events (RaiseEvent), server acts as relay. For validation—separate server service checking move legality before relaying to opponent.
Asynchronous PvP (Push & Pull): turn saved on server, opponent gets FCM push notification. Works even with poor connection, more tolerant of mobile-first audience. For deck and balance—Firebase Firestore with security rules.
Visual card representation
Cards in Unity: Canvas with RectTransform for UI-based render or separate SpriteRenderer meshes for game board. UI approach more convenient for animation and drag-and-drop via IBeginDragHandler, IDragHandler, IEndDragHandler. DOTween for card play effects: fly from hand, glow, shake on attack.
Dynamic card art generation from template: RenderTexture + Camera offscreen—render 3D card model with needed parameters to texture, use as sprite. Allows 500+ unique cards without 500 separate textures.
Timeline: single-player card game with AI opponent—3–5 months; with PvP and deck-building mode—5–9 months.







