Skip to main content

Battle Scenes

Guide

Initialize System builds a complete playable battle presentation layer with only six root objects, reflecting a deliberately compact scene design

After the selected GameEncounter reaches GameCardManager, six root objects turn the player, enemies, piles, and phase state into a battlefield the user can see and control. Whether a fixed scene starts through GameCardEncounterBootstrap or a map, level, or quest starts dynamically through GCSApi.StartBattle, the same GameCardManager, Battle Runtime, Battle Canvas, and presentation objects take over the battle.

Initialize System builds the scene skeleton

Open an empty scene, use the following menu to open Game Card System, then click Initialize System:

Tools > TinyGiants > GCS > Game Card System

After the command finishes, the Hierarchy contains a scene skeleton ready for an Encounter and presentation changes.

A clean initialized scene Hierarchy containing Main Camera, GameCardManager, EventSystem, Background, Battle Runtime, and Battle Fx Directors

The six root objects above divide battle startup, camera and input, background, unit and card interaction, HUD, and effects feedback into clear entry points. When replacing presentation or integrating project flows later, follow this Hierarchy to the corresponding surface:

Root objectCore componentsResponsibility in the complete path
Main CameraCamera, AudioListener, Physics2DRaycasterRenders the world-space battlefield and sends pointer events to world-space cards with CardViewInput
GameCardManagerGameCardManager, GameCardEncounterBootstrapRegisters databases, holds the current battle state, and provides the default Encounter startup entry in a fixed scene
EventSystemEventSystem, StandaloneInputModuleSends pointer, Submit, Cancel, and button input to cards, the HUD, and temporary interfaces
BackgroundSpriteRenderer, BattleBackgroundFit, BattleEncounterBackgroundFills the camera view and applies the Encounter icon or class background for fixed-startup scenes
Battle RuntimeBattlefield, hand, Canvas, and Presentation childrenTurns the player, enemies, piles, and battle phases into interactive scene content
Battle Fx DirectorsIntentThreatTelegraphPlays separate visual and audio warnings when a high-threat Attack intent appears
Template objects are detected by their exact root-object names
  • The Manager is found by its GameCardManager component, but an incomplete Battle Runtime or another template root with the correct name is not replaced as a whole.

  • A camera or EventSystem with equivalent behavior but a different name is not detected either.

  • Before initializing again, check the root names and internal structure. This prevents incomplete objects from remaining unrepaired or a second copy of the same service from appearing in the scene. Background components, sorting, and class-background configuration are still added or overwritten according to the rules above.

For the complete workflow from an empty scene through Encounter configuration, see Create Your Second Battle.

Startup, input, and background form the scene foundation

GameCardManager turns the Encounter into a runtime battle. Main Camera and EventSystem receive input for world-space cards and Screen Space UI, while Background supplies the battlefield image.

ObjectTemplate defaultBoundary to preserve when modifying it
Main CameraOrthographic Size 5, position (0, 0, -10), full-screen Viewport, HDR and MSAA enabledYou can replace the composition, Render Texture, or camera stack. If world-space card input remains in use, the event camera must retain Physics2DRaycaster
EventSystemNavigation events enabled, Drag Threshold 10, input axes Horizontal, Vertical, Submit, and CancelYou can replace it with the project's input module, but keep only one enabled EventSystem in the scene
BackgroundSorting Layer Background, Order -20, Overscan 1.01, Vignette Strength 0.3You can replace the background system completely, but its final render must remain behind units, cards, and the HUD
warning

An Encounter passed dynamically to GCSApi.StartBattle does not trigger this background change. A dynamic flow must update the background through its scene coordinator, or copy the Encounter to Bootstrap.DefaultEncounter before calling Apply on the background component explicitly.

tip

The finished Demo binds EncounterParallax above the single-image background for multi-layer motion. A newly initialized scene begins with a clean background so you can establish your own visual system. See Demo Scene Reference for the finished hierarchy and motion effects.

Battle Runtime turns state into an interactive battlefield

Once startup, input, and background are ready, Battle Runtime expands units, the hand, interfaces, and feedback in the same order the player sees and uses them.

🎬 Battle Runtime # Complete battle presentation and interaction root
├── ⚔️ Battle Board # Creates and positions player and enemy unit views
│ ├── 🦸 Player Area # World-space anchor for the player unit
│ ├── 👹 Enemy Area # Parent that arranges enemy positions in order
│ │ ├── 1️⃣ Area1 # Position for the first living enemy
│ │ ├── 2️⃣ Area2 # Position for the second living enemy
│ │ └── 3️⃣ Area3 # Position for the third living enemy
│ └── 🎯 Targeting Arrow # Visual line from a dragged card to its target
├── 🃏 Hand # Hand layout, object pool, pointer input, and card-play presentation
├── 🖥️ Battle Canvas # Root for the Screen Space HUD and pop-up interfaces
│ ├── 📊 HUD # Energy, piles, End Turn button, and turn banner
│ ├── 📚 Pile Inspector # Paged view of draw, discard, and exhaust piles
│ ├── 🔀 Choice Presenter # Displays FlowGraph candidates and confirmation controls
│ ├── 🎁 Reward View # Selects a card, energy, cost, or Skip reward
│ ├── 🏆 Result Popup # Victory and defeat results panel
│ └── 🎭 Splash Screen # Presents Encounter information and delays battle startup
├── 🗃️ Pile Cards # World-space card container used by Pile Inspector
├── 🌫️ Pile World Blur # Dims the battle behind an open pile
├── 🃏 Choice Cards # World-space container for candidate cards
├── 🌫️ Choice World Blur # Dims the battle during a choice
├── 🎁 Reward Cards # World-space container for reward cards
├── 🌫️ Reward World Blur # Dims the battle while rewards are shown
├── 🌫️ Result World Blur # Dims the battle behind the results panel
└── 🎛️ Presentation # Shared audio, VFX, text, impact, and cursor feedback
├── 🔊 Audio # Music, ambience, gameplay SFX, and Mixer routing
├── 💥 VFX # Responds to scene-level and unit-level effect requests
├── 💬 Floating Text # Damage, healing, status, and custom battle text
├── ⏳ Delayed Trigger Indicator # Marks delayed effects attached to units
├── 💢 Impact Director # Coordinates hit stop and impact feedback
└── 🖱️ Cursor # Applies the battle cursor texture and scale

Battle Board establishes unit and target space first

When a battle enters the scene, BattleBoard creates player and enemy views from runtime state, places living enemies into the available areas in order, and coordinates Tier scale, health-bar and status offsets, intent positions, selection feedback, and death-hide timing.

The Battle Board Inspector with player and enemy areas, health-bar and status offsets, and Normal, Elite, Boss, and Summon configurations

The Inspector exposes the player anchor, enemy parent, three default enemy positions, and the four visual configurations for Normal, Elite, Boss, and Summon. Selection colors, health-bar offsets, and death timing beyond the screenshot remain coordinated by the same BattleBoard.

SettingTemplate valueEffect on the battlefield
Player AreaPlayer AreaDefines the world-space position of the player unit view
Enemy Area RootEnemy AreaParents the entire enemy formation
Enemy AreasArea1, Area2, Area3Assigned to living enemies in order. Add positions when showing four or more enemies at the same time
Player-area position(-5.2, 0)Establishes the layout anchor on the player side
Enemy-area position(5.2, 0)Establishes the layout anchor on the enemy side
Enemy spacing-1Tightens or expands the formation according to the current enemy count
Unit scaleNormal 0.4, Elite 0.5, Boss 0.6, Summon 0.35Gives each Tier a distinct visual size
Intent YNormal 1.4, Elite 2, Boss 2.4, Summon 1Places intent UI above the corresponding body size
Death hide delay0.9 secondsLeaves time for the death presentation before hiding the unit view

BattleOpeningEnemyTooltip on Battle Board anchors the opening enemy description to Enemy Area. The template lets it run independently without Splash Screen and uses a character interval of 0.026 seconds.

tip

The project can replace its Prefab, text, and timing. Disable the component entirely when no opening enemy description is needed.

Hand connects card interaction to the battlefield

After the unit views and enemy positions are established, HandController connects drawing, hovering, dragging, the play area, and target selection, then sends successfully played cards to the exit presentation and object-pool return path.

The Hand Inspector showing the default Hand Layout, Card View Pool, Card Fly Out Config, and Card Play Showcase

The four components visible in the screenshot handle hand layout, view pooling, exit routes, and card-play presentation. HandController below them continues the connection into input, target selection, and battle state.

ComponentTemplate defaultResponsibility in the interaction path
HandLayoutRadius 21.2, Max Angle 16, Spacing 3.296, Hover Scale 1.15, Tween 0.15 seconds, Entrance 0.38 secondsArranges the hand in a fan, makes room for the hovered card, and handles entrance and rearrangement animation
CardViewPoolBasic card Prefab, Initial Per Bucket Size 4Starts each Bucket with a capacity of 4, creates views on demand at first use, and returns released views to the pool
CardFlyOutConfigDefault, Basic, and Burst exit from Bottom Right; Skill and Support exit from Bottom LeftSelects a left or right exit direction by card type. CardPlayShowcase performs the actual flight
CardPlayShowcaseEnter 0.28 seconds, hold 0.8 seconds, fly out 0.65 seconds, hold scale 1.25Presents the card in focus before it leaves and tracks unfinished presentations
HandControllerDraw interval 0.27 seconds, hover grace 0.08 seconds, Target Pick Radius 1.6, bottom 32% of the screen as the play areaConnects pointer input, target selection, Battle Board, the object pool, hand layout, and card-play presentation

Changing card dimensions affects fan spacing, hover height, transitions between adjacent cards, and target-dragging feel at the same time. Recalibrate these parameters as a group after replacing the Prefab. Hand and the Three Card Piles defines how runtime cards enter and leave these views.

Splash Screen sequences fixed-scene openings first

When Bootstrap.DefaultEncounter is assigned and Auto Start On Play is enabled, BattleSplashScreen disables Bootstrap's direct automatic startup for the current run during Awake, presents the Encounter information, then calls StartBattle after a delay. The same opening flow coordinates opening audio, dealing, enemy tooltips, and the turn banner. BattleSplashScreen reads only Bootstrap.DefaultEncounter; it cannot access an Encounter passed dynamically to GCSApi.StartBattle.

tip

When a map or quest selects an Encounter dynamically, disable, remove, or replace Splash Screen completely so it does not continue reading and starting the fixed Encounter. Starting a Battle defines the boundary between fixed and dynamic entry points.

HUD keeps the main controls available after battle starts

After startup, HUD continuously displays the current resources and pile state and sends End Turn and pile-inspection actions back to the runtime.

Child objectComponentFunction used by the player
Energy DisplayUnitEnergyDisplayShows the player's current energy
End Turn ButtonEndTurnButton, UIButtonSfxEnds the player turn and plays button feedback
Draw PileDeckCounterShows the count and opens the draw pile
Discard PileDiscardCounterShows the count and opens the discard pile
Exhaust PileExhaustCounterShows the count and opens the exhaust pile
Turn BannerTurnBannerPresents player and enemy turn transitions and holds an Animation Gate during its animation

The HUD can be redesigned completely. New buttons and counters still need to call the End Turn and pile-query APIs. Custom UI Integration shows a connection that does not depend on the template Prefabs.

Temporary interfaces take over when content must be inspected or selected

Pile inspection, FlowGraph Choice, victory rewards, and final results do not remain on screen together. Each takes control of input when its state arrives and uses the earlier World Holders and Blur Sprites to organize world-space cards.

TriggerChild object and componentTemplate configuration and runtime boundary
The player inspects a pilePile Inspector, CardPileInspectorShows 5 × 2 cards per page at a scale of 0.34, reusing CardViewPool to browse the draw, discard, and exhaust piles
FlowGraph enters a ChoiceChoice Presenter, BattleChoicePresenterShows candidate cards at a scale of 0.34 and reports selection, confirmation, and Skip actions to FlowGraph. If the scene has no Presenter, Choice enters the Skipped branch directly instead of leaving an empty waiting overlay
Victory raises OnBattleRewardOfferedReward View, CardRewardViewShows cards at a scale of 0.4 with two reveal delays of 0.5 seconds, then calls ApplyReward or SkipReward after a card, energy, cost, or Skip selection
Defeat ends the battle, or a completed victory reward raises OnBattleEndedResult Popup, BattleResultPopupUses victory and defeat delays of 0.9/1.0 seconds and types at 42 characters per second
tip
  • Choice Presenter completes the user choice awaited by FlowGraph. Reward View submits the reward result, clears IsWaitingForReward, and allows the battle to raise OnBattleEnded.

  • Replacements for these interfaces must preserve the corresponding callbacks. A reward interface cannot merely hide its visual object without submitting a reward result.

  • Keep only one IChoicePresenter implementation in the scene.

  • Manager searches disabled objects as well when locating a Presenter. If the template and custom components both remain, selection order is not guaranteed. Remove the old component when replacing Choice UI instead of only disabling its GameObject.

Presentation turns resolution results into complete feedback

Once card play, status changes, and phase transitions run correctly, Presentation turns those results into audio, scene effects, floating text, and impact feedback. The player can understand what just happened without watching numeric changes alone.

ObjectComponentFeedback provided
Presentation/AudioBattleAudioManages card, UI, battle, results, music, Mixer, volume, and gameplay audio
Presentation/VFXBattleVFXPresenterResponds to battle start, player turn, enemy turn, and battle end events with scene-level Ambient, BattleStart, TurnStart, Victory, and Defeat VFX
Presentation/Floating TextBattleFloatingTextPresenterShows damage, healing, status, and custom battle text
Presentation/Delayed Trigger IndicatorUnitDelayedTriggerIndicatorMarks delayed effects attached to units
Presentation/Impact DirectorBattleImpactDirectorCoordinates hit stop and impact feedback
Presentation/CursorBattleCursorApplies the battle cursor texture, using a template scale of 2
Battle Fx DirectorsIntentThreatTelegraphWhen any Attack intent reaches or exceeds 12, plays threat VFX 0.9 units above the enemy and a warning sound at 0.7 volume

The FlowGraph Play VFX node instantiates the Prefab configured on the node directly and does not pass through BattleVFXPresenter.

Node effects and scene-phase effects can be replaced independently. Presentation Layer defines the integration boundaries for audio, VFX, floating text, and Gates.

tip
  • Audio, VFX, Floating Text, Delayed Trigger Indicator, Impact Director, Cursor, and Intent Threat Telegraph can be replaced or removed individually to match the project style. Removing one only removes its feedback and does not change runtime resolution.
  • Splash Screen, Hand, HUD, Choice, and Reward perform startup, interaction, or runtime callbacks. Their replacements must still start the correct Encounter and submit card plays, End Turn, Choice selections, and Reward results.

When a phase stops advancing, identify the object still being awaited:

  • AnimationGate waits for presentation release through its Holder count.
  • Choice waits for its selection callback through IsWaitingForChoice.
  • Reward waits for reward submission through IsWaitingForReward.
  • CardPlayShowcase.ActiveCount delays only the reward and results interfaces until card presentation finishes.