ogame-tbot / TBot

OGame bot
81 stars 35 forks source link

cuncurrency for resources on the planet #117

Open Deenayd opened 2 years ago

Deenayd commented 2 years ago

There are few different functions working on building different things on one planet: 1) automine 2) autoresearch (if used on that planet) 3) lifeformsautomine 4) lifeformsautoresearch

Each of those functions can use resources available on the planet and it's fine. But if there are not enough resources, than function has to ask for a transport of resources. That it schedules itself to continue once transport arrives. Its' fine too. But if another build finishes, than in can kick in and steal some of the resources.

Let's say that automine usually has builds that take way more time than lifeformsautomine.

Now something like this frequently happens: 1) Automine wants to build something, let's say DeuteriumSynthesizer level 27. It requires metal: 8 522 270 and crystal 2 840 757. Let's say half of that is available, so it asks for a transport with the other half. Transport starts. 2) Lifeformsautomine completes something and starts another small thing. Using some of the resources that are available on the planet. 3) Automine gets it's transport and finds out that is short of resources again, as some were took by lifeformsautomine. So it schedules another transport. 4) Lifeformsautomine completes something and starts another small thing. Using some of the resources that are available on the planet.

It's not sure how to work around that problem. It would be best to make a plan for the planet that includes all of the buildables, but doing that would be hard. A much easier to implement workaround would be to temp block other build operations on the planet if one waits for a transport.

But I would prefer to NOT implement it as "don't build anything if any transport is arriving" as that would interfere with user transporting resources between planets.

Any ideas?