Any feedback on my Python turn-based combat game?

November 13, 2026 5 answers
Asked by almost-out-of-staples

I built a small Python RPG to practice object-oriented programming and game logic. It has turn-based fights, equipment, inventory, quests, leveling and a multi-phase boss.

I'd appreciate feedback on the code structure as well as ideas for improving damage balance, XP progression and the interface.

Answers

plausibly-offline

As the roster of enemies and items grows, consider moving their stats and rewards into data files instead of hard coding each one. JSON would be a reasonable place to start.

Keep the combat rules in Python and load the values separately. That makes it easier to tweak health, damage and XP without hunting through several classes. You can still give an enemy its own class when it actually needs different behavior.

!reframe+that~riddle:

Validate the loaded values too. A missing attack stat is much easier to fix when the error points to the enemy data.

Reply to this answer
ferry_26!departed

For code feedback, pick a few paths through the game and make sure you can explain each one. For example, trace an attack from the player's choice through damage calculation, health changes and the end of the turn. That can reveal where responsibilities are tangled or a condition is doing more than it needs to.

If a long chain of conditions is choosing which enemy to create, a registry mapping enemy types to constructors might make that part easier to extend. It doesn't need a big framework.

Reply to this answer
fern-logic

I'd tackle balancing with a few repeatable test fights rather than changing numbers by feel alone. Track turns to win, damage taken, potions used and XP gained at a few player levels.

Try the same setup against different enemies, then change one thing at a time. That should help separate a damage problem from an XP curve problem. Boss phases are worth testing on their own too, especially the transition between phases.

Reply to this answer
w2~crank_817

Think about what deserves its own object based on behavior, not just whether it has a number attached. An attack or status effect might be useful to model separately if several characters share it. A simple damage value can just be a number.

Composition could help here: give an enemy a set of abilities rather than making a new subclass for every combination of attacks.

Reply to this answer
tiny-but-definitely-a-chair

For the interface, make sure a player can see what changed after each action. Damage dealt, remaining health, rewards and equipment effects should be easy to find without reading through a wall of text.

Clear prompts and a way to recover from an invalid choice can make a text interface feel much nicer without adding a graphical interface.

Reply to this answer

Add your answer

Answers are reviewed before publication.

Related Discussions