AI reports basic economy built to soon.

Bug #1746481 reported by R M
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
widelands
Won't Fix
Low
TiborB

Bug Description

AI reports the basic economy as done as soon as the buildings are completed, even if there are no workers in one or more so the buildings are complete but they are not necessarily operating. It seems the basic economy built is used to trigger the next phase of buildings, if it is not used they why output the message?

I recently was testing Empire late game operations and in 25 test with just one AI player on crater map the basic economy message was seen after 15 - 20 minutes but it was usually over an hour later before the basic economy is working, in some cases they are still deadlocked 3 hours later.

The problem starts early as they build about 7 wood cutters and foresters, usually two foresters are stopped as soon as they are manned as they have no where to plant trees, two or three do not have workers as spades are used up. This would not be to much of a problem but the last two buildings to complete the basic economy are normally the marble mine and the vineyard, which has no worker due to missing shovels.

The basic economy message seems to cause the immediate building of many buildings that need marble, or columns, but without wine the mine stops and there is often not enough stone to build so many buildings, even the smelter and toolsmith can take an hour to build as they wait for marble together with training site and large military buildings, even wells and farms. If the building phase was not triggered until the basic economy was operational then the deadlock would be minor.

Work arounds can be to limit the number of foresters in the basic economy, aihints do not work for them though. Perhaps only one sawmill would reduce the requirement (not tested) adding the toolsmith to the basic economy does help as the vine planter gets his tool earlier from the starting iron. Sometimes the AI builds a weaponsmith first and uses all the iron for weapons.

Tags: ai

Related branches

GunChleoc (gunchleoc)
Changed in widelands:
milestone: none → build20-rc1
assignee: nobody → TiborB (tiborb95)
tags: added: ai
Revision history for this message
TiborB (tiborb95) wrote :

Well, basic economy was intended as it is now - to make sure that some critical buildings are built before AI runs out intitial critical building material. What you suggest is a step further and some complication to the code. But makes sense, of course.... Now, if AI gets some building, it is scratched from a list of remaining/missing buildings.

Do we have some notification for when a building becames fully staffed? This could be used to avoid too much code....

I will think of the problem of course.

Revision history for this message
GunChleoc (gunchleoc) wrote :

ProductionSite::working_positions_[].worker is what you're looking for - I don't know if there is a public function to access this, you might have to add one.

Usage example: https://bazaar.launchpad.net/~widelands-dev/widelands/bug-794407-soldier-stats/revision/8376

Revision history for this message
TiborB (tiborb95) wrote :

Yes, there is something like can_start_working(), but whole setup needs periodical check of all productionsites to see if all needed are staffed, moreover, some of them might had been upgraded in the meantime. Also savegame would be affected, because now it saves list of remaining building. So yes, can be done, but not in handful of lines...

TiborB (tiborb95)
Changed in widelands:
status: New → Confirmed
importance: Undecided → Low
status: Confirmed → In Progress
Revision history for this message
TiborB (tiborb95) wrote :

OK, it was not that difficult at the end and the branch is ready, please test it, and especially saving/loading before the basic economy is loaded.

Revision history for this message
kaputtnik (franku) wrote :

What is the state of this bug report?

Revision history for this message
TiborB (tiborb95) wrote :

In fact I don't remember:) looks like ready for testing...

Revision history for this message
kaputtnik (franku) wrote :
Revision history for this message
TiborB (tiborb95) wrote :

Good comment - I was not satisfied with my code, because things became too complicated and fragile...
But my stance is the same as before - this is not bug, because the basic economy works as intended and designed, but only an improvement, though reasonable improvement but the change is not straightforward...

Revision history for this message
kaputtnik (franku) wrote :

So implementing this is a feature and were in feature freeze ...

Changed in widelands:
milestone: build20-rc1 → none
Revision history for this message
GunChleoc (gunchleoc) wrote :
Changed in widelands:
status: In Progress → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.