solar charged

$ a resource management tower defense game where energy is currency and health

overview

Solar Charged is a tower defense game built with a partner for the 2025 Kenny Game Jam. The theme was "Power." Energy acts as both currency and health: you spend it to place towers, towers cost upkeep while on the field (and more while actively shooting), and solar panels recharge it over time based on weather conditions. If your energy hits zero, you lose.

Tower types include a basic shooter, a piercing laser, an area damage tower, an energy buff tower that boosts adjacent towers, and a slow tower. Each has two independent upgrade tracks with three levels each.

tech stack

  • Godot 4, GDScript: game engine and scripting
  • State machine: explicit StateMachine + State base classes managing 5 game states
  • HealthComponent: dual-purpose energy system; depletion triggers defeat, spending builds towers
  • Weather system: 4 weighted states (Rain 7%, Cloudy 15%, Normal 35%, Sunny 50%) affecting energy recovery rate
  • PathFollow2D: enemy movement along pre-placed paths
  • Tower upgrade system: two independent upgrade tracks per tower, 3 levels each

links

play

Solar Charged
▶ Play

showcase

Solar Charged gameplay

how to play

The goal is to manage your power effectively while defending against waves of enemies. Strategically place and upgrade towers, but keep in mind: the more towers you have and the more you upgrade them, the more power they consume. If you run out of power, you lose.

Your power is recharged through solar energy, which is affected by the weather cycle. Keep an eye on the forecast. To open the upgrade menu, select a placed tower. You can also delete towers this way. Upkeep is the passive cost of having a tower on the field; this cost increases when the tower is actively shooting.

tower types

how it works

The game is divided into five explicit game states managed by a StateMachine class: MainMenu, Placing (drag-to-place towers), Combat (waves active), Shop (between waves), and Win/Lose. Each state is a separate class inheriting from a State base, with enter(), exit(), and update() methods. Transitions are triggered by events (wave cleared, energy depleted, shop confirmed) and the state machine calls the appropriate lifecycle hooks.

Energy is managed through a single HealthComponent shared between the currency and health systems. Tower placement deducts from it; passive and active upkeep drain it each tick; solar recovery adds back at a rate determined by the current weather. The weather cycle transitions between Rain, Cloudy, Normal, and Sunny states using weighted random selection, giving Sunny the highest probability (50%) and Rain the lowest (7%). Weather state determines the per-tick energy recovery multiplier.

Enemy movement uses PathFollow2D nodes along pre-authored paths. Tower targeting logic checks enemies within range and prioritizes by progress along the path, hitting the one closest to the end.

takeaways

The first game built with explicit state machines and component-based design rather than singletons. The difference in maintainability was immediately apparent. Some key takeaways:

  • Explicit state machine pattern for game flow management across menus, gameplay phases, and outcomes
  • Component-based design, HealthComponent as a reusable, single-responsibility node
  • Weighted random state transitions for weather simulation
  • Tower defense fundamentals: placement, upkeep, targeting, and wave spawning
  • Balancing resource drain and recovery rates as a design problem, not just a tuning problem