Tournament Fairness and Resource Distribution

Hi Guys,

I do apologize that I’m only sending this now but the engine changes was quite short notice so I have limited time to tinker.

I ran 4 differently seeded maps where I only played my own bot against itself in a 4V4 setting.

Worldseed: 52323, 31726, 91825, 19288

My results for the above always had my player A bot win.

At first I reasoned seed plays a big part, But that does not explain how my bot with the exact same population growth for the vast majority of the match would end with Player A bot having 100 000 stone Player 2 had 50 000 while Player 3 and 4 both at 25 000

Because of storage limitations positional advantages are almost completely limited (depending on the strategy and level of a bot)

Then I traced the way the engine works and realized that:
This AddAction Function in Botobject.cs line 50 triggers individually for each bot,

So I did something weird, I added a 200 MS delay to my player 1,2 and 3 bot, and suddenly my player 4 bot (who sent commands first) won, Went from last place to firstplace by adding a delay,

This means that the current engine advantages moves made quicker unfairly.
Especially a issue if different languages have different processing factors.

So the conclusion is the bot that submitted moves first gets all the spoils.

The most probable solution is to wait the full 200MS, only process moves at the very end. (So that you can assume all moves are in),

Then you can calculate the total amount of “legal units” inbound to a node from every player.
Then you can assign a percentage to every player and example say if players sent the following units to nodes:

30,40,20,10 then its 30%, 40%, 20%, 10%.

And either the resource distribution is split or the base current Nodes are.

As this is an issue of fairness I do feel it supersedes any code freeze.
My own bot isnt very hard on time. But you definately do not want people who use AI libraries and time based processing to walk into a deathtrap either.

I still believe in fair.
This is very important. The solution should not be too complex, Mainly because you can assign weight to every player.

In the end I had to test my earlier question of:
What happens when two players sends units to the same node.

What happens to the weight if the 1st person who sent the command for their units to completely mine the node (100 units), and to the 2nd second person who sent the a command of 30 units to mine the node.
Then bot one get 100% and bot 2 get 30% of the resources? The engine does work on a first come, first spoils strategy as they are using a queue to process commands. So a person who have a crazy quick AI processor will always have advantage to a badly designed AI processor in that 250ms. It’s all still based on time, who can get their quicker, will get the spoils.

I do agree with the resource distribution concerns. But playing a large amount much games during the tournament would negate that concerns of a unevenly distributed field?
What random generated are EC using for resource distribution calculations?

Hi WillieTheron,

Thank you for reporting this. The team is investigating and we will evaluate the impact of this and whether it constitutes a change this close to the tournament.

1 Like

If person A sends 100 units and Person B sends 100 units, and theres a max units of 100 on the node.

Person A gets 100% and person B gets nothing.

In in some languages there could be a 10 MS processing overhead compared to others.
In cases like this the exact same level and efficiency of code will render the player whose language writes slower paralyzed in cases where 2 players target the same nodes.

Im confident in my bot’s processing speed.

But thats not what this is about.

A true AI would use 200 Milliseconds and then submit their moves.

When you send commands should not impact if you get resources.
**I would rather then say let the closest player to the target node get all the rewards which honors location.

And would allow us to play distant nodes in order to preserve future advantage.

Its merely a point of fairness.

if the engine gave 3 res to player 1 and 1 to player 2 for the same action then it would be deemed unfair.
And that would be fixed.

The same is happening here.

beyond fairness I dont care how bad a bug is. As long as it does not undermine fairness.

Thats my opinion, but im crazy serious about fairness as a constant

I think that unit allocation to the node (CurrentUnits) should only happen once the units start working, in other words after the travel time, and that whomever gets there first gets the loot. This would mean that sending units to a node when it’s already at max capacity would not be considered an invalid command because it might not be full by the time the units get there. This would by default prioritize the closest player to the node, since the further player would have to send units to the node several ticks earlier.

This raises a few questions of it’s own though.
What happens if 2 sets of units arrive at the node on the same tick? Maybe a weighted % split?

What happens if a unit arrives at the node but the node is already full? Or there are more units than capacity at the node? The excess units could possibly be returned to base immediately without any resources, or wait out the working time and return without resources. Alternatively they could queue for the resource and wait for an available spot but I think that could lock up units and introduce a lot of unnecessary complexity.

What happens to units traveling to a node and it is consumed entirely while they are traveling? Either send them back to base the moment the node is empty or the moment they get there.

They get what they deserve for using garbage languages ⸮

I am uncertain about this.

To explain my thoughts, We know that the most efficient bots will conquest their domains first.
This means that a slower bot will always have preference to their own resources.

In a very unique case we could have matches where a slightly less efficient bot gets saved by resource priority.
**This would add an excellent dynamic of sabotage, but be pretty bad for endgame where everyone is capped by resources.

The other issue I have is to avoid unit action blocking (taking res an opponent is going for)
I do not believe we should have access to exact enemy commands. Our own yes, but not enemy. Uncertain if its like this already.
And without access to enemy commands, It will be hard to know when units will arrive and leave from a base. So you will be blind most of the match,

This is only true for the current state of the engine where we have more units than we have actions. In a case where we have more choices than units this would change completely.

This could be my own preference so not really factual. This might not be too bad if we have a node have data “Units Completing (number of units and tick)” though this would require an intense rewrite of my own AI, which I can deal with.

I do feel a weighted % split is essential.
**but in the sense of if there’s a max units of 1000 units and two players sends 1000 units.

each player gets 500 units in and the rest are returned.

Feels right.

VERY VERY IMPORTANT, Any Weighted split should only be applicable to “LEGAL UNITS”

So if theres 1000 max units available and a player sends 5000 units, only 1000 should be eligible.
I dont feel Node Overload should be a thing.

Just some thoughts out loud.

Good morning everyone,

The team had a session about this issue yesterday and we concluded that we are not going to make any changes this close to the tournament. We will, however, look into this and any possible changes needed for tournament 2

Thanks again for raising this to us and good luck tomorrow!

Solid, No problems then,

If we know the engine state, we can adjust our code accordingly.

I am very likely advantaged by this state (though it does trouble part of me some).
Today my play then is optimization, lets see if I can cut my time usage by 50%, remove any and all actions that will hinder me, get down to that 1 Millisecond.

I carefully assessed the possibility to make a move at the start of a tick, but you kind of need to account for the updated board state. Lets see how this plays out.

One thing that never left me is my paranoia. Always assume that every bot will be near perfect…
Im amped for this tournament.

Hey, I see the new release still suffers from the same issue, I opened up an issue on Github to track it (with details of where things go wrong) here: First player to send command gets preferential treatment when multiple players send command to same node · Issue #16 · EntelectChallenge/2022-Arctica · GitHub so that the issue doesn’t fall through the cracks.

Depending on state, this might be a very hard bug to solve

A Weighted percentage on legal units sent would be the absolute approach.

It is a troublesome issue,

Im running some tests on the new problem. Im looking forward to see what I can do, But next event is like now…

@Jako I took a stab at fixing the issue and opened a PR: https://github.com/EntelectChallenge/2022-Arctica/pull/24. I updated the game loop so that the slot allocation only takes place when the tick is being processed so that all the bot actions can be considered in one go. The logic that I then followed to distribute available slots was this:

  1. Available slots: 1000
  2. Player 1 sends 800
  3. Player 2 sends 700
  4. Player 1’s action is updated so that they send floor((800 / (800 + 700)) * 1000) = 533 units
  5. Player 2’s action is updated so that they send floor((700 / (800 + 700)) * 1000) = 466 units

The players’ weightings are only affected by their legal units i.e. if there was 1000 available slots, a maximum of 1000 units is considered for each player

3 Likes

Evening Kobus, I’ve notified the team regarding your PR. Just giving some feedback :+1:

2 Likes

This is amazing.

For me this behavior is a AI killer so far.

True AI might hook up to a 200 MS clock and just generate a solution. And 200 MS is a lot of time.

But so far no matter how good your strategy, if you take the full 200MS your pretty much dead.

So for me that’s a negative so far. And we also have no idea which bots are strongest. Because fastest bots took the glory. (Though I know speed alone doesn’t make a well rounded bot.)

This would be pretty cool

@kobus-v-schoor @WillieTheron
Hey guys! Thanks for the help and pressure on this issue. Kobus, a special thanks for your PR.
I’ve taken inspiration from the PR and made some optimizations. I’m pushing to have it out in the next release :raised_hands:

1 Like

This will be great.

I ran some tests in a 4V4 setting, and my difference for starting VS ending,

Playing against my non builder references is still around 50%.

Meaning I get Double the score if I start VS if I play Last.
For me since Event 1 this has been the largest issue.

First come first serve on moves is a True AI killer.
Unless the player has a system where they take all the info, process in real time, and pretty much ignore state engine changes for their turn move.

First move and then update their state.
Im a bit uncomfortable with this approach myself.

If I was a true monster Id likely have built this so that my own supplies dont rely on the engine at all.
But thats not an undertaking that I would want to take now.

But then they will be playing with a 1 turn delay on their Map Info, which isn’t ideal either.
Looking forward to the next release,

I don’t feel that this stage added so much to be honest,
Merely an extra way to expand territory.
After dabling in 4V4, I do feel a debuff on enemy territory would be pretty cool.
Im only starting to look at “Territory Wars” now.

Well using a proper strategy and due to accumulated cost of buildings the 2 extra buildings can help you build more without starting to lose score due to resources spent, although they dot give a score boost directly, i am able to up my score by a few 100k by adding them,

One major issue ive seen is resource node distribution when using the default seeds in the starer pack, player left top has the biggest advantage in starting resources so it can spen less time traveling and more time gathering ensuring him a 100% victory in 4v4 if all 4 bots are the same.

Yeah I’m also seeing the same where position on the map plays a large role in which bot wins.

I’m not sure how the games are currently being played in the tournament, but maybe something can be done like in the 2020 tournament, where each pairing of players gets played multiple times but on different parts of the map to ensure that the map layout doesn’t unfairly advantage some of the players. For example:

Round 1:

[P1] [P2]
[P3] [P4]

Round 2:

[P3] [P1]
[P4] [P2]

etc…

Then once all four positions have been played, each player’s score for each game gets added up to get their final score for the round. This of course has the disadvantage if quadrupling the amount of games.

Or, alternatively a more boring solution might be to just make the map symmetrical.

This is just me guessing, but the way things currently stand I think the top bots are all very close to each other in terms of strength, and “external” factors such as the map seed and the unfair resource distribution most likely had a large impact on the final scoring. Fixing the influence of these factors have on the games would level the playing field

I dont think playing each pairing multiple times would be a good solution since it will take much more time especially in round robin and the tick rate being slow. We will then wait more than twice as long for results. A symmetrical approach would be much more realistic

But again, not many rts games has every player starting with the same distance and resources from their base