Skip to content

Add satellite names system - Component-based implementation - #22

Open
wannerdev wants to merge 1 commit into
mainfrom
feature/satellite-names-component-based
Open

Add satellite names system - Component-based implementation#22
wannerdev wants to merge 1 commit into
mainfrom
feature/satellite-names-component-based

Conversation

@wannerdev

Copy link
Copy Markdown
Owner

Description

Implements a satellite naming system that assigns codenames to satellites based on their level and spawn order. First satellite of each level gets a fixed codename, and every 10th satellite globally gets a Japanese codename.

Implementation Approach

This is Implementation A - Component-Based approach using spawn statistics tracking and direct label spawning.

Changes

  • Created new satellite_names module
  • Added SatelliteSpawnStats resource to track spawn counts
  • Implemented codename_for_satellite function for name assignment logic
  • Added SatelliteLabel component for label entities
  • Integrated naming into both start_new_launch and start_launch_from_touch_end
  • Labels spawn as child entities positioned below satellites
  • Added satellite_names::plugin to main app plugins

Naming Rules

Fixed Codenames (First of Each Level)

  • Level 1 (first): "tiny-1"
  • Level 2 (first): "traily"
  • Level 3 (first): "boinc"

Japanese Codenames (Every 10th Globally)

Every 10th satellite (10, 20, 30, etc.) gets a Japanese codename:

  • Sakura, Kitsune, Kumo, Hoshi, Tsuki, Hikari, Yami, Kaze, Mizu, Inazuma, Tora, Ryuu, Kaguya, Akari, Kuro
  • Uses romaji (ASCII) for font compatibility
  • Cycles through list if more than 15 milestone satellites

Technical Implementation

Spawn Statistics Tracking

pub struct SatelliteSpawnStats {
    pub global_spawn_idx: u64,           // Total satellites spawned
    pub per_level_spawn_idx: HashMap<u32, u32>,  // Count per level
    pub japanese_name_cursor: usize,     // Current Japanese name index
}

Name Assignment Logic

  1. Increment global spawn index
  2. Increment per-level spawn index
  3. Check if first of level → assign fixed codename
  4. Else check if 10th globally → assign Japanese codename
  5. Else no label

Label Rendering

  • Labels are child entities of satellites
  • Positioned at (0, -800, 1) relative to satellite
  • Font size: 18.0
  • Color: White with 90% alpha
  • Uses game's retro font
  • Automatically follows satellite (parent-child relationship)

Benefits

  • Adds personality and identity to satellites
  • Helps players track specific satellites
  • Milestone celebration every 10 satellites
  • Level-specific identity for first satellites
  • Easy to reference satellites in gameplay
  • Enhances immersion with Japanese theme

Visual Design

  • Position: Below satellite (doesn't overlap with fuel/energy labels)
  • Size: Smaller than other labels (18pt vs 27pt)
  • Color: White with subtle transparency
  • Font: Matches game's retro aesthetic
  • Readability: Clear against space background

Performance

  • Minimal impact: Only spawns labels for named satellites
  • Efficient: Uses child entities (automatic transform updates)
  • Clean: Labels despawn with satellites automatically
  • Scalable: Works with any number of satellites

Testing

  • Launch first level 1 satellite → Verify "tiny-1" label appears
  • Launch first level 2 satellite → Verify "traily" label appears
  • Launch first level 3 satellite → Verify "boinc" label appears
  • Launch 10 satellites → Verify 10th gets Japanese name
  • Launch 20 satellites → Verify 20th gets different Japanese name
  • Check labels follow satellites correctly
  • Verify labels don't overlap with other UI elements

Future Enhancements

  • Add text outline for better readability
  • Implement zoom-based label visibility
  • Add fade-in animation for labels
  • Support custom player-defined names
  • Add label color coding by satellite type

Related Feature

Implements: Satellite Names System (Component-Based Approach)

- Created satellite_names module with SatelliteSpawnStats resource
- Implemented codename assignment system:
  * First satellite per level gets fixed codename (tiny-1, traily, boinc)
  * Every 10th satellite globally gets Japanese codename
- Added SatelliteLabel component for text rendering
- Integrated naming into both mouse and touch launch functions
- Labels positioned below satellites as child entities
- 15 Japanese codenames using romaji for ASCII compatibility
- Tracks global and per-level spawn indices
- Labels have 90% alpha for subtle appearance
- Automatic label positioning with satellite movement
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant