Team 3 ‐ UX UI - UQcsse3200/2026-studio-3 GitHub Wiki

Overview

Combat Background Framework

The framework displays a configurable static image behind combatants. Backgrounds are defined in JSON and selected by ID, allowing new artwork to be added without changing rendering code.

Main components

Component Purpose
CombatBackgroundConfig Stores a background's ID, name, and texture path.
CombatBackgroundConfigs Finds configurations by ID.
CombatBackgroundComponent Draws the image to fill the camera view without stretching.
ForestGameArea Validates the selection, loads the texture, spawns the background, and handles cleanup.

Adding and selecting backgrounds

Place the image in source/core/assets/images and add an entry to source/core/assets/configs/backgrounds.json:

{
  "backgrounds": [
    {
      "id": "forest",
      "name": "Forest",
      "texture": "images/grass_1.png"
    }
  ]
}

Each entry needs a unique, case-sensitive ID, a nonblank name, and an existing texture path relative to source/core/assets.

Select the background when creating the area:

ForestGameArea gameArea =
    new ForestGameArea(terrainFactory, mapProgression, "forest");
gameArea.create();

Omit the ID or pass null to use the original terrain. The documented BattleScreen currently passes null.

Behaviour

  • The image follows an unrotated orthographic camera and scales with its viewport and zoom. Its aspect ratio is preserved, with excess content cropped.
  • It renders above terrain and behind combatants using layer 0 and Z index 1f. Terrain and collision walls remain underneath.
  • Missing or invalid configurations and missing texture files leave the original terrain visible. Asset decoding failures are not generally handled by this fallback.
  • ForestGameArea loads and unloads textures through ResourceService; the rendering component does not dispose of them.
  • One static background is selected at area creation. Animation, parallax, and runtime switching are not implemented.

Testing

CombatBackgroundConfigsTest covers matching IDs, unknown IDs, null IDs, and empty collections. Manually check image scaling, rendering order, fallback behaviour, and leaving/reopening battles.

Based on task/background-framework, commit a702bee.

player stats icons references

player image reference

  • player image from: @mariadeniseanda

enemy stats icon references