bugFreeciv - Bugs: bug #20504, City defenders rampaging

 
 
Show feedback again

bug #20504: City defenders rampaging

Submitted by:  Marko Lindqvist <cazfi>
Submitted on:  Wed 13 Feb 2013 03:34:25 AM UTC  
 
Category: aiSeverity: 3 - Normal
Priority: 5 - NormalStatus: Fixed
Assigned to: Marko Lindqvist <cazfi>Open/Closed: Closed
Release: Operating System: None
Planned Release: 2.4.0, 2.5.0

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Sat 16 Feb 2013 01:04:20 AM UTC, SVN revision 22344:

Do not rampage out of the city if you are supposed to be defending it.

See gna bug #20504

(Browse SVN revision 22344)

Marko Lindqvist <cazfi>
Project AdministratorIn charge of this item.
Sat 16 Feb 2013 01:04:15 AM UTC, SVN revision 22343:

Do not rampage out of the city if you are supposed to be defending it.

See gna bug #20504

(Browse SVN revision 22343)

Marko Lindqvist <cazfi>
Project AdministratorIn charge of this item.
Wed 13 Feb 2013 05:45:08 AM UTC, comment #2:

> Attack adjacent tiles (staying itself in the city) for juicy
> targets


Above works in this new version. Also S2_4 version included.

(file #17189, file #17190)

Marko Lindqvist <cazfi>
Project AdministratorIn charge of this item.
Wed 13 Feb 2013 03:43:09 AM UTC, comment #1:

Here's the patch I'm testing.
- Leave city only if you can take empty enemy city - I assume this to be statistically worth the risk that enemy then takes the original city
- Attack adjacent tiles (staying itself in the city) for juicy targets - this might mean killing entire stack of enemies that would otherwise get to attack against us each and every

(file #17186)

Marko Lindqvist <cazfi>
Project AdministratorIn charge of this item.
Wed 13 Feb 2013 03:34:25 AM UTC, original submission:

dai_military_defend() is supposed to handle unit assigned to defend a city, including the case unit already is in that city and enemy is next to it.
dai_military_defend() calls dai_military_rampage() with parameters that denote that any target is worth going after. This may mean that defender leaves the city to kill target a couple of tiles away. So, if there's strong attacker adjacent to city ready to enter, and weaker enemy further away, defender leaves city defenseless for the strong attacker to take while it itself hunts down the weaker enemy.

It also seems to me that even if there was no stronger attacker present, the code would never draw the defender back to city. Once it's outside, it next turn loses its DEFEND_HOME task and only units already inside city get that task (re)assigned.

Marko Lindqvist <cazfi>
Project AdministratorIn charge of this item.

 

(Note: upload size limit is set to 1024 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

Attached Files
file #17189:  DefenderRampage-2.patch added by cazfi (2kB - text/x-diff)
file #17186:  DefenderRampage.patch added by cazfi (2kB - text/x-diff)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by cazfi (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 8 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sat 16 Feb 2013 01:04:34 AM UTCcazfiStatusReady For Test=>Fixed
      Assigned toNone=>cazfi
      Open/ClosedOpen=>Closed
    Wed 13 Feb 2013 05:45:08 AM UTCcazfiAttached File-=>Added DefenderRampage-2.patch, #17189
      Attached File-=>Added DefenderRampage-S2_4-2.patch, #17190
      Planned Release=>2.4.0, 2.5.0
    Wed 13 Feb 2013 03:43:09 AM UTCcazfiAttached File-=>Added DefenderRampage.patch, #17186
      StatusNone=>Ready For Test
    Show feedback again

    Back to the top


    Powered by Savane 3.1-cleanup