AI does not expand to unguarded enemy land

Bug #1827223 reported by hessenfarmer
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
widelands
Won't Fix
Undecided
Unassigned

Bug Description

AI does not expand into unguarded but enemy owned land. this is due to only unowned spots are taken into account for this consideration.

relevant code is in defaultai.cc line 1329 following.

proposal is to change line 1329 like the following

if (field.unowned_land_nearby > 0 || (field.enemy_owned_land_nearby > 0 && field.enemy_military_presence < std::abs(management_data.get_military_number_at(??) / 6))) {

furthermore this would lead to the addition of the following block after line 1335

field.unowned_buildable_spots_nearby +=
     map.find_fields(Area<FCoords>(field.coords, kBuildableSpotsCheckArea),
                     &found_buildable_fields, find_enemy_owned_walkable);

already tested this solution and it works

Tags: ai

Related branches

Revision history for this message
TiborB (tiborb95) wrote :

what is that "??"

Revision history for this message
hessenfarmer (stephan-lutz) wrote :

?? is a placeholder for an unused military_number. Sorry should have explained that.

Revision history for this message
TiborB (tiborb95) wrote :

OK, I believed that you already has the code... Do you need some help with finding unused number? I am using grep for this...

Will you propose merging the branch? it would be easier to see changes...

GunChleoc (gunchleoc)
tags: added: ai
Revision history for this message
hessenfarmer (stephan-lutz) wrote :

I tested the code with a hardcoded value of 3 (which means an enemy military presence of 3 is allowed), but I thought some genetics should apply here.

Changed in widelands:
status: New → In Progress
milestone: none → build21-rc1
assignee: nobody → hessenfarmer (stephan-lutz)
Changed in widelands:
status: In Progress → Fix Committed
Changed in widelands:
assignee: hessenfarmer (stephan-lutz) → nobody
Revision history for this message
GunChleoc (gunchleoc) wrote :
Changed in widelands:
status: Fix Committed → 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.