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.
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.
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.
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)
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
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));
}
}
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.