Greed: Humans resource collection advantage

I know the contest is over, but wanted to comment on this. It seems in several cases when stepping through frame by frame Human peasants would collect an item before my Ogre peon even though my Ogre peon was strictly closer to the item. (Computing from X,Y coordinates for Human position, Ogre position, Item position)

Did anyone else see this occurring?

Is the Human frame computed first each time and then the Ogre frame?

Thanks

Joe

Yep, I agree.

My implementation makes workers forget coins being picked by enemy workers whose distance is shorter.

So sometimes my workers were heading to a coin that logically was closer but at the end enemy was picking.

Yup, humans do have that slight advantage, since someone has to pick it up first if both are within collect range on the same frame. The current algorithm would be pretty slow if we made it check to see, if two units could pick up an item on the same frame, which was closer, but maybe there’s a better way to do that. Patches to the Inventory System are welcome.

Actually, it’s only always an advantage for the first peasant/peon to be built; the ones built later will be at the disadvantage, but they could be on either team.

I’ve seem some cases that are definitely questionable, but the occurred too late game to make debugging it feasible.

The most important thing to consider is that you don’t need to actually reach the center of the coin. Just be within 5m from the center of the coin. This will lead to situations where you’re actually closer to the center of a coin but may choose a sub optimal direction vector and travel further than necessary to collect it.

Consider two workers. Lets say they move a 1 m/s.
Worker 1 is at (0, 0).
Worker 2 is at (0, 1).

There’s a coin located at (10,2);
Worker 1 travels strictly horizontally to (10,0);
Worker 2 travels to the center of the coin (10,2);

Worker 1 will collect the coin first even though he’s further, because he choose a shorter path.

@nick I think that explains the big variance between my human and ogre rank. I wasn’t sure that it was human first and assumed that it was enemy first. Hence I tended to estimate position of enemy as enemy position + 1.25 meters towards enemy target position. This fared well for ogres obviously because it’s how the calculations are handled, but would perform markedly poorer for my humans because I would abandon coins that I would’ve actually been awarded. Bummer :frowning:

2 Likes

@Bellardia I too estimated enemy position similarly and found it fared better for ogres.

I had made the realization that you only needed to be within 5m to collect an item, but was simply choosing a new target when within 5m of target instead of computing an optimal path. Nice insight. Thanks!

I think JerryP is currently re-ranking, but his new human code basically ruins mine. He stands directly on top of my workers late game. There’s not a single coin I can reach first in that case, I think you’d need to award the coin to both players or something. If you try to move away you move into a sub optimal position and he can still follow you.

Humans have a pretty extreme advantage in this case.

As I understand it, you could feasibly track the order of construction of your and the enemy peons, and match each of your workers (but one) to an enemy worker constructed later. If both players were doing this, the whole exercise would be a joke, but if only one is doing it, it seems like a nearly unbeatable strategy in the lategame.

I considered trying to implement this to see what would happen, but I was too busy. I wonder if it would work.

1 Like

There’s a certain disadvantage with having to reposition your workers since the path won’t be a natural progression, but it could definitely work if the game was long enough. Good thing no one did this during the tournament =/

I did and it does help, especially near the end-game. I’ve written up my solutions here: https://github.com/justinstimatze/greed/blob/master/README.md

Actually this problem highlighted definitely manifests itself towards end-game where you have like 6 peasants on the map. I’ve had matches where I did well until the resources became scarce, and even though my miners had the same rest positions as my opponent, the favoritism tipped the balance completely.