Dev Update: A Deep Dive into the Battle System!


Dev Update: A Deep Dive into the Battle System! ⚔️

Hey everyone!

I've been spending the last few days deep in the code, doing a complete review of the core combat system. I wanted to walk you through how it all works, from starting a fight to claiming victory. No code was changed, but this review helped solidify the foundation of our battle experience.

How Fights Begin: Roaming Encounters

As you explore zones like the Northern Plains, you'll see enemies roaming the map in real-time. If you cross paths with one of these encounter zones, or if they manage to intercept you, a battle is triggered instantly!

When the fight kicks off, the system brings the enemies to life. A neat detail is that creatures are dynamically leveled within a certain range. This means a "Baby Plains Wolf" you fight early on might be level 1, while one you encounter later could be a more challenging level 4, keeping the world feeling fresh and dangerous.

The Turn System: Speed is Key

The combat uses a gauge-based turn system, often called an Active Time Battle (ATB) system. Here's the gist:

  • Every combatant (you, your party members, and the enemies) has a turn gauge.
  • This gauge fills up at a rate determined by their Speed stat.
  • Once the gauge is full, it's their turn to act!

This makes Speed a critical stat, but it can also be manipulated. Status effects like slowed will cut a character's gauge-filling speed in half, while stopped prevents the gauge from filling at all.

Before a character takes their action, we also check for any start-of-turn effects. This is where things like bleeding (which deals damage that ignores defense!) or regeneration (which heals you) will tick. Be careful—if a damage-over-time effect knocks someone out, they're defeated before they even get to make a move!

Player & Enemy Actions

When it's your turn, the battle UI will appear, allowing you to choose your move.

Your main commands are:

  • Attack: Strike a foe with your equipped weapon, claws, or even your bare fists.
  • Item: Use a battle-ready item from your inventory. The item system is smart enough to know whether an item should be used on yourself, an ally, or an enemy.
  • Flee: Attempt to escape from the battle.

For now, the enemy AI is pretty straightforward: they'll identify the player and attack. We'll be building more complex enemy behaviors and special abilities in the future!

The Nitty-Gritty: Stats & Damage

Here’s how we calculate what happens when you land a punch:

  • Hit Chance: Your Dexterity stat is compared against the target's to determine if your attack even lands. A miss means no damage and your turn is over.
  • Base Damage: This is calculated based on your Strength plus the damage from your weapon.
  • Critical Hits: Your Dexterity also influences your critical hit chance! A successful crit will multiply your damage by 1.5x, or even 2x if your Dex is particularly high.
  • Defense: Finally, the target's total Defense (from their base stats, armor, and any protective effects) is subtracted from the incoming damage. Attacks will almost always deal at least 1 point of damage unless they're fully absorbed.

I also implemented a special mechanic for players who invest in the Faith stat, called Divine Intervention. If you have high Faith and are about to receive a killing blow, a divine force may spare you, healing you to full health! This powerful save has a very long cooldown, so you can't rely on it every fight.

Victory, Defeat, and Running Away!

A battle can end in one of three ways:

  • Victory: When you defeat an enemy, you'll immediately see their loot drop added to your inventory and their XP value tallied. Once all foes are vanquished, you're awarded the total XP for the fight, which might trigger a level-up on the spot!
  • Defeat: If your entire party is knocked out, it's not always "Game Over." Depending on the circumstances, you may trigger a more forgiving "recoverable defeat" scenario instead of being forced to reload your save.
  • Fleeing: Your chance to successfully escape is based on how your fastest party member's Speed compares to the fastest enemy's. If you succeed, the battle ends. If you fail, you lose your turn and the enemy gets to act!

Once the battle is resolved, the roaming encounter is removed from the map, the combat log is saved to your main adventure log, and you're returned to the exploration screen.

That's the overview for now! It feels great to have this core system solidified. Let me know what you think of the mechanics in the comments below!

Files

World of Sopho_0.0.107_x64_en-US.msi 5.7 MB
44 days ago

Get World of Sopho - A Pup's Adventure

Leave a comment

Log in with itch.io to leave a comment.