Timber Guard bad seed

I think they need to check on the scenario generation for Timber Guard because I had a seed where an ogre spawned almost immediately and killed a peasant while the first soldiers were still running over.

Next submission had no issues whatsoever, not even close.

Yes I was using the value-distance algorithm for coin gathering.

Don’t know if this is a bug strictly speaking.

Hi @embermctillhawk, welcome to the CodeCombat discourse! :tada:
I looked at the code on the referee at https://codecombat.com/editor/level/timber-guard and the only place it says the ogres spawn is in a rectangle at the right side of the screen. Could you recreate the problem and take a screenshot?
Thanks
Danny

I think I figured out what it is. The rallying point I’ve set for the soldiers is more in the visual center of the open area, not in the vertical center of what I guess the spawn box must be? Anyways, for this particular seed, with that rallying point, the soldier is slightly further away from an ogre spawning at the bottom of their spawn options, so the peasant draws aggro.

However, if I set the rally point 10 units lower, the soldier is closer, so they draw aggro instead. How much closer? Well, I did a bit of work in paint.net and figured out the answer.

image

By taking two screenshots with the camera in the same spot and same zoom, overlaying them in xor mode, I figured out that at this zoom level, 1 meter is 26 pixels.

Assuming the center of the shadow circle is the pos of each entity, the distance from the ogre to the soldier is 661.98 pixels, according to paint.net, and the distance from the ogre to the peasant is 675.20 pixels, for a difference of 13.22 pixels, or 0.5 meters.

So basically the only reason that “Hilda” gets to live in this seed is because the soldier happens to have walked to a location that’s 0.5 meters closer. If the ogre spawned another 1 meter south, Hilda would STILL draw aggro.

Even so, now that I actually know why this happens I’m genuinely not sure if this is something that even ought to be changed. It took a few refreshes to get a seed that replicates this, and maybe the better position to rally to is the south precisely because those peasants are so much further east than those up north? Feels a little weird to rally the soldiers so far south instead of more centered on the peasants, though.

Wow, good working out! I’m not sure you could change that except for changing the code of the level and you might not be able to do that.
Thanks for pointing it out though.
Danny