announcements

Forum > Announcements > A small fix to who hits first
Reply To Thread (login)
Ender [1]
Administrator
2016-07-13 23:10:12
[7 years, 260 days ago]

If you're not interested in the finer details and minutiae of the game, you can stop reading now.

As many folks are aware, who hits first in a battle depends on you and your opponent's intelligence stat. A random number from 0 to $int (inclusive) is chosen - the higher roll gets to hit first. In the event of a tie, the attacker goes first.

Okay, so tiny edge for the attacker - no big deal, right? Well, remember that as of March 1, 2012, minimum effective int is 1 (it was always 5 in bots2). For bots that are supposed to be the top of their class, effective int will be 1, so this edge case is actually pretty common. For a 1 int vs. 1 int battle, some quick math tells us the attacker will go first 75% of the time.

Still not a big deal though, right? Enter tournaments. Due to my obsessive personality and need for everything to be deterministic, the order that bots battle each other is well defined:

  1. Get all the bots in a category.
  2. Sort them by id.
  3. Have the first bot battle all the others that come after it (i.e. all other bots).
  4. Have the second bot battle all the others that come after it (i.e. all other bots except the first bot).
  5. Repeat until you reach the end of the list of bots.

In case you missed it, the bot with the lower id will always be the attacker. 1 int bots are especially common in tournaments, so there is therefore a small edge for bots with lower ids. Hitting first is certainly an edge, but just how large this edge is would be difficult to estimate. In reality, I imagine the difference is extremely tiny and unlikely to have actually affected any results more than normal statistical variance would have introduced.

In any case, this is fixed. Attackers no longer have an advantage - in the event of a tie, an additional roll is done where each bot has a 50% chance of winning. Thanks to Esvrainzas for identifying this possibility way back in April 2015, a mere month after tournaments were first introduced. Shame on me for taking this long to fix the bug!


 
Fleke3 [68]
2016-07-14 02:00:22
[7 years, 260 days ago]

Youre doing an awesome job Ender, thanks for keeping this game alive :)


 
Esvrainzas [175]
2016-07-14 02:43:00
[7 years, 260 days ago]

In fact it was possible to see this effect. Look at these results. Basically Oph bots are similar to Bac and Stm. However, due to their lower id they got better places than the other bots.


 
Benny [44]
2016-07-14 03:42:53
[7 years, 260 days ago]

Oh crap. I've lost my edge now 😞. Using bots with lower ID was my secret masterplan...


 
Ender [1]
Administrator
2016-07-15 00:55:44
[7 years, 259 days ago]

Youre doing an awesome job Ender, thanks for keeping this game alive :)

And thank you and everyone else for playing! This little project of mine would be nothing without a dedicated player base. :)

In fact it was possible to see this effect. Look at these results. Basically Oph bots are similar to Bac and Stm. However, due to their lower id they got better places than the other bots.

This comment intrigued me. It intrigued me enough to finally throw together a simulator script to verify this claim. It turns out this only took 20 minutes or so to write thanks to all the refactoring that was done for the tournament code last year. It's actually very simple to call the battle code now for any pair of bots. Anyway, I had Oph1 (using its configuration from tournament 2 - all of these get saved) battle itself 10,000 times with a variety of game rules. Here are my observations (result key = attacker wins vs. defender wins):

  • Current game code: 4992 vs. 5008
  • Bug described in this thread reintroduced: 5397 vs. 4603
  • Attacker hacked to have 2 int instead of 1: 5224 vs. 4776
  • Attacker hacked to have 10 int instead of 1: 5578 vs. 4422

This is very interesting:

  • First of all, each of these ~51 second runs of 10k battles is repeatable with little variance, so I'm convinced the number of trials is large enough for the results to be statistically significant.
  • Second of all, who hits first absolutely does matter. 50% vs. 54% win rate when the bug is not present vs. present is a relatively small difference, but it is a difference. I expect the size of this margin would vary depending on the bots involved - getting in the first hit surely matters much more for faster battles, i.e. those with lower HP and higher damage.
  • Third of all, maybe 1 int isn't the right answer for bots trying to be as strong as possible. It's long been assumed that a point in int is a point wasted (for bots aiming to battle). The final two experiments show that even just 1 extra point of int can make a measurable difference if your opponent only has 1 int - in this case, you get to hit first 66.6% of the time instead of 50%.

Happy bot building with this new info!


 
Esvrainzas [175]
2016-07-15 03:50:03
[7 years, 259 days ago]

Hmm interesting. Thanks for sharing those simulations :)


 
MrZal2 [100]
2016-07-15 11:45:16
[7 years, 259 days ago]

Here I thought you disliked build simulators Ender.

Also, this change is boring. Instead of ID, it should be based on whether you have the world Zal in your name. You have a 50% higher chance of hitting if you do.

Really though, I don't much care, the tournament thing is silly with just 1 battle anyway. Some tournaments have had 8 different winners in 8 months. One bot will be 3rd one month and 6th the next. Or one will be 1st and 8th the next with everyone having the same build as the month before. It's broken as shit anyway.


 
Ender [1]
Administrator
2016-07-15 19:47:01
[7 years, 258 days ago]

Here I thought you disliked build simulators Ender.

[citation needed]

I don't think I've stated that before. In fact, I reviewed the code for a player's simulator within the past week and provided feedback on it. More generally, I often don't understand how you arrive at your conclusions, Zal.

Also, this change is boring. Instead of ID, it should be based on whether you have the world Zal in your name. You have a 50% higher chance of hitting if you do.

Yes, this update is about finer details and minutiae, as stated in the very first sentence. Not everyone will care about it and that's okay.

Really though, I don't much care, the tournament thing is silly with just 1 battle anyway. Some tournaments have had 8 different winners in 8 months. One bot will be 3rd one month and 6th the next. Or one will be 1st and 8th the next with everyone having the same build as the month before. It's broken as shit anyway.

This is getting off-topic and I don't understand your unnecessarily negative attitude, but what you're talking about has been discussed ad nauseam. There's a spectrum of possibilities with the number of battles per bot combination in tournaments. The choice of 1 battle was intentionally chosen so that randomness and variance would be factors, not simply who has the mathematically strongest bot. It's fine to disagree with how the game is designed, but it was very much an intentional choice.


 
MrZal2 [100]
2016-07-15 22:14:31
[7 years, 258 days ago]
I don't think I've stated that before. In fact, I reviewed the code for a player's simulator within the past week and provided feedback on it. More generally, I often don't understand how you arrive at your conclusions, Zal.

Here is your citation. You won't support official fight/build simulators. I meant fight simulators by the way. That was what I was going off of.

And yes, of course it's just a small change. I shouldn't have gotten on the tournament thing but it seemed like what you guys wanted to talk about.

This is getting off-topic and I don't understand your unnecessarily negative attitude, but what you're talking about has been discussed ad nauseam. There's a spectrum of possibilities with the number of battles per bot combination in tournaments. The choice of 1 battle was intentionally chosen so that randomness and variance would be factors, not simply who has the mathematically strongest bot. It's fine to disagree with how the game is designed, but it was very much an intentional choice.

Only negative thing I said was that it's broken as shit. To me it's more of a lottery than it is a tournament. Out of 10 bots with the same builds it'll just pick a random one by luck. Everyone agrees it is luck based. It's just that the sheer variance is silly. From 1st to 8th against the same bots one month to the next. Having 2 or 3 battles would help this I think. But this is what happens in a mathematics game. No input from the player in the battles really limits it. There's no way a real tournament could really happen the way the game is set up anyway since everything is too automated.

So there, my explanation of why I don't care. The only way to win is to copy the winner's build, which is fairly easy, then make 10 of them and hope one wins. Too much effort for just a stupid trophy to show off in your clan profile which inflates with 100+ members in some clans. But I'm not one of those people who reset their bots 100 times and gets the level 200 with no losses platinums and dumb shit like that every month. Which shouldn't even be possible. Bah, I could go on all day. The thread of stuff I could fill would be 10 pages long.


 
Gpof2 [130]
2016-07-16 08:13:04
[7 years, 258 days ago]

Everyone agrees it is luck based.

The only way to win is to copy the winner's build, which is fairly easy, then make 10 of them and hope one wins.

But it's luck based, why bother with a build?


 
Ender [1]
Administrator
2016-07-16 10:55:36
[7 years, 258 days ago]

That thread was about building a fight simulator into the game. I'm fine with technical folks building their own simulators. And it would be silly for me to not simulate fight results as the game developer. It's the only way I can test and balance battle changes.

Regarding lottery and luck factor, I agree luck is a factor but disagree the tournament is a lottery. You must have a strong bot to have a chance at winnning. When developing the tournament, I ran simulated tournaments over and over and compared results. Yes, the results changed, but no, it was not a completely random ordering. Certain bots tended to appear further up in the results, as would be expected. The level of variance was an amount I was comfortable with.

I hear you on needing to build 10 bots with the best[*] bot and to hope one of them wins to have a shot at the plat. That's not very fun. But the alternative isn't much better - worse, I'd argue. If the mathematically strongest bot always won, folks would simply copy that build and we'd be in the same situation as today. There's ultimately not a lot that can be done about this in a game like this where the battles aren't interactive and the same items are available to everyone. Two ideas for possibly addressing though this are (a) alternative tournaments with different rulesets (e.g. shopping-style tournament) and (b) more item variance (I think I've talked about this a bit before - there's a lot that could be done in this area, so I need to think about it a lot more). Particularly if (b) happened, then I might be comfortable with adding more battles to tournaments to reduce variance.

[*] I think my earlier post strongly suggests that so-called "best" builds may not in fact be best. I'm guessing the 2 int vs 1 int result surprised quite a few experienced bot builders.


 
Forum > Announcements > A small fix to who hits first
Reply To Thread (login)