AI does not cope with two barracks after human player

Bug #1800818 reported by Toni Förster
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
widelands
Fix Released
Low
Unassigned

Bug Description

Setup: 3 Human players. The game was saved and then closed, reopened and all human players were substituted by AIs (normal).

After a while the game (speed up) crashed with this out put on the console:

Assertion failed: (site.bo->total_count() == 1), function check_productionsites, file /Users/toni/Launchpad/widelands-repo/working_tree/src/ai/defaultai.cc, line 4281.
Abort trap: 6

But this only happens with the debug build, not the release.

Tags: ai

Related branches

Revision history for this message
Toni Förster (stonerl) wrote :
Revision history for this message
TiborB (tiborb95) wrote :

It is about Barracks. AI builds only 1 and here it encounters two (built by human player before).
This is common problem what to do with such building, dismantle on the spot? When human player goes on with the game he will complain how stupid AI was....

Revision history for this message
GunChleoc (gunchleoc) wrote :

I think logging it and dismantling would be better than a crash - assertions are meant for things that can be guaranteed 100% by the code, and since we allow switching from a human to an AI, we cannot guarantee that.

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

I agree it would be cleanest approach... if there is no strong opposition I would implement it

TiborB (tiborb95)
Changed in widelands:
status: New → Confirmed
importance: Undecided → Low
assignee: nobody → TiborB (tiborb95)
TiborB (tiborb95)
summary: - crash related to AI in debug build
+ AI does not cope with two barracks after human player
Revision history for this message
GunChleoc (gunchleoc) wrote :

Yes, please implement it. Maybe we should go through all the asserts in the AI and make sure that we can actually assert them, i.e. that they will still be valid if an AI takes over for a human player?

Then add any log output that you need for debugging.

Revision history for this message
TiborB (tiborb95) wrote :

I will go through AI. But only similar building that comes into mind is a shipyard, but I believe we have less strict requirements for it already now.

Revision history for this message
TiborB (tiborb95) wrote :

I downloaded the zip but I cannot identify your savegame when trying to load it, after unpacking of course. Is it compatible with current trunk?

Revision history for this message
Toni Förster (stonerl) wrote :

The savegame was created with trunk revision 8903.

Revision history for this message
Toni Förster (stonerl) wrote :

The Archive.zip file should contain 2 files:

wl_autosave_nethost_02.wgf
r8904-ai-1.log

Revision history for this message
Toni Förster (stonerl) wrote :

Sorry, I meant revision 8904.

Revision history for this message
TiborB (tiborb95) wrote :

"r8904-ai-1" - I see this in menu, but is incompatible. I already have a fix, but will have to backport it into old branch, pity..

Revision history for this message
GunChleoc (gunchleoc) wrote :

I have attached a current trunk savegame that reproduces this particular problem. Just assign an AI to player 1.

GunChleoc (gunchleoc)
Changed in widelands:
status: Confirmed → In Progress
GunChleoc (gunchleoc)
Changed in widelands:
status: In Progress → Fix Committed
assignee: TiborB (tiborb95) → nobody
Revision history for this message
GunChleoc (gunchleoc) wrote :

Fixed in build20-rc1

Changed in widelands:
status: Fix Committed → Fix Released
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.