Ace of Coders - Questions & Feedback

As I know that many topics will spawn about this, this is the intended place for those topics. Please look here before opening a new topic.


Ace of Coders, the newest tournament-level and your possible future-chance. This topic should bundle most of the questions to reduce forum-clutter as well as give a central topic for people too look. You are free to ask any questions, post code-snippets or tips related to this level, but beware that others can read it as well, so you might not want to give away to much of your solution.
Also remember that there is a guide. You can look in the levels help-section or at the downloadable PDF.


I wish you good luck and happy coding,
J_F_B_M

2 Likes

Woah, this level looks excellent, good job. :smile:

Any idea why I can’t summon griffin-riders? Is there special code in this level to prevent that because they were considered too overpowered?

Well, we only get the Boss Star II in the level.

Oh I see, thanks. So it seems this level has special code to allow us summoning artillery and arrow-towers.

As far as I know, these are the summonables:
“soldier”, “archer”, “artillery”, “arrow-tower”

The hero is a “goliath” type

There’s a quirk with the control points, as I’ve had trouble associating them due the objects being named:
“Southwest”, “Southeast”, “Center”, “North”, etc…
However, in the associative array, they seem to be labeled:
“nearCorner”, “nearA”, “nearB”, etc…

You may want to create a mapping table to make your life easier.

There are two methods:

getControlPoints() vs getControlPointsMap()

If you’d compare the two lists you get you would notice that they both have the same ordering, though the second one is intended to not be accessed via an index (i), but via a key (nearA, …).
The first list is always in a format that your own corner is the first entry, the nearA-control point is the second entry, nearB the third and so forth until the enemies corner which is the last entry (i==6).


If you want to split your soldiers evenly the first method is the best one:

var points = this.getControlPoints();
for (var i = 0; i < points.length; i++) {
    //command soldier to points[i%points.length]
}

This snippet will evenly distribute your soldiers, starting with your own corner and sending your soldiers last to the enemy-corner before beginning again at the beginning. In this case you don’t really care where each point is, you just use them.


If you want to send your soldiers to a specific point and don’t want to wrap your head around how to convert an index into a control-point, you can use the Map.

var points = this.getControlPointsMap();
for ( /* i < friends.length */ ) {
    this.command(friends[i], "move", points.center.pos);
}

This will move all your friends to the center-position. I could’ve also used this.getControlPoints()[3], but who can guess that 3 is the center?


Of course my code-snippets are just examples. Maybe a good tactician doesn’t want to split their soldiers evenly or send all units to only one point. That is your part to come up with.

1 Like

You don’t get any Boss Star (technically).

You get directly the ability to control and spawn 4 unit-types. You do not get any income (except via the control-points).

It’s nitpicking, but a Boss Star suggests a regular income and only a specific unit-set, which is not true in this case.

Makes perfect sense, thanks. I’m assuming the equipped item which reads “Boss Start II” is actually a modified version of that Thang made specifically for this level.

Each control point has a name attribute that corresponds to the key names used in the associative array/map/whatever you want to call a plain object.

It makes more sense for the id to be unique and same for both sides, so name it was. (Though it may be sort of confusing.)

Is there a bug with the Artillery? About 1 second into the match, I notice that it targets something called “Mercedes”. The coordinates seem to be where my goliath/artillery is, but it seems to be invisible.
At 3 seconds, it starts moving at the speed of a soldier,
Then, at about 7 seconds into the game, the artillery starts moving in overdrive.

You should be able to see the bug in action with the link below:

Driphter was mentioning that to me in the HipChat room yesterday. Have you seen it fighting against any other players? We haven’t been able to figure out so far what’s causing it.

After making some modifications, I noticed that the same thing happened to my own artillery, and my opponent’s artillery went back to normal speed.

When my own artillery exhibited this behavior, it did not target any strange objects, so the “targeting something called ‘Mercedes’” is probably unrelated.

Could the issue lie within the VM that translates the code? It vaguely feels like the VM accidentally pushes the execution context of a completely different object onto the artillery, and maybe that happens to override the “maxSpeed” property? Just a shot in the dark. I haven’t analyzed the game code enough, or reproduced this issue enough to make a proper guess.

I think the next step is to narrow down what code does/doesn’t end up causing one’s artillery to glitch out. (If we can; it could be something too crazy for that.) If that doesn’t work, I can start going through the engine and logging all the forces and accelerations and velocities and stuff to narrow down the instant they get weirded out… (yaaay)

I hope this gets fixed soon. I’ve lost so many games because my artillery fails to attack the other goliath.

Here’s a copy/paste code block below that will reproduce the issue, regardless of opponent. (I tested against broken opponent code, and only target the enemy goliath for units, so it should not depend on the opponent to help you trigger).

By the way, uncomment those 2 lines if you want your own artillery to lob a shell, and catch it :stuck_out_tongue:

this.summon("artillery");
var artillery = this.findByType("artillery", this.findFriends())[0];
var eGol = this.findByType("goliath", this.findEnemies())[0];
loop {
    this.command(artillery, "attack", eGol);
    this.move(new Vector(0, 0));
    this.command(artillery, "attackPos", new Vector(40, 40));
    this.move(new Vector(0, 0));
    // this.move(new Vector(0, 0)); // Uncomment to time it perfectly for the artillery to hit itself
    // this.move(new Vector(0, 0)); // Uncomment to time it perfectly for the artillery to hit itself
    this.command(artillery, "move", new Vector(0, 0));
    loop {
        this.command(artillery, "move", new Vector(0, 0));
        this.move(new Vector(0, 0));
    }
}
1 Like

Entered as #3062 in the Github issues.

1 Like

In Ace of Coders, I tried to do this

 var friends = this.built;
 var soldiers = friends.findByType("soldier");

to separate my units. However, I get this error: tmp35[tmp36 is not a function]
Any suggested fixes?

1: friends is a list. A list does not have findByType as a method.

2: You should use just self.findByType("soldier", self.findFriends()). The extra argument filters by team.

2 Likes

I’ve got that artillery acceleration bug fixed now.

Is there a way to reference enemy units/teams the way you can reference your own? I want to reference enemy.built or enemy.gold, for instance, something of that nature. I know I can reference enemies within a certain range, but it would be nice to just reference all enemies.

EDIT: I solved it. I can do enemy_hero.gold or enemy_hero.built as long as I reference the enemy hero the way the documentation shows.