As a French person I feel like it's my duty to explain strikes to you. - AdrienIer

Create an account  

 
Caster of Magic II Bug Reports!

Quote:just create a UI-less combat between 2 AIs

Well first of all, UI and non-UI code are only 90% separate at the moment, 100% separation is something I'm working on currently. After that it's slightly more realistic but I don't think the turns times make it a viable possibility.

Let's assume the very optimistic 10 ms for one AI decision - each unit move has to run finding the shortest path, often several times so I would expect at least that much tho honestly I never measured how long it actually takes.
There are 25 combat turns with 2 players each moving 9 units.

25*9*2=550*10 = 5500 ms = 5.5 seconds worst case, let's say 1 second for shorter battles. That's for one battle without casting spells. The AI runs one of these for each of their stacks and at least one but usually several potential targets.
A midgame AI with 100 stacks would use around 300 seconds approximate per battle simulation, assuming 3 for each stack, 15 whole minutes, and this is per turn per player.
That's unplayable and this is just a random guesstimate, it might be slower by a factor of 10 or 100. (or faster but I don't count on that outcome happening)

The less obvious issue is...how things are run once each game tick. So the AI can pretty much take one action every 1/60 second, and that of course includes combat moves. Even if I skip the UI, I would still need to mess with the core system and somehow make the AI code run out-of-order for every action while still exiting the code frequently enough so the window doesn't turn unresponsive.

We'll have to wait and see how the changed formula helped the automatic combat accuracy in the next update.

The only somewhat realistic way to handle it would be if the simulated battle assumed units can always attack each other and used some rule based on movement speed to determine which turn they are allowed to attack first instead. The finding paths won't take up time but picking spells, simulating damage rolls, etc still does and we had to throw out one of the main factors where the simulation is currently different than real combat.
Reply

makes sense, also changing the main engine will probably also introduce many new bugs. why not set the formula to the sum of powers of the individual units? for example,
without taking abilities into consideration:
stack power = sum of (attack*to hit *defense * todef*hitpoints) of all units?
if there is a very strong hero, there will be a very strong number in the sum and the weak unit's will not influence so much. it's not true IMO that a hero contributes to the ability of each unit such that their abilities are multiplied.
Reply

Quote:why not set the formula to the sum of powers of the individual units?

The DOS version worked like that. Except the system uses attack power, defensive power and hp as three separate stats there and here we also have speed, resistance and a few more for details but the point is, the army has one of each stat instead of separate units.

It was changed because it's extremely inaccurate when the size of armies don't match due to the stats being "separate".

Ultimately it boils down to basic math :

(Attack1+Attack2)*(Defense1+Defense2)*(Hp1+Hp2) being a completely different number from (Attack1*Defense1*Hp1)+(Attack2*Defense2*Hp2).

The latter is the accurate one but the former is the way the combat calculations have to go because it is the one that treats army stats separately and separate stats are unavoidable if we want any more detail than "side A wins because it's stronger", detail like how much damage the winner takes, flying, immunities, retreat at turn 25 etc.

So instead the windows version uses this for each stat :

ArmyAttack = (Sum(AttackN*UnitPowerN)/Sum(UnitPowerN))*NumberofUnits

Where unit power is something similar to your suggestion (attack*tohit*defense*hp*figures etc).

This way stronger units are weighted higher so 6 spearmen and 1 sky drake won't be outclassed by 6 halberdiers like in the previous system. Unfortunately this formula is still vulnerable to the number being different - if there are no 6 spearmen to fill up the ranks and the sky drake fights alone, it is defeated but that's often what happens in real combat anyway with good enough positioning to take advantage of retaliation damage (or smart use of spells - most spells in the game are single target so a single unit army is at a large inherent disadvantage. You only need to lose one resistance or cracks' call roll and your lone Stone Giant is gone. Oh and another disadvantage is you don't get to use revival spells if you have one unit.)

The obvious downside of this system is a strong unit "pulling up" the military value of weaker units it fights together with but I hope the recent change (using sqrt of UnitPower) made that more realistic.
Reply

(February 27th, 2023, 13:25)Seravy Wrote:
Quote:why not set the formula to the sum of powers of the individual units?

The DOS version worked like that. Except the system uses attack power, defensive power and hp as three separate stats there and here we also have speed, resistance and a few more for details but the point is, the army has one of each stat instead of separate units.

It was changed because it's extremely inaccurate when the size of armies don't match due to the stats being "separate".

Ultimately it boils down to basic math :

(Attack1+Attack2)*(Defense1+Defense2)*(Hp1+Hp2) being a completely different number from (Attack1*Defense1*Hp1)+(Attack2*Defense2*Hp2).

The latter is the accurate one but the former is the way the combat calculations have to go because it is the one that treats army stats separately and separate stats are unavoidable if we want any more detail than "side A wins because it's stronger", detail like how much damage the winner takes, flying, immunities, retreat at turn 25 etc.

So instead the windows version uses this for each stat :

ArmyAttack = (Sum(AttackN*UnitPowerN)/Sum(UnitPowerN))*NumberofUnits

Where unit power is something similar to your suggestion (attack*tohit*defense*hp*figures etc).

This way stronger units are weighted higher so 6 spearmen and 1 sky drake won't be outclassed by 6 halberdiers like in the previous system. Unfortunately this formula is still vulnerable to the number being different - if there are no 6 spearmen to fill up the ranks and the sky drake fights alone, it is defeated but that's often what happens in real combat anyway with good enough positioning to take advantage of retaliation damage (or smart use of spells - most spells in the game are single target so a single unit army is at a large inherent disadvantage. You only need to lose one resistance or cracks' call roll and your lone Stone Giant is gone. Oh and another disadvantage is you don't get to use revival spells if you have one unit.)

The obvious downside of this system is a strong unit "pulling up" the military value of weaker units it fights together with but I hope the recent change (using sqrt of UnitPower) made that more realistic.

You are right, thank you, I don't want to take too much of your time on this issue, but in case you will be interested, I will open a topic on suggestions to get a good quick combat result calculation.
Reply

I have an issue with sound effects not playing. Is there some configuration option I'm missing? It's not about the options, sound is turned on. Music works.
I'd like to have working sound effects before I play the game fully. Is there some configuration option to fix this?
Reply

It seems to be fixed - the "click" from the original game is just very faint compared to the music.
Reply

Lines from wizards when they are threatened reference the wrong wizard name. They say stuff like, "You dare threaten the mighty 'player name'? You do not understand their power!" instead of accurately referring to themselves.
Reply

(March 1st, 2023, 02:34)Anskiy Wrote: Lines from wizards when they are threatened reference the wrong wizard name. They say stuff like, "You dare threaten the mighty 'player name'? You do not understand their power!" instead of accurately referring to themselves.

Seems like it was just that one specific line. Fixed, thanks!
Reply

I'm having issues with the sound, music works 100% flawlessly.
But in the intro cinematic the speech of the characters stutters and skips.
The same thing also happens in combat, sound effects playing causes a brief pause/stop and then the sound effect plays and things happen as they would, the pauses/stops happen when units move too due to the sound effects of the footsteps/movement.
Turning off sound fixes this, no more stuttering, but... then you're playing without sound.
Reply

That's strange, all sounds are loaded into the memory and played from there. There can't possibly be a loading delay when playing them on the side of CoM, unfortunately how the system handles the PlaySound call is outside my control.
Reply



Forum Jump: