Structuring and Scaling Turn Based Combat

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By rinamon

I was following mobile RPG series from HeartBeast. Good tutorial and the basic run okay.

but beyond that, how to structure the “mechanics” that I would like to implement, and to be as generic as possible (for better scaling option)

I think about something similar to Slay The Spire, where there are some common RPG mechanic like poison, stun etc.

they also implement relic that “interrupt” the base mechanic of the turn-based combat. For example there is a relic that heals you after deal a killing blow, add damage on first attack you use, prevenet the first damage that dealt to you in combat, heal after combat, obtain block if (condition) and so on.

I think relic runs individually for each their own effect, but at the same time checks and interrupt the existing loop.

how to structure it so that, by the time I add more relics to the game, it doesn’t break the existing loop, so I just create more function or script for the new relic, without a need to overhaul the combat loop? I can’t seem to imagine the loop and seems like I need to keep revisiting the turn-based code everytime I add a new relics / interrupt

An example of your idea would be appreciated, thanks!

1 Like
:bust_in_silhouette: Reply From: Ertain

How about noting the basic statistics of those involved in combat? The characters could have hit points, magic points, timers (e.g. the number of seconds before it’s their next turn, or special attack cooldown), action points (used for skills), or points from traits (e.g. the character’s strength, endurance, or agility). Tailor the mechanics to take these stats into consideration, or to affect these stats. Attacks are based upon strength, speed is based upon agility, items can temporary improve stats, or curses can temporary hinder these stats. This could even be layered: attacks are based upon strength, and agility could affect the impact of the attack (the character deals a swift, damaging blow to their enemy).

These mechanics could be rule-based. The calculation for an attack could just mean adding in the strength trait along with some random number. As the character progresses, they receive bonuses, items, or other enhancements which add on other rules. The character’s attack gets enhanced with some item that improves their movement. The calculation for attack not only adds in the strength trait, but also a percentage of their agility, too.

I hope this gets you on the right track.

I think it’s more of the “interruption” logic than the number.

sure I can make a fireball that deals 2x INT. this is the number part , that still make the “attack” loop run the same.

how about some modifier like fire mastery that increase the damage of fire by 50%, one simple way is to give fire mastery boolean to the fireball. but this become a problem after more and more modifier added to the game.

I think mine is more of a structure problem, for example there are 10 modifiers that involves fireball, I think it’s not a good plan to add 10 flags to the fireball itself.

more of fireball still have it’s own logic (ie. 2x INT damage ) but if modifier exists, it also check and modifiy effect of the ability, without hard-coupling the modifier and the ability (make modifier generic). I guess the layering part is doable, but still confused on how should I structure the layer of the modifier.

I hope it clears out the question.

rinamon | 2021-04-16 23:47

Sorry, I got nothing else to offer. :-/

Ertain | 2021-04-21 02:13