M
M
Maxim Spesivykh2018-08-31 12:12:07
JavaScript
Maxim Spesivykh, 2018-08-31 12:12:07

How to calculate combat characteristics in a browser game using JS?

I started writing a browser toy in JS (react / node) like a BK (fight club).
Interested in algorithms for calculating game mechanics.
For example:

  • There is a Persian, he has lvl: 1, Strength: 7, armor: 0, life level: 35 and mirrored by the enemy, they enter into a duel. How to calculate the damage that one character will deal differently, is there a special formula or how is it usually done in games?
  • These same characters have pumped instinct (critical hit), say 20, the second has dexterity (damage from strikes) - 15. How to calculate, depending on the pumping of the Persian, the probability of a critical hit or evasion in battle?
  • There are 2 characters, one lvl 1 and he has 35 lives, the second lvl 10 and he has 1500 lives, how to organize the restoration of lives among the Persians, so as not too fast and not too slow, given the pumping of the regeneration skill, than it will be more, in theory, faster restore. That's the question of what formulas or what algorithm to count.

I am sure there are some proven formulas and algorithms for such calculations, a more or less balanced solution is needed so that the fight is fair at any level, and the leveling is uniform.

Answer the question

In order to leave comments, you need to log in

5 answer(s)
S
Saboteur, 2018-08-31
@Spamol

Depends on your desire.
You can come up with formulas yourself.
You can take a ready-made system from some board game, for example, take the latest edition of the D&D rules and try to embody the formulas from it. In addition, there are various monster generators for D&D that can help with balancing. But D&D can be a serious overhead.
You can take any existing game and adapt its formulas to your own.
But you still have to balance - if not formulas, then parameters, if not parameters, then the interaction of highlevels and lowlevels.
And the development of the game (if it is meant) will always be reduced to editing the balance. I once developed a MUD server. About 30% of the work is balancing.
Write automated tests for all combat options that you find realistic and run all your changes through the tests.

G
GavriKos, 2018-08-31
@GavriKos

There are all sorts of different role-playing systems. Of the complex ones, these are SPECIAL, D&D, Pathfinder and a bunch of similar ones. There are manuals for them, incl. how to calculate damage, levels and that's it. And for them (for the last two, so 100%) there are manuals in the public domain - take it and read it (usually called a rulebook, but not the fact that this is the case in all systems).
You can cut something from there (if the license allows), you can look there and create something of your own based on it.
Well, in similar questions they ask about literature on balance - read it too.
Added: Your data is not enough to give a specific formula. Banal questions - do stats affect damage? What are the stats? And the coat? But is that all? The system should be integral, so I can’t even advise the specifics)
By the way, the BC formulas can be searched in the public domain - the source seems to have been opened.

G
Griboks, 2018-08-31
@Griboks

Usually, developers themselves come up with formulas and coefficients based on tests. For example, you can subtract dodge chance from crit chance, or you can multiply them.

D
Daniil Basmanov, 2018-08-31
@BasmanovDaniil

There are no formulas, in each game the designer chooses what he likes best. Balance is not built on formulas alone, balance is the state of the entire system, which includes all the characteristics and clothes and everything else that you put in there. If you can’t come up with it yourself and like it like in BC, then you can steal the design from them, that’s what everyone does.
It is unlikely that anything should depend on the level in battle, strength and the rest depend on the level, but only combat characteristics should participate in the battle itself, do not interfere with everything in one pile. Start with a simple scheme, where there is only impact power and health, play with it and see, then add any regeneration and so on.

E
Exploding, 2018-08-31
@Exploding

Define initial (base) values ​​for your parameters. Like "for a naked hero of level 1". Life, energy, etc for example, will be a number > 1, and for characteristics such as protection, speed "something there ..." - use coefficients (a naked character has, for example, a base protection coefficient of 1). Clothing, respectively, also has a coefficient. which is added to the base when dressing a character. Well, then it's just a calculation ... summed up the defense, attack, randomly determined a crit there or a lapel, well, they calculated it :)
Ie . everything is based on coefficients: similarly with most other indicators, such as the player's level for example, he also simply adds his coefficient to the basic characteristics. and you take it into account when calculating the battle or whatever you will have there))
Probably so.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question