[Guide/Formula] Critical hit rate, cont. attack chance, wars

If you are stuck in the Dunan Unification Wars; or wish for more details on the gameplay systems, this is the place.
Post Reply
User avatar
Sasarai10
Forum Moderator
Posts: 1743
Joined: Sat Apr 21, 2012 3:18 pm

Re: [Guide/Formula] Critical hit rate, cont. attack chance,

Post by Sasarai10 »

Omnigamer wrote:
As an aside, we still have no idea how the probabilities are calculated for special attacking powers work in war battles (ie, fire spears).

I guess it depends on the special attack and attack points/enemy's defence points too. For example Jeane's Lightning can be more succesfull than Luc's Wind. Also sometimes Lightning can cause double damage too.

I guess more succesfull are Mazus' Fire,Adlai's Invention & Jeane's Lighting. Fire Spears & Wind are less. Also i have the impression that Bombard Ability is less succesfull than Teresa's simple attack. :roll:
Omnigamer
Posts: 324
Joined: Wed Feb 13, 2013 11:48 am

Re: [Guide/Formula] Critical hit rate, cont. attack chance,

Post by Omnigamer »

I would like to see some empirical evidence for any of those claims. Certain things can "feel" more effective, but we don't even know if any of them take attack/defense into account. It may be different per type of attack. For example, Bombard may just be an extension of Theresa's normal attack, which is why it has a relatively high failure rate. In contrast, Fire Spears might just have a set chance to succeed with no reference to stats. Or it could be a combination of stats and success chance. Just a lot of uncertainty with it.

For the record, I am betting that all of the "types" of attacks have the same properties. What I mean is that Fire Spears and Adlai affect a set area, so their success rate is calculated one way. On the other hand, Luc and Jeane use targeted spells, which both use the same success rate, but is different from Fire Spears. Just my thoughts.
Omnigamer
Posts: 324
Joined: Wed Feb 13, 2013 11:48 am

Re: [Guide/Formula] Critical hit rate, cont. attack chance,

Post by Omnigamer »

Preliminary results:

-Fire spear *probably* has a set 33% hit rate for any given target regardless of atk or def.
-Luc's Wind is awful, but more testing needs to go into it. It looks like it uses the atk and def stats, but has a high starting penalty to the point that 10 atk vs 5 def is still only a 5% chance to hit.
-Adlai's Invention is very good. Seems to have a ~66% chance to hit regardless of atk or def.
-Bombard is basically a normal archer attack with a longer range. It has the same general probabilities as a normal attack.
-Jeane's Lightning is quite good. I still need to experiment a bunch, but it has about a 50% success rate.

Still a ton of testing to do, especially at higher attack levels, but I'm working on it.

EDIT: Correction - it doesn't look like any of the spells/effects other than Bombard pay attention to enemy defense, but the probabilities seem to scale with the unit's atk. I'm still investigating.

EDIT2: My theory so far is this: the game uses the same general formula as for normal damage, except that it doesn't take into account enemy defense. Instead, there's an offset depending on the type of attack. Things line up decently when I look at the stats so far, but I will wait until tomorrow to finish out the tests with higher attack values.

The war effect damage formula is probably similar to this:

If((ATK+4)-offset)>=random number(0-19) then damage.

Offsets that seem reasonable so far (+-1):
Fire Spears: 4
Luc: 12
Adlai: 0
Jeane: 5

I'm planning to stop testing Bombard.
Omnigamer
Posts: 324
Joined: Wed Feb 13, 2013 11:48 am

Re: [Guide/Formula] Critical hit rate, cont. attack chance,

Post by Omnigamer »

Ignore the above. I spent the evening digging through the game's code to unravel the mysteries.

Fire Spear - 50% chance per target.
Adlai - 50% for all targets.
Luc - 30% chance to hit.
Jeane - 2 30% chances to hit. This is why it will occasionally "crit".

All of them ignore attack and defense values and work purely off of the RNG. For whatever reason, Fire Spear hits on values 51-100, but Adlai hits on 1-50. If you want to be really technical, Fire Spear has a very slight advantage in that all 0s (1/65536 chance) will also trigger a hit. Luc and Jeane both trigger on 1-30.

I did not test out critical hits or bombard in great detail. My guess is that Bombard just acts as a regular attack with extra range. Critical hits probably work similar to Jeane, in that you have a chance to hit twice. If you happen to hit both times, it will just give the critical hit message. However, this means that it could also double up your chances... I don't know. At the very least there wasn't a clear constant in the code like for the spells above.
User avatar
BrucePrintscreen
Posts: 651
Joined: Sun Dec 15, 2013 2:58 am

Re: [Guide/Formula] Critical hit rate, cont. attack chance,

Post by BrucePrintscreen »

Guys, is there really not any one of you who could be able to dig into the code and tell me about the mechanism behind trading? THat would really help me for the guide I'm writing.
Omnigamer
Posts: 324
Joined: Wed Feb 13, 2013 11:48 am

Re: [Guide/Formula] Critical hit rate, cont. attack chance,

Post by Omnigamer »

I don't think you realize just how much effort goes into reversing the game's mechanics. It's not like the source code is available; you either have to debug it while playing it or apply static analysis to the game files. It takes a long amount of time to figure out just about anything, let alone the full mechanics of a system that isn't well understood. If you're really interested in filling out your guide, I encourage you to just perform some game tests and get a feel for it yourself. You should be able to figure out some of the key details by testing hypotheses in-game. My guess though is that it just fluctuates randomly on a timer, so you won't be able to control much about it.
User avatar
BrucePrintscreen
Posts: 651
Joined: Sun Dec 15, 2013 2:58 am

Re: [Guide/Formula] Critical hit rate, cont. attack chance,

Post by BrucePrintscreen »

Omnigamer wrote:I don't think you realize just how much effort goes into reversing the game's mechanics. It's not like the source code is available; you either have to debug it while playing it or apply static analysis to the game files. It takes a long amount of time to figure out just about anything, let alone the full mechanics of a system that isn't well understood. If you're really interested in filling out your guide, I encourage you to just perform some game tests and get a feel for it yourself. You should be able to figure out some of the key details by testing hypotheses in-game. My guess though is that it just fluctuates randomly on a timer, so you won't be able to control much about it.
That's what I've been doing so far, I have been empirically trying everything I could with the trading system and noted down everything. I'll summarize that into a guide.
I had no ideas exactly where are you guys with the coding, so thanks for enlightening me on it.
I don't think I necessarily need to know about the mechanism to write the guide but I just wanted to check if something was contradicting my observations. Thanks anyway!
Omnigamer
Posts: 324
Joined: Wed Feb 13, 2013 11:48 am

Re: [Guide/Formula] Critical hit rate, cont. attack chance,

Post by Omnigamer »

I tried to confirm the actual formulas for crits and dodges, but the code related to character stats is a mess. There are a ton of arbitrary RNG calls too, so that's not an easy way to pick it out. I wasn't able to track down anything for dodges or counters, but on the crit side I think I stumbled across the right subroutine. I believe the actual formula for crits is:

(TECH+(LUCK/2))/16=crit chance

At the very least I found a subroutine that used both the TECH and LUCK character values, but it only halved the luck before adding them together. I'd like to fully nail the rest of it down, but it's a pain right now. I'll search out some of the enemy addresses and see if I can't key off of those next, but I don't want to work with pSX's crappy debugger any more for a while.
User avatar
Pyriel
Webmaster
Posts: 1227
Joined: Wed Aug 18, 2004 1:20 pm

Re: [Guide/Formula] Critical hit rate, cont. attack chance,

Post by Pyriel »

I actually made a code that caused 100% critical hits, but only in the first round. I abandoned it at the time because I didn't realize soon enough that the FST.BIN file is overlaid by SEC.BIN from the start of the second round onwards, i.e., it mysteriously stopped working after the first round, and I got frustrated trying to figure out why. I think it's still saved in my GS Pro. I'll dig it out sometime and see if I can confirm.
Omnigamer
Posts: 324
Joined: Wed Feb 13, 2013 11:48 am

Re: [Guide/Formula] Critical hit rate, cont. attack chance,

Post by Omnigamer »

Dug through a bit further today, and I think I have the algorithm for determining dodges.

Hit% = (Hero TECH - (Enemy SPEED-80))

The above equation is bounded at 35 and 100, so you can never have lower than a 35% hit rate. Having above 100% is also just considered 100% for the purposes of the subroutine. What I don't know yet is how items such as the Thunder God Garb and Thunder Amulet interact with it... that's next on the list, I guess. If it's additive, then that makes things pretty simple. If it's multiplicative, well... they're pretty useless. I'm fairly certain it's the former, though.

EDIT: I just confirmed that it is additive. In this sense, Hit and TECH are the exact same thing, although I don't know if Hit contributes to the critical formula or not (I doubt it).

I can't confirm the formula for multi-hits right now since my test batches don't include multiple enemies. At the very least, keying off of speed doesn't turn up anything when attacking only a single target. Based on the testing posted earlier, I think the listed formula is incorrect and it relies fairly heavily on luck. In the same way, I think turn order is influenced by luck.

Short list of things to figure out:
-Correct multi-hit formula
-Turn order calculations
-"Run" mechanics
KFCrispy
Global Admin
Posts: 6174
Joined: Wed Jun 30, 2004 3:29 pm

Re: [Guide/Formula] Critical hit rate, cont. attack chance,

Post by KFCrispy »

awesome!! look forward to your findings
User avatar
ninjaluc79
Posts: 867
Joined: Tue Sep 13, 2005 10:45 pm
Location: The Island Nations
Contact:

Re: [Guide/Formula] Critical hit rate, cont. attack chance,

Post by ninjaluc79 »

Omnigamer wrote:Dug through a bit further today, and I think I have the algorithm for determining dodges.

Hit% = (Hero TECH - (Enemy SPEED-80))

The above equation is bounded at 35 and 100, so you can never have lower than a 35% hit rate. Having above 100% is also just considered 100% for the purposes of the subroutine. What I don't know yet is how items such as the Thunder God Garb and Thunder Amulet interact with it... that's next on the list, I guess. If it's additive, then that makes things pretty simple. If it's multiplicative, well... they're pretty useless. I'm fairly certain it's the former, though.

EDIT: I just confirmed that it is additive. In this sense, Hit and TECH are the exact same thing, although I don't know if Hit contributes to the critical formula or not (I doubt it).

I can't confirm the formula for multi-hits right now since my test batches don't include multiple enemies. At the very least, keying off of speed doesn't turn up anything when attacking only a single target. Based on the testing posted earlier, I think the listed formula is incorrect and it relies fairly heavily on luck. In the same way, I think turn order is influenced by luck.

Short list of things to figure out:
-Correct multi-hit formula
-Turn order calculations
-"Run" mechanics
Very good observation there. Now I could revise my physical damage dealer tier list for Suikoden 2.

Many thanks! Keep up the good work!
It's not all about knowledge, but it helps.
Omnigamer
Posts: 324
Joined: Wed Feb 13, 2013 11:48 am

Re: [Guide/Formula] Critical hit rate, cont. attack chance,

Post by Omnigamer »

So I broke out the debugger yesterday to check and confirm a few more things.

-Viki has exactly a 2% chance to wrongfully teleport you.
-I confirmed my earlier hit rate formula for enemies other than Luca. I think.
-I looked into escape mechanics. When you haven't met Let Go conditions, the game assigns one of 4 constants based on the proportion of your party level and the enemy party level. Specifically, it checks whether you're more than 2x, 1.5x, 1x, or not greater than the enemy party level. The constant changes by region, but I've seen failure rates as low as 18% and as high as 30%. North Sparrow Pass, for example, is 30%. I don't have a clean or effective way of determining what these rates are, however.


With that in mind, does anybody else have anything in mind that we should figure out the mechanics of? I have not confirmed the multi-hit formula, but I don't have much reason to doubt it. Turn order seems to have some rules on top of it, but I don't think that will require debugging to nail down. There may also be a possibility that enemy stats can vary slightly from their original values by a few points, but this does not apply to bosses. Help with figuring out/confirming anything else would also be appreciated.
Omnigamer
Posts: 324
Joined: Wed Feb 13, 2013 11:48 am

Re: [Guide/Formula] Critical hit rate, cont. attack chance,

Post by Omnigamer »

Does anybody perhaps have further information on the actual physical attack formula? From my basic testing using the very early team against the Mist Shade, magic attacks are completely consistent according to the formula listed on the site. Physical attacks, however, were all over the place. This also goes for Unite attacks. You can also notice variation on enemy attacks. Thus I think the actual physical attack formula is something like:

DAMAGE = (((Offense_ATK * FURY_MOD) + RAND(3:8)) - Defense_PROT ) * ATTACK_MOD

Consider the Mist Shade case. His listed PROT is 10, meaning any incoming attacks should have a flat reduction of 10. A level 2 Riou will have either 16 or 17 STR and a WPN bonus of 5, giving his total ATK of about 21. By most logic, he should do 11 damage against the Shade.

However, out of 7-8 attempts for this, Riou managed to deal damage in the range of 14 to 17 damage pretty consistently. One case is that the Mist Shade's listed PROT is slightly off, but the variation range still implies that some randomness affects the final damage. I think I remember seeing something like this when I was debugging some other battle formulas, but I didn't pay much heed to it. This is also backed up by similar tests with Bolgan; with an ATK of 32, Bolgan would do between 26 and 30 damage.

Unite attacks also get an odd treatment in this regard. I had one case where the Circus Attack Unite did 132 damage against the Mist Shade. On a different use, it did 164. A swing of 32 damage is pretty huge; normal calculations say the attack should do 152 damage with all the characters' strengths taken into account. For this to happen, the random extra damage would need to cover a range of at least 6 and apply to each character individually before the 2x multiplier is applied. This makes the damage fairly unpredictable.

It should be noted that this doesn't happen at the high end. For example, using Kindness Rune glitch to get 999 ATK causes that character to always hit for the same amount of damage, at least from what I've seen. The damage exactly matches what it should be according to the given formula too. So this means that the 999 cap is applied after any additional random damage is added to the attack. This is also true for specialty rune attacks, like Shin's Spider Slay.
KFCrispy
Global Admin
Posts: 6174
Joined: Wed Jun 30, 2004 3:29 pm

Re: [Guide/Formula] Critical hit rate, cont. attack chance,

Post by KFCrispy »

Don't mean to complicate things further, but I believe the Boost status is buggy in this game. From my short time testing it, it was reducing damage.. at least for some characters.
Post Reply