DEVLOG #01: From Chaos to Architecture - A Refactoring Deep-Dive


Hey everyone, and welcome to our first devlog!

When we started this project, we had something fun: a frantic prototype where you, a powerful hero, faced down hordes of enemies. It was chaotic, it was a blast, but under the hood, things were a mess. The game would lag, crash, and worst of all, every new idea felt like a monumental task that risked breaking everything else.

The last few weeks have been less about adding new content and more about performing deep-tissue surgery on the game's core architecture. We wanted to share that journey with you.

The Diagnosis: Taming the Chaos

The first symptom was obvious: the longer you played, the more the game choked. Our EnemySpawner was operating blind, just pumping out 75 enemies every 5 seconds, no matter how many were already on screen or how badly the framerate was suffering.

Our first intervention was to give the spawner some eyes and a brain:

  • Population Cap: It now respects a hard cap on active enemies. It's smart enough to only spawn new enemies if there's "room" for them, preventing the engine from being overloaded.
  • Performance Throttling: The spawner now watches the FPS in real-time. If things get too hectic and the framerate dips below our target, it holds back new waves until the action stabilizes.

These two changes turned the spawner from a dumb repeater into a conscious scene director, making for a much smoother experience.

The Surgery: Tearing Down the "God Components"

The deeper problem was in our code structure. We had "God Components"—massive scripts that tried to do everything at once. The main EnemyAI script handled movement, health, status effects, physics, and decision-making. The GameManager handled game state, UI, upgrades, player abilities... you name it. It was a house of cards.

Our solution was a complete architectural teardown, breaking these monoliths into focused specialists:

  • Modular Enemies: The old EnemyAI was retired. In its place, we now have a component-based system. Each enemy is built from smaller parts:

    • EnemyHealth: Only manages health and death.
    • EnemyMovement: Only controls physics and movement.
    • StatusEffectHandler: Only manages states like slow, freeze, and shock.
    • EnemyAI_...: A lean "brain" script, unique to each enemy type, that simply gives commands to the other components.
  • Specialized Managers: The GameManager was "fired" from most of its jobs.

    • We now have a UIManager that only handles UI elements.
    • We have an AbilityManager that only handles the logic for player skills.

To make them all talk to each other intelligently without creating new dependencies, we introduced an IEnemy interface. Now, our game systems (like projectiles) don't need to know if they're hitting a "Square" or a "Diamond"; they just interact with anything that has an "Enemy" contract.

The Payoff: Building on a Solid Foundation

All that foundational work was tough, but it paid off immediately.

  • New Ranged Enemy (The 'Diamond'): Building our new kiting, projectile-firing enemy was a breeze. We just wrote its unique AI "brain" and plugged in all the other components we'd already built and stabilized.
  • Smarter Crowds: When we noticed our melee enemies were just clumping together and getting stuck in traffic jams, we didn't need a messy hack. We gave them a proper AI state machine that allows them to "dodge" each other, leading to a much more dynamic and organic-looking horde.

What's Next: An Infinite Game and... Puppets?

With a solid architecture in place, we've finally started building the game mode we've been dreaming of:

  • Infinite Cycles: The 60-second timer is gone. Now, the game runs in cycles. Every 90 seconds, the difficulty ramps up, increasing the health and speed of all future enemies. The goal is simple: survive as long as you can.
  • New Upgrade - "Cadaver Converter": We're prototyping a wild new upgrade. Instead of just dying, enemies killed by your projectiles have a chance to be "converted"—rising again as a puppet that fights for you for a limited time! We're excited to see the chain reactions this will cause.

That's the journey so far. It was a massive undertaking, but we've gone from a brittle prototype to a robust, scalable, and performant platform. The foundational work is done. Now, the real fun begins.

Stay tuned for what's next! We will be putting up the new version for download soon.

Files

Oficina_Jam_Jun_2025 - Price of Power.rar 41 MB
8 days ago

Get Price of Power

Download NowName your own price

Leave a comment

Log in with itch.io to leave a comment.