patchFreeciv - Patches: patch #3854, Consider nativity for...

 
 
Show feedback again

patch #3854: Consider nativity for is_square_threatened()

Submitted by:  Emmet Hikory <persia>
Submitted on:  Fri 19 Apr 2013 09:32:27 PM UTC  
 
Category: generalPriority: 5 - Normal
Status: DonePrivacy: Public
Assigned to: Marko Lindqvist <cazfi>Open/Closed: Closed
Planned Release: 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.

 

Mon 22 Apr 2013 09:03:59 PM UTC, SVN revision 22743:

Improved is_square_threatened()
- Consider unit nativity in general case, not just ground units
- Units unable to attack are not considered threatening

Patch by Emmet Hikory

See patch #3854

(Browse SVN revision 22743)

Marko Lindqvist <cazfi>
Project AdministratorIn charge of this item.
Fri 19 Apr 2013 10:14:34 PM UTC, comment #1:

This is clearly an improvement over current code, so this should go in for S2_5.

I have some vague plans to make it use pf_map to see what units can threaten autosettler - that would correctly consider units that can move (because they are fast (most sea units), or can use roads etc) more than 2 tiles distance currently checked, could account for our own units blocking the way of attack (it's safe to work behind line of defense), would consider corner case of autosettler working next to enemy city on non-native terrain for attacking unit... That's 2.6 stuff, though.

Marko Lindqvist <cazfi>
Project AdministratorIn charge of this item.
Fri 19 Apr 2013 09:32:27 PM UTC, original submission:

The current implementation of is_square_threatened() relies on a function called is_ground_threat() with embedded nativity assumptions (using is_ground_unit()). The attached patch removes the is_ground_threat() function (which has no other callers), replacing it with similar logic inside the is_square_threatened conditional.

The replacement logic is then extended in three ways:
1) The tile is not considered threatened if the potentially threatening unit is not considered an attack unit (attack strength == 0). There is no value in fearing a unit that cannot cause damage.
2) The tile is not considered threatened if the potentially threatening unit is either not native to the tile unless that unit can attack non-native tiles AND there is adjacent native terrain. There is no value in fearing a unit that cannot attack the tile in question.
3) The tile is not considered threatened by a diplomat unless that diplomat is able to pass the nativity test described in (2) above. There is no value in fearing a diplomat that cannot attack the tile in question.

In autogame testing, this change showed behavioural differences: for the classic and experimental rulesets, autosettlers appeared less likely to choose to improve coastal tiles. More generally, it seems autosettlers are more accurately risk-averse and last longer before dying.

Emmet Hikory <persia>
Project Member

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #17774:  square-threatened-consolidation.patch added by persia (3kB - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by cazfi (Updated the item)
  • -unavailable- added by persia (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 7 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sat 12 Apr 2014 09:04:20 PM UTCcazfiPlanned Release2.5.0, 2.6.0=>2.5.0
    Mon 22 Apr 2013 09:04:09 PM UTCcazfiStatusReady For Test=>Done
      Open/ClosedOpen=>Closed
    Fri 19 Apr 2013 10:02:05 PM UTCcazfiStatusNone=>Ready For Test
      Assigned toNone=>cazfi
      Planned Release=>2.5.0, 2.6.0
    Fri 19 Apr 2013 09:32:27 PM UTCpersiaAttached File-=>Added square-threatened-consolidation.patch, #17774
    Show feedback again

    Back to the top


    Powered by Savane 3.1-cleanup