Play Home Contribute Github Join Us! Discourse Staff Members Github Contribution Guides Team

Commanding my soldiers with loops makes the game extremely slow


Hi everyone !

Iā€™m kind of stuck on hunting party on world 4 because everytime I run my code, the game become extremely slow.

I tried different codes, firefox and chrome, I tried to flush my cache, but useless :confused:

I tried this, which I found on a topic here. It worked for the guy who wrote it :

friends = self.findFriends()

    for friend in friends:
        enemy = friend.findNearest(self.findEnemies())
        if not enemy:
            self.command(friend, "move", {'x':friend.pos.x + 24, 'y':friend.pos.y})
        if enemy:
             self.command(friend, "attack", enemy)

I have an i7 2600k with 8GB RAM and a Crucial M4 SSD

Thanks ! :slight_smile: