Code Royale - Bugs

Hi. I’m confused by this statement in the Wood League instructions […]
Earlier in the instructions, it says you have to explicitly train using the barracks identifiers. Is training automatic thereafter? If not, why is TRAIN with no identifier necessary?

The system given to the creators of the challenge doesn’t support protocols with a variable amount of output lines. So we opted for always having “TRAIN” instead of a new keyword like “NO-TRAIN”. Also, empty lines aren’t supported either.

I found a “bug”:
in this game https://www.codingame.com/replay/304627919?f=53 from turns 56 to 84, the queen (red) is right next to the site (id = 2), almost touching, but not quite. the queen keeps issuing the command BUILD 2 TOWER, but it seems the enemy creeps are blocking her way
the queen’s coordinates are x:558 y:604 the site’s coordinates are x:675 y:605 r:63

for info, in the std error stream, the first lines are 3 : 3 (or other starting with 3) , it would have been 2 : 2 had touchedSite been != -1

Unfortunately, what you discovered is actually a feature: it’s intended for Queens to be not only damaged but also partially obstructed by enemy creeps. Those knights are not content simply to be touching you, they are constantly trying to move into you to impede your progress. Unfortunately your Queen happened to be caught at a perfect angle by flanking knights so she couldn’t progress at all.

From hidden sites (i.e. sites that you are farther than 300 away from), the goldRemaining and maxMineRate are obscured. Also, enemy mining rates are obscured.

So, DollarAkshay is right: the money and rates available to the site only need to be discovered once, but enemy mines need to be rediscovered.

Hi,

In wood 1, there is a typo in the description. You say structure type is 1 for mines and 1 for towers (at least in the french one)
I can’t post an image proof since i’m a new user.

2 Likes

Hey,
I made the engine crash with too many units on the map.
The replay is broken: https://www.codingame.com/replay/305007024
Screen of the IDE: https://i.imgur.com/N31wPXP.png
In the very last turn, Xyze gained HP.
When I replay with the same AI and same seed, the game ends properly at this turn.

1 Like

Hi all. There are some things I don’t get from reading the instructions nor by reading the referee code:

  1. How do Knights move when they are close to the enemy queen but not touching her? Assume a Knight is queen.radius + knight.radius + 1 away. If he moves 100 thowards her, he would cross her over landing in the other side.
  2. Hence another question, are collisions processed in a timely manner like for instance MeanMax ?
  3. If they are not processed this way, in what what order are collissions processed? ie: if two or more collissions happen in a turn, how do you decide which one to process first?
  4. If two or more creeps are the closest to a tower, and they are at the same distance to the tower, how do towers chose their target?

Thanks in advance to the team !

Collision detection is not like MeanMax :slight_smile:
Movement and collision is done:

Every unit move 1/5 of their speed.
Then Collision is checked (between every unit and obstacle (regardless of moving or not)
Then it’s repeated 5 times.
AllEntities as used in collision is ordered as:

All units from player 1. (starting on the left side of the map)
queen from player 1
All units from player 2
queen from player 2
Obstacles

Collision detection is also done after production:

Tower target is:


(Didn’t check how minBy handles equals, but I guess it picks the first one in the list…)

2 Likes

Would it be possible to get mirror matches enabled (so both sides are played as in other non-symetrical games)? I’m not sure if this is possible for already open leagues, but it’d be good to get it for legend at least.

  • Units spawn slightly off center, down and right from the barracks, so will generally start slightly closer to the right hand queen.
  • Collision order means player 1 queen avoids large amounts of damage when surrounded, which isn’t possible for player 2 queen. This happens because the p1 queen collisions are processed before the p2 knights collide with each other, so the queen pushes the knights to the edge of her range and then they push each other apart, and end up out of range of the queen. The units would push each other apart inside the P2 queen, and then the queen would push them out, but they’d still be in range to attack.
8 Likes

I agree that’s the symetry is pretty bad. Don’t know if it has a deep impact on the ranking.

I’ve discovered this asymmetry a few minutes ago, and the impact is IMO pretty large: See https://www.codingame.com/replay/306041318 (exact same deterministic code against itself).
The queens start with 45 HP and the left-hand one ends with 10 HP, meaning that she has dealt 28.6 % more damage (45 vs. 35) that her opponent, which is a huge difference due solely to the asymmetry of the Referee.
O.K., the randomized starting side mitigates the asymmetry on long term, thus on ranking, but it hurts to see such a difference on individual games.

5 Likes

Hi all !

I’m having trouble understanding how creeps spawn when they are created. Specifically in this line a vector is added to the location, but i can’t figure out what that vector is.

Can someone enligthen me?

Thanks !

From the documentation:

inline fun repeat(times: Int, action: (Int) -> Unit)
A zero-based index of current iteration is passed as a parameter to action.

So for knights you have (0,0), (1,1), (2,2) and (3,3) as offset vectors.

1 Like

After debugging why code in the blue corner, keep going past halfway to get to the closest site to the center (with draws sorted by distance of “site to queen”), I realized the locations of the sites are not always symmetrical.

in this reply: https://www.codingame.com/replay/306778732

the locations are:
0 159 698
1 1761 302
2 1736 820
3 184 180
4 1746 530
5 174 470
6 675 481
7 1264 511
8 406 362
9 1514 638
10 1065 166
11 857 834
12 1452 836
13 442 164
14 1317 171
15 603 829
16 1014 631
17 900 391
18 728 185
19 1203 821
20 419 603
21 1501 397
22 1570 157
23 350 843

and it you add each pair together, if symmetrical, they will add to 1920,1000 (the map dimensions), but pairs (6,7), (10,11), (12,13), (16,17), (18,19) do not sum correctly, though those pairs are the diagonal mirror pairs of each other.

Why put the referee link on the forum and not in the challenge rule ? :frowning:

It’s there once you get to Bronze level…

Hmmm I just checked the English version. There is a link. But in the French version, it misses the link

If […] the enemy Queen is in range, a tower will fire upon her instead, dealing 1 base damage +1 for every 200 units of distance closer.

According to Structures.kt, the first damage increment occurs at less than 200 units from the max range (same thing for tower attacking creeps), even though the next increments work as expected:

attackTarget = when {[…] enemyQueen.location.distanceTo(obstacle.location) < attackRadius […]}

So the base damage (1 for queen, 3 for creeps) happens when distanceTo is right under attackRadius, so the first damage increment is expected to happen when distanceTo is right under attackRadius - 200 (or at exactly distanceTo == attackRadius - 200 as we don’t care for the minute rounding from the comparison of doubles).

val damage = TOWER_QUEEN_DAMAGE_MIN + (differenceFromMax / TOWER_QUEEN_DAMAGE_CLIMB_DISTANCE).toInt()

So the first increment happens at exactly differenceFromMax == 200 (TOWER_QUEEN_DAMAGE_CLIMB_DISTANCE).

val shotDistance = target.location.distanceTo(obstacle.location).toDouble - obstacle.radius
val differenceFromMax = attackRadius - shotDistance

So differenceFromMax = attackRadius - distanceTo + tower.radius, so the first increment actually happens at exactly distanceTo == attackRadius - 200 + tower.radius, i.e., tower.radius sooner than expected!
In order to fix that, - obstacle.radius should be removed from val shotDistance, in both damageCreep and damageQueen.

1 Like