Get Premium to hide all ads
Posts: 62   Visited by: 551 users

Original post

Posted by clovis1122, 13.05.2020 - 13:53
I wanted to write this down somewhere, so here it goes: as Ivan stated back in 2015, there's really no %. There's no concept of "priority" in the code, just "order and random rolls".

We manage a list of Turn Actions for every player, and they're processed as follows. Let's assume player A attacked player B, while player B tried to run away:

1. Pick a random player.
2. Pick his next action (if any, if no more moves just pick another player). Let's assume player A's action is selected.
3. See where the stack wants to go (e.g attacking another city or unit, or just moving away). If he's not being attacked, complete the move successfully. Mark his target as "attacked".
4. Finish the action, and go again from step 1. Let's assume we now pick player B's Turn Action. He wants to move his units away.
5. Now, we check that this stack is being attacked and it is in defense position. We will calculate the chances of this stack being intercepted: we will roll a random number between 0 and 1. If the number is higher than (AttackerArmyCount / (DefenderArmyCount * 2)) [EDIT: the actual formula is AttackerArmyCount / DefenderArmyCount * 2, which is processed as (AttackerArmyCount / DefenderArmyCount) * 2. then the stack escapes.

This system has been in place for more than 3 years. Updates like this one from 2012 are either outdated or weren't implemented as-is. This explanation reveals lots of unintended behaviors, especially when you consider what a Turn Action really is. I hope it sheds some light for those interested in this system.

EDIT: please also check Dave's explanation for more details about this mechanic.
13.01.2021 - 22:20
 Witch-Doctor (Mod)
Written by PleaseMe, 13.01.2021 at 21:10

Written by Dave, 13.01.2021 at 21:05

Written by PleaseMe, 13.01.2021 at 21:03

Written by Dave, 13.01.2021 at 20:57

Written by taomerde, 13.01.2021 at 08:12

Sooo basically the more troops u have the higher the chance to turnblock?


Basically, yes.

i thought it capped out at 50% though?


Yes that's true. The more troops you have the higher the chance to turnblock... upto a max chance of 50%.

can we delete turn blocks. no more luck all skill now


There would be no skill at all, you can go blitz and spam tanks and never be punished because your tank stacks cant be tbbed.
Turnblocks is what forces people to defend their transports, defend their fragile tank stacks, etc...
Loading...
Loading...
14.01.2021 - 03:11
Written by PleaseMe, 13.01.2021 at 21:10

Written by Dave, 13.01.2021 at 21:05

Written by PleaseMe, 13.01.2021 at 21:03

Written by Dave, 13.01.2021 at 20:57

Written by taomerde, 13.01.2021 at 08:12

Sooo basically the more troops u have the higher the chance to turnblock?


Basically, yes.



can we delete turn blocks. no more luck all skill now

No think again what braindead gameplay we'd have.
----
Loading...
Loading...
01.05.2021 - 19:28
 Dave (Admin)
Correction -- A novel by Dave

I was recently looking into this again after somebody asked me some questions about it. I noticed the things Clovis said in this topic, and even the things I said too, were not matching up with what was actually happening in-game when I did some tests. It turns out what we both said were wrong.

I've looked through the code again, AND tested in-game, and the following is what really happens.




First, we have to understand the issue of move order. This is important because it may seem like you "escaped a turnblock", when in fact a turnblock was never possible due to the particular order of moves. (Clovis has explained this system correctly, but I'll explain it again in my own way.)

So... Within in a turn, players can make several moves. Let's call that the "moves list". It may look something like this:

Player A:
- Build some units
- Move stack X from A to B
- Use stack Y to attack enemy stack Z

Player B:
- Build some units
- Move stack Z from C to D

At the end of the turn, the game processes these moves like so: 1) pick a random player, 2) process the first move from their list, 3) pick a random player (might even be the same player again), 4) process the next move on their list, and so on.

So the end result might look like this:

Player A -- Build some units
Player B -- Build some units
Player B -- Move stack Z from C to D
Player A -- Move stack X from A to B
Player A -- Use stack Y to attack enemy stack Z.

But that's just one possible result... it could just as easily come out another way, for example:

Player B -- Build some units
Player A -- Build some units
Player A -- Move stack X from A to B
Player A -- Use stack Y to attack enemy stack Z.
Player B -- Move stack Z from C to D

Other combinations are possible too, these are just 2 examples. As you see, the moves are taken "in order" in the sense that a player's first move is always done before his later moves... but overall it's random in the sense that Player A's moves could be before Player B's, or they could be after, or mixed in different combinations.




With that in mind, now lets consider what happens when you attack a stack that's moving. Let's say Player A has stack Y, and Player B has stack Z. Player A moves stack Y to attack Player B's stack Z. During the same turn, Player B moves stack Z from place C to D.

What happens at the end of the turn?

Well, if the move list looks like the first example above, we see that "Player B -- Move stack Z from C to D" is processed BEFORE "Player A -- Use stack Y to attack enemy stack Z". In other words, Player B's stack moves before Player A's attack. Now the question becomes distance -- did Player B's stack move out of range of Player A? If yes, then no attack happens. If no, then Player A's stack follows Player B's and attacks.

So, the point here is, depending on the order in which the moves are applied, a stack might "escape" before we even consider if its a turnblock situation or not.

Or, put another way, if the stack moves out of range of the would-be attacker, it escapes. There's no question of a turnblock in this case.




Finally, lets talk about turnblocks. Continuing with the above examples, lets say Player B is moving stack Z from place C to D. Meanwhile Player A is using stack Y to attack stack Z. Let's suppose stack Z's move is entirely within the range of stack Y, so escape due to range is not a possibility. So now we have, by default, a turnblock.

I say "by default", because the system starts with the assumption the move will be blocked. It then applies the "turnblock formula" as a possible means of escaping the turnblock, and only IF that is successful is the turnblock avoided.

To say that again, turnblocks ALWAYS happen, unless you win the chance to escape it.

So how to escape a turnblock? First, the defender (Player B) must have MORE THAN 3 units in his stack to escape. If you have 3 or less units, you will be turnblocked every single time. (Unless your stack escapes due to range, as discussed earlier, which happens before turnblocks enter into the equation.)

Assuming the defending stack has > 3 units, the famous "turnblock formula" now arrives:

If RandomNumber > AttackerArmyCount / DefenderArmyCount * 2
Then escape

(This is almost verbatim from the atWar source code... I've only simplified the names for clarity.)

RandomNumber is a random number between 0 and 1.
AttackerArmyCount is how many units are in the attacking stack.
DefenderArmyCount is how many units are in the defending stack.

Here's the problem though: this is NOT as Clovis wrote in the original post, when he said:

AttackerArmyCount / (DefenderArmyCount * 2)

Those parentheses are NOT present in the source code. It may seem like a slight difference, but it's actually really important as that completely changes the math order of operations here. As a result what I said in this thread about the max chance being 50% is WRONG!

It is, in fact, like this, without the parentheses:

AttackerArmyCount / DefenderArmyCount * 2

Which, in C# code, is mathmatically the same as:

(AttackerArmyCount / DefenderArmyCount) * 2

Now, I don't know if Amok/Ivan did it this way on purpose or not. Maybe this is what they wanted. All I know is I've never changed it... it is exactly how it was from their time.

What's so important about this? It means that... if the attacking stack is at least half the size of the defending stack, the defending stack has NO HOPE OF ESCAPE. In other words, they will be turnblocked every single time.

If there is a stack of 20 units and I send 10 units to attack it, it WILL BE turnblocked. Every time. (Again, unless the 20 stack moved out of range of my attack... that's the only loophole.)

If I send less than 10, against a stack of 20, it then becomes a chance. For example if I send only 5, the chance of TB will be 50%.




So to sum up, what does all this mean?

First, when attacking a stack that's moving, any of the following could happen:

1) it could move out of range, preventing the attack
2) it could move within range and the attack proceeds

Second, if the attack proceeds, you are now "turnblocked" unless you can escape from it:

1) If defender has 3 or fewer units, they can't escape. They are turnblocked.
2) If attacker has at least 50% the units the defender has, they can't escape. They are turnblocked.
3) Otherwise, there is a % chance the defender *might* escape.

So there.
----
All men can see these tactics whereby I conquer,
but what none can see is the strategy out of which victory is evolved.
--Sun Tzu

Loading...
Loading...
01.05.2021 - 19:44
 Witch-Doctor (Mod)
Wow of course the actual tb system is the jankiest thing i've ever seen. What happens if player A's attack enemy stack Z is processed before player B moved his stack Z out of the way.
Loading...
Loading...
01.05.2021 - 20:11
Queston, how does move order work when there are multiple people in a single game? I am assuming the move order would work similar, but now we add player C, D, E... etc?

So in a team game for example a 3v3, do you now have a 1/6 chance of making the very first move?
Whenever I imagined move priority, i only ever thought of it being between two people and not larger game.
----
Loading...
Loading...
01.05.2021 - 20:13
 Dave (Admin)
Written by Witch-Doctor, 01.05.2021 at 19:44

Wow of course the actual tb system is the jankiest thing i've ever seen. What happens if player A's attack enemy stack Z is processed before player B moved his stack Z out of the way.


If the attack is processed first, the TB formula will be applied. If stack Z wins the chance to escape it escapes, otherwise it's TB'd.

Either way, unless the stack happens to move out of range first... the TB formula gets applied.
----
All men can see these tactics whereby I conquer,
but what none can see is the strategy out of which victory is evolved.
--Sun Tzu

Loading...
Loading...
01.05.2021 - 20:22
 Dave (Admin)
Written by PleaseMe, 01.05.2021 at 20:11

Queston, how does move order work when there are multiple people in a single game? I am assuming the move order would work similar, but now we add player C, D, E... etc?

So in a team game for example a 3v3, do you now have a 1/6 chance of making the very first move?
Whenever I imagined move priority, i only ever thought of it being between two people and not larger game.


So let's say 6 players have 3 moves each... it *might* happen in a nice and neat order like this:

Player 1 - Move 1
Player 2 - Move 1
Player 3 - Move 1
Player 4 - Move 1
Player 5 - Move 1
Player 6 - Move 1
Player 1 - Move 2
Player 2 - Move 2
Player 3 - Move 2
Player 4 - Move 2
Player 5 - Move 2
Player 6 - Move 2
Player 1 - Move 3
Player 2 - Move 3
Player 3 - Move 3
Player 4 - Move 3
Player 5 - Move 3
Player 6 - Move 3

(I guess that would be the ideal in terms of fairness)

OR it could happen in a totally wonky order like this:

Player 5 - Move 1
Player 5 - Move 2
Player 5 - Move 3
Player 4 - Move 1
Player 2 - Move 1
Player 3 - Move 1
Player 4 - Move 2
Player 6 - Move 1
Player 1 - Move 1
Player 1 - Move 2
Player 6 - Move 2
Player 2 - Move 2
Player 6 - Move 3
Player 3 - Move 2
Player 1 - Move 3
Player 4 - Move 3
Player 2 - Move 3
Player 3 - Move 3

It's possible a player could get really lucky (like Player 5 in this example) and have all their moves processed before anyone else...

It kinda makes me wonder if I should change this system because it's almost a free-for-all...
----
All men can see these tactics whereby I conquer,
but what none can see is the strategy out of which victory is evolved.
--Sun Tzu

Loading...
Loading...
01.05.2021 - 20:24
If you understood what Dave wrote then i got bad news for you


----
Loading...
Loading...
01.05.2021 - 20:32
Quote:
Written by Dave, 01.05.2021 at 20:22


It kinda makes me wonder if I should change this system because it's almost a free-for-all...

I think people like the free for all aspect because it applies more rng.

If there was an order to things, people would just find another thing to complain about. (You only won because you're player 1 and i'm player 2.)
----
Loading...
Loading...
01.05.2021 - 20:43
 Dave (Admin)
There's also this strange code I haven't been able to explain yet:

if ( ( RandomNumber * AttackingUnits * PrayersToZizou ) > 42 && isFullMoon ) {
blockAllTurnblocks = true;
} else {
DCrandomPlayers();
}

I'm joking... real AW code would have at least 5 levels of nested conditionals...
----
All men can see these tactics whereby I conquer,
but what none can see is the strategy out of which victory is evolved.
--Sun Tzu

Loading...
Loading...
02.05.2021 - 03:37
 Mobster (Mod)
Imagine it only picking the opponent's all moves first in that order for a whole game...

Thank you so much Dave, this is fucking golden! Precious!
But about this...
Quote:
Player A -- Build some units
Player B -- Build some units

I thought building some units didn't count as action?
Loading...
Loading...
02.05.2021 - 06:45
Dave just revealed too much information to us noobs. I had no idea rang was such an important factor. Now everyone will be at the same level as the "pros"

I still think that there should be a strategy that alters turn block calculus. For example, there should be a strategy that makes is so that whenever the turn block formula gets applied, it favors the player who has the strategy by making the number in the equation 4 instead of 2 or something. That way the person could easily escape turn blocks and dominate the match at the expense of other things. I proposed this months ago, it is called "Swift Escape" or something. The strategy could recognize whether "DefenderArmyCount" is associated with a player who has the strategy, then apply the new formula in any battle the person has that involves turnblocks where he is the Defender

Edit: I just finished reading and realized the parentheses don't apply... ok so that should be changed too. But it doesn't really matter in the case of making a strategy like this. The formula would change no matter what whenever DefenderArmyCount is determined to be associated with the player who has the strategy.
----
Happiness = reality - expectations
Loading...
Loading...
02.05.2021 - 09:47
Thanks for sharing!
Loading...
Loading...
03.05.2021 - 15:14
 Dave (Admin)
Written by Mobster, 02.05.2021 at 03:37

I thought building some units didn't count as action?


Actually it does.

I just double checked ... building units is counted as a "turn action".
----
All men can see these tactics whereby I conquer,
but what none can see is the strategy out of which victory is evolved.
--Sun Tzu

Loading...
Loading...
03.05.2021 - 15:58
 Mobster (Mod)
Written by Dave, 03.05.2021 at 15:14

Written by Mobster, 02.05.2021 at 03:37

I thought building some units didn't count as action?


Actually it does.

I just double checked ... building units is counted as a "turn action".
Wow... That changes everything. So that was probably why I was getting tbed in 3 places a turn frequently. Thank you so much Dave.
Loading...
Loading...
03.05.2021 - 18:49
Written by Dave, 01.05.2021 at 20:22

Written by PleaseMe, 01.05.2021 at 20:11

Queston, how does move order work when there are multiple people in a single game? I am assuming the move order would work similar, but now we add player C, D, E... etc?

So in a team game for example a 3v3, do you now have a 1/6 chance of making the very first move?
Whenever I imagined move priority, i only ever thought of it being between two people and not larger game.



I tried Late moving someone and tbed him.
That's enough of my words to support changing that.
----
[INSERT SIGNATURE HERE]
Loading...
Loading...
06.05.2021 - 07:31
Written by Dave, 01.05.2021 at 19:28

Correction -- A novel by Dave

I was recently looking into this again after somebody asked me some questions about it. I noticed the things Clovis said in this topic, and even the things I said too, were not matching up with what was actually happening in-game when I did some tests. It turns out what we both said were wrong.

I've looked through the code again, AND tested in-game, and the following is what really happens.

.......


Best forum post of 2021, you have earned 1 blowjob token
----
Loading...
Loading...
06.05.2021 - 23:40
Music to my ears seeing Dave shut up the know it alls
----
Lest we forget
Moja Bosna Ponosna
Loading...
Loading...
07.05.2021 - 02:27
 Dave (Admin)
Just to be clear (because somebody asked), I was only trying to figure out how turnblocks work, I haven't actually changed anything. I haven't changed the turnblock code at all in the 2+ years I've been here, and I don't have any plans to change it in the immediate future. (Maybe someday, but not anytime soon... I'm scared to even touch it tbh...)
----
All men can see these tactics whereby I conquer,
but what none can see is the strategy out of which victory is evolved.
--Sun Tzu

Loading...
Loading...
07.05.2021 - 16:05
 Witch-Doctor (Mod)
Written by Augustus Caesar, 06.05.2021 at 23:40

Music to my ears seeing Dave shut up the know it alls

That should include you who seems to think this whole system was a bug when there's some sort of thought behind it.
Loading...
Loading...
07.05.2021 - 16:08
 Lelouch. (Mod)
Written by Dave, 07.05.2021 at 02:27

Just to be clear (because somebody asked), I was only trying to figure out how turnblocks work, I haven't actually changed anything. I haven't changed the turnblock code at all in the 2+ years I've been here, and I don't have any plans to change it in the immediate future. (Maybe someday, but not anytime soon... I'm scared to even touch it tbh...)

I'm not sure people would be happy if you touched it anyways. Your fear is understandable.
Loading...
Loading...
08.05.2021 - 03:27
Written by Witch-Doctor, 07.05.2021 at 16:05


Don't try to misrepresent my words mate, it won't correct your mistakes.
----
Lest we forget
Moja Bosna Ponosna
Loading...
Loading...
09.05.2021 - 09:10
Written by Dave, 03.05.2021 at 15:14

Written by Mobster, 02.05.2021 at 03:37

I thought building some units didn't count as action?


Actually it does.

I just double checked ... building units is counted as a "turn action".


This explains a lot. I have been building units first. Wow
Loading...
Loading...
13.05.2021 - 01:57
Written by Dave, 03.05.2021 at 15:14

Written by Mobster, 02.05.2021 at 03:37

I thought building some units didn't count as action?


Actually it does.

I just double checked ... building units is counted as a "turn action".


On production and moves:
Just for clarity... if i build 3 bombers before taking them out of a city... does it count as the same number of moves as building one bomber i.e 1 move. and if so does building a stack of 2 inf 2 tanks and 2 mili before moving the stack out count as 1 move or 6 moves for each unit built.. or low and behold does it count as 3 moves for each unit type?

And going into more detail on production vs chance to be tb'd.

If i have 2 units and 8 reinf.. and someone sends 1 unit to tb... is it the 2 existing that get tb'd meaning guaranteed tb inc the 8? or is it the 8 i build and the 2 that get tb'd meaning theres only a 20% chance with formula? This follows on from question above and how many moves regarding production...
----
Loading...
Loading...
13.05.2021 - 03:37
 Dave (Admin)
Written by Phoenix, 13.05.2021 at 01:57

On production and moves:
Just for clarity... if i build 3 bombers before taking them out of a city... does it count as the same number of moves as building one bomber i.e 1 move. and if so does building a stack of 2 inf 2 tanks and 2 mili before moving the stack out count as 1 move or 6 moves for each unit built.. or low and behold does it count as 3 moves for each unit type?


It doesn't matter how many units or which types you build in a city, it all counts as 1 action. But only within that city. If you built some units in a 2nd city then that would count as a 2nd action, and so on.

Written by Phoenix, 13.05.2021 at 01:57

And going into more detail on production vs chance to be tb'd.

If i have 2 units and 8 reinf.. and someone sends 1 unit to tb... is it the 2 existing that get tb'd meaning guaranteed tb inc the 8? or is it the 8 i build and the 2 that get tb'd meaning theres only a 20% chance with formula? This follows on from question above and how many moves regarding production...


That's a very good question... I'm really not sure. I'll have to go back to the code and try to figure that one out....

Edit: I also don't know if autoproduction counts as a turn action or not, I'll check...
----
All men can see these tactics whereby I conquer,
but what none can see is the strategy out of which victory is evolved.
--Sun Tzu

Loading...
Loading...
13.05.2021 - 03:49
Written by Dave, 13.05.2021 at 03:37


It doesn't matter how many units or which types you build in a city, it all counts as 1 action. But only within that city. If you built some units in a 2nd city then that would count as a 2nd action, and so on.



Thanks for answers and... Sorry but this raises 1 more q for me...

So If I build 2 units (theoretical move 1).. send them to tb somewhere (theoretical move 2).... and then build more units in that city to defend (theoretical move 3)... does the production of all those units in move 1 and move 3 then count as a merge, meaning move 1 effectively becomes bundled into move 3? effectively meaning your tb units are more likely themselves to be tb'ed?
----
Loading...
Loading...
13.05.2021 - 03:56
 Dave (Admin)
Written by Phoenix, 13.05.2021 at 03:49

Thanks for answers and... Sorry but this raises 1 more q for me...

So If I build 2 units (theoretical move 1).. send them to tb somewhere (theoretical move 2).... and then build more units in that city to defend (theoretical move 3)... does the production of all those units in move 1 and move 3 then count as a merge, meaning move 1 effectively becomes bundled into move 3? effectively meaning your tb units are more likely themselves to be tb'ed?


Oof this got complicated fast... but that's okay. I don't know so I'll have to find about that also...
----
All men can see these tactics whereby I conquer,
but what none can see is the strategy out of which victory is evolved.
--Sun Tzu

Loading...
Loading...
13.05.2021 - 07:44
I always just try to make as few moves as possible when I'm doing an important turn block so I don't build units just in case this is the case, but it would be great to be told that it is not the case. Also there should be a repository of information about this stuff because I'm sure there are smart noob people who understand the game is more complex than you'd think and might want to read a long manual
----
Happiness = reality - expectations
Loading...
Loading...
17.05.2021 - 14:46
Written by Dave, 01.05.2021 at 19:28




Finally we get a good explanation on how the turn blocks work. And from a reliable source so thanks

Would be great if that was explained in a tutorial
----
Loading...
Loading...
20.07.2021 - 20:01
I read this for first time. AW is really complex than it looks.
Loading...
Loading...
atWar

About Us
Contact

Privacy | Terms of service | Banners | Partners

Copyright © 2024 atWar. All rights reserved.

Join us on

Spread the word