New Level- Direction and Magnitude


#1

Please check out this new level here and feedback is appreciated:

Basically, what you need to do is use vector to move your hero around and kill the shamans while you are at it. Then, you need to retreat to the house.

A findEnemy check and attack action will not work, because the yaks count as an enemy.

Enjoy this level and thanks for any feedback/guidance. :slight_smile:


#2

Dear @Endercore79,
what about self.findByType("shaman")?


#3

@steog88,
Aha! Good catch!

I’ll ask Nick to resrict all glasses with findByType on them. That should fix the problem.

Thanks!
-Endercore79


#4
Solution without vectors
def findShamans():
    return [e for e in self.findEnemies() if e.type=="shaman"]
    
shamans=findShamans()
for e in shamans:
    while e.health>0:
        self.attack(e)
    ix+=1

self.moveXY(68, 32)

This do not give me the victory, however, even if the actions are the expected ones: i kill only ogres, i do not anger yaks and i reach the red cross, but the goals are “incomplete”.
Maybe the configuration of the goals is not correct, since even when i use the vectors i obtain “Incomplete” goals (only the first one, “Knock out the shamans” is completed).


#5

Which is basically every but the most simple glass. I think it would be simpler to use some obstacles (can also be Ice-Yaks, semi-random distributed over the map) which you have to avoid (if magnitude < 10 move directly away)

Code could look like this:
var homePos = new Vector(65, 30); //Just some guessed values where the red x is likely
loop{
    var yaks = this.findByType("ice-yak");
    
    var nearYak = this.findNearest(yaks);
    if(this.distanceTo(nearYak < 10)){
        var dir = Vector.subtract(this.pos, nearYak.pos);
        dir = Vector.normalize(dir);
        dir = Vector.multiply(dir, 10);
        dir = Vector.add(this.pos, dir);
        this.move(dir);
    }
    else{
        var shamans = this.findByType("shaman");
        if(shamans.length == 0) break;
        var nearShaman = this.findNearest(shamans);
        if(this.distanceTo(nearShaman) > this.attackRange){
            this.move(nearShaman.pos);
        }
        else{
            this.attack(nearShaman);
        }
    }
}
this.moveXY(homePos.x, homePos.y);

#6

Off topic-ish, but I get a permission error when trying to load the level (I tried this level a while back ago while looking through the levels list):

While that was signed in, attempting to play using other browsers, logged out, other accounts, direct, etc. doesn’t seem to work either.


#7

I tried the level but I’m not sure why vectors are needed.

Even if findByType was restricted, there are ways to get around that. (differences in enemy health, position, etc.)


#8

Seems like vectors could be more useful if the yaks and shamans were wandering randomly around, such that it becomes necessary to add “force” vectors to steer away from the yaks and to steer towards the shamans.


#9

Hey everyone,

I fixed the bug with the retreat to home base goal and also scattered the yaks and shamans. Now that this is done you should be able to play the level without all the issues mentioned above. Once again, any feedback would be appreciated and thanks for playing! :slight_smile:

-Endercore79


#10

This means that you cannot use higher end glasses at all just disable the command findByType();

Lurkers is also pretty much the same thing


#11

@Feinty,
I based Direction and Magnitude off Lurkers and Skating Away. As for the glasses, I don’t know what Nick can do, but I’ll ask him.

Thanks for your feedback :smile:!

-Endercore79


#12

@Endercore79 I’m checking out what needs to be done now, but I think it will be easier if you private message me the code you think would solve the level using Vectors. Currently it seems like they wouldn’t be needed, which would make the level a little easy for the Glacier campaign. Also, I’ll have to make it so that the yaks attack if you get close enough.