By Starlight
By Starlight - Detailed Game Explanation
Overview
"By Starlight" is a top-down space exploration and combat game that blends cozy discovery with action gameplay. You pilot a small triangular ship through a starfield dotted with space stations, collecting orbs, avoiding hazards, and defending yourself against enemy ships.
Core Gameplay Mechanics
Movement System
- Arrow Keys / WASD: Move your ship in any direction
- Physics-based movement: The ship has momentum - when you press a direction, you accelerate rather than instantly moving
- Friction: When you stop pressing keys, the ship gradually slows down (98% friction per frame)
- Max Speed: Limited to 4 units/frame normally, 8 when boosting
Boost Ability
- SPACE key: Provides a speed burst in your current direction of movement
- Creates orange particle trails that stream behind your ship
- 3-frame cooldown between boosts
- Particles fade over time and move opposite to your boost direction
Combat System
- Mouse Aiming: Your ship constantly rotates to face your mouse cursor
- Click to Shoot: Fires cyan projectiles toward your mouse position
- Projectile Speed: 8 units/frame
- Fire Rate: 15-frame cooldown (about 0.25 seconds at 60fps)
- Projectile Lifespan: 100 frames before disappearing
Game Elements
Orbs (Collectibles)
- Purpose: Primary collectible objective
- Spawning: 5 orbs spawn at a time in random locations
- Respawning: When all 5 are collected, a new set immediately spawns
- Visual: Golden, pulsing spheres with glowing auras
- Points: 10 points each
- Collection Range: 15 units from player center
Space Stations (8 Total)
Each station is a unique location with its own story:
- The Listening Post - Communications array with mysterious transmissions
- Greenhouse Orbital - Gardens with lavender and earth
- The Sleeper's Rest - Hibernation pods with blue lights
- Stargazer's Haven - Observation dome with telescopes
- The Drift Market - Abandoned marketplace with trinkets
- Memory Archives - Crystalline data banks preserving moments
- The Wanderer's Beacon - A lighthouse in space
- Solace Station - Wind chimes and peaceful atmosphere
- Discovery: Approach within 60 units to discover and read the station's story
- Points: 50 points per station discovered
- Visual: Glowing circular structures with distinct colors
- One-time: Each station can only be discovered once
Meteoroids (12 Total)
- Behavior: Drift continuously in random directions
- Speed: 0.5-2.0 units/frame
- Rotation: Slowly rotate as they move
- Size: 15-35 units diameter
- Damage: Deal 2 hull damage on collision + knockback effect
- Wrapping: When they leave the play area, they wrap to the opposite side
- Indestructible: Cannot be destroyed, only avoided
Enemy Ships
- Spawning: New enemies spawn every 240 frames (reduced by 10 frames per enemy destroyed, minimum spawn rate)
- Max Enemies: 5 simultaneous enemies on screen
- Health: 3 hit points each
- AI Behavior:
- Chase player when within 400 units (aggro range)
- Accelerate toward player at 0.2 units/frame²
- Max speed: 2.5 units/frame
- 97% friction applied each frame
- Combat:
- Shoot red projectiles at player
- 60-frame cooldown between shots
- Projectiles travel at 5 units/frame
- Deal 10 hull damage on hit
- Collision Damage: Deal 5 hull damage if they touch the player
- Points: 25 points when destroyed
- Visual: Red diamond-shaped ships with health bars
Score System
- Orbs: 10 points each (infinite, continuously respawning)
- Stations: 50 points each (8 total, one-time)
- Enemies: 25 points each (infinite spawning)
- Maximum Station Points: 400 (8 × 50)
- Score continues infinitely through orb collection and enemy destruction
Hull Integrity (Health System)
- Starting Health: 100%
- Damage Sources:
- Meteoroid collision: -2% per hit
- Enemy ship collision: -5% per hit
- Enemy projectile hit: -10% per hit
- No Healing: Health cannot be restored
- Game Over: When hull reaches 0%
Technical Details
Camera System
- Follows the player ship, keeping it centered on screen
- World coordinates converted to screen coordinates
- Camera position:
player.x - canvas.width/2, player.y - canvas.height/2
Play Area
- Approximate world size: 1500 × 800 units
- Player spawns at center (750, 400)
- Meteoroids wrap around edges
- Enemies spawn off-screen and enter the play area
Visual Effects
- Stars: 200 parallax background stars (move at 50% camera speed)
- Glows: Radial gradients around ships, stations, and orbs
- Particles: Boost creates fading orange particles
- Shadows: Meteoroids have dark glows
- Pulse Animation: Orbs pulse using sine wave (0.05 rad/frame)
Collision Detection
- Circle-based collision (distance formula)
- Player size: 8 units
- Orb collection: 15 units
- Station discovery: 60 units
- Enemy/meteoroid/projectile: size + player.size
Game Progression
- Early Game: Focus on collecting orbs and discovering stations safely
- Mid Game: Enemies begin spawning, requiring combat awareness
- Late Game: Enemy spawn rate increases, requiring skilled maneuvering
- Endless: No win condition - survive and score as long as possible
Strategy Tips
- Boost wisely: Use boost to escape dangerous situations or quickly collect orbs
- Kite enemies: Keep distance while shooting to avoid damage
- Prioritize threats: Enemy projectiles are more dangerous than collisions
- Station timing: Visit stations when the area is clear of enemies
- Movement patterns: Use momentum and friction to dodge effectively
Game Over
- Displays final score, stations discovered, and enemies destroyed
- Restart button reloads the page for a fresh game
- All progress resets (stations, score, enemies)
The game combines exploration, collection, and combat into a cohesive space adventure with infinite replayability!

Leave a comment
Log in with itch.io to leave a comment.