Combat outcome calculation (berserk)
Moderator: Forum Moderators
-
- Posts: 876
- Joined: November 28th, 2008, 6:18 pm
Combat outcome calculation (berserk)
In past I played SX maps with BfW 1.4 and noticed an extremely long computation if two very strong units faced one another.
Then I had heard the algorithm was improved, but now I have heard the outcome computation is still very slow.
The slowness of the algorithm is suspicious for me, I think it should be quite fast in case it was done in C++.
Can anyone tell how is the algorithm done roughly?
Then I had heard the algorithm was improved, but now I have heard the outcome computation is still very slow.
The slowness of the algorithm is suspicious for me, I think it should be quite fast in case it was done in C++.
Can anyone tell how is the algorithm done roughly?
I work on Conquest Minus • I use DFoolWide, Retro Terrain Package and the add-on 'High Contrast Water'
I moved to Nosebane's corner (Doc Paterson's signature); I am spending my time there, so PM me if I don't answer your post in forums
I moved to Nosebane's corner (Doc Paterson's signature); I am spending my time there, so PM me if I don't answer your post in forums
-
- Posts: 876
- Joined: November 28th, 2008, 6:18 pm
Re: Combat outcome calculation (berserk)
That thread is related to the topic, but it doesn't explain the algorithm that computes the outcome matrix...
Re: Combat outcome calculation (berserk)
roughly: create hp distribution matrix, set to initial hitpoints, 'simulate' all attacks, changing the hp distribution matrix in the process, after each attack. see
http://svn.gna.org/viewcvs/wesnoth/trun ... iew=markup
http://svn.gna.org/viewcvs/wesnoth/trun ... iew=markup
Re: Combat outcome calculation (berserk)
it just doesn't scale well here. has nothing to do with c++...Sapient wrote:In attack evaluation phase it builds a matrix of every possible outcome, and you can see this also in the damage calculations preview. If a unit has thousands of hitpoints, drain and/or berserk then it will cause a real slowdown.
http://mirror.linux.org.au/linux.conf.a ... gaming.ogg
(~1h50)
-
- Posts: 876
- Joined: November 28th, 2008, 6:18 pm
Re: Combat outcome calculation (berserk)
There is no need to simulate anything:Crab wrote:... 'simulate' all attacks ...
I attached a file with a simple algorithm that counts a chance to kill for each specific strike. The distribution matrix may be computed from the spreadsheet this way:
for each cell in columns R (chance attacker kills now) and S (chance defender kills now) one can easily count a partial hp distribution matrix (rather hp distribution *vector*, because one side always dies), then add distribution matrixes of individual cells together.
the algorithm contains a mistake. Will you be the first one who finds it out?
Edit: the attached file contains formulas in cells now.
- Attachments
-
- berserk_calculator.zip
- (19.86 KiB) Downloaded 323 times
Last edited by SlowThinker on April 4th, 2012, 3:31 pm, edited 4 times in total.
- Drakefriend
- Posts: 436
- Joined: September 27th, 2009, 12:57 pm
- Location: Wandering from one world to another
- Contact:
Re: Combat outcome calculation (berserk)
But you also have to calculate the hitpoints for any combinition of hits, which is important for the surviving unit, and for normal combat.SlowThinker wrote:There is no need to simulate anything:Crab wrote:... 'simulate' all attacks ...
I attached an Excel file with a simple algorithm that counts a chance to kill for each specific strike. The distribution matrix may be computed from the spreadsheet this way:
for each cell in columns R (chance attacker kills now) and S (chance defender kills now) one can easily count a partial hp distribution matrix (rather hp distribution *vector*, because one side always dies), then add distribution matrixes of individual cells together.
After far too long an absence, I have returned.
According to the quiz 100% Silver Mage (85% Archmage, 75% Shyde, 67% Flameheart and Ancient Wose,58% Assassin, Troll Warrior and Berserker). And my top score is exactly how I see myself.
According to the quiz 100% Silver Mage (85% Archmage, 75% Shyde, 67% Flameheart and Ancient Wose,58% Assassin, Troll Warrior and Berserker). And my top score is exactly how I see myself.
-
- Posts: 876
- Joined: November 28th, 2008, 6:18 pm
Re: Combat outcome calculation (berserk)
Why would I need it? I believe all I need is the aggregate hp distribution matrix.Drakefriend wrote:But you also have to calculate the hitpoints for any combinition of hits, which is important for the surviving unit, and for normal combat.
____________________________________________
Edit: My apologies, the original spreadsheet didn't contain formulas, only values.
But why nobody complained? I said "I attached a file with an algorithm", but there was nothing resembling to an algorithm ... 6 people downloaded it ...