Code never finished - findByType


#1

So I get this level when trying to do Sarven Brawl difficulty 2 (as in I’ve beaten difficulties 0 & 1). My code worked fine for the other two levels, though it does tend to get slow. I guess it is just really slow, but I’m not sure why…

My guess is that the findByType and findNearest functions are really slow to run. Would I save time by making my own loop to create the arrays? Is there something poorly implemented in findByType to make it run really slowly?


#2

Nah, the level just has a ton of ogres trying to do pathfinding and line-of-sight checks in it, so it’s a slow level.


#3

OK, so, slow level, but how do I get my code to finish, it just stops partway through? I opened the level in the editor and removed the coin spawn portion of the referee. My code was able to finish now, still runs slowly, but at least it finished.

I love the look of the scattered coins and I know there are future uses for collecting coins. But I’d also like to be able to beat more than just 2 waves.


#4

Good point. I’ll try ditching the coins for now, since you couldn’t spend them yet, and hope to speed things up again later when reintroducing them.