patchFreeciv - Patches: patch #3903, Don't use UMT_SEA to assign...

 
 
Show feedback again

patch #3903: Don't use UMT_SEA to assign unknown_MC cost

Submitted by:  Emmet Hikory <persia>
Submitted on:  Wed 08 May 2013 11:38:14 AM UTC  
 
Category: aiPriority: 5 - Normal
Status: DonePrivacy: Public
Assigned to: pepeto <pepeto>Open/Closed: Closed
Planned Release: 2.6.0

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

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

 

Mon 03 Feb 2014 07:45:55 PM UTC, SVN revision 24335:

Pathfinding unknown movement cost is more ruleset-flexible:

  • The cost is equal to the highest movement cost the unit can encounter.
  • A malus (mutliplied by 2) is applied if a unit cannot enter all terrains.
  • UTYF_IGTER is now handled.
  • The value is now cached by unit type.

Patch by Emmet Hikory (persia@gna) and me

See patch #3903

(Browse SVN revision 24335)

pepeto <pepeto>
Project MemberIn charge of this item.
Wed 29 Jan 2014 09:46:09 PM UTC, comment #4:

Noticed I have uploaded 3 times wrong files. Attempting to attach the right one...

(file #19892)

pepeto <pepeto>
Project MemberIn charge of this item.
Mon 27 Jan 2014 03:05:41 PM UTC, comment #3:

New version of the patch: after discussion for bug #21535, UTYF_IGTER flag is tested only for UCF_TERRAIN_SPEED units.

(file #19874)

pepeto <pepeto>
Project MemberIn charge of this item.
Wed 22 Jan 2014 11:22:56 PM UTC, comment #2:

After reading the discussion for rt PR#6977, I understand that the calculation of unknown_MC has been wanted to be the highest possible cost for a unit. This value is multiplied by 2 if the unit can encounter unsuitable terrains. This is what my patch does.

But I see in the implementation (SVN revision 10719) two errors:

  1. it totally ignore if unit has UTYF_IGTER or not.
pepeto <pepeto>
Project MemberIn charge of this item.
Tue 21 Jan 2014 07:01:06 PM UTC, comment #1:

How could I get the discussion of PR#6977?

(file #19811)

pepeto <pepeto>
Project MemberIn charge of this item.
Wed 08 May 2013 11:38:14 AM UTC, original submission:

From what I can glean from incomplete archives of discussion surrounding PR #6977 preceeding SVN revision 10719, the rationale behind the code that led to the comment "Sailing units explore less" in pf_tools.c is that units that don't respect terrain speed should have unknown_MC larger than their normal move because they might try to go somewhere they can't go, so UMT_SEA units should have unknown_MC of 2*SINGLE_MOVE and UMT_BOTH units should have unknown_MC of SINGLE_MOVE. This represents an assumption that all sailing units are !UCF_TERRAIN_SPEED and an assumption that all UMT_BOTH units have unrestricted nativity.

The attached patch addresses those assumptions by iterating through the terrains for the !UCF_TERRAIN_SPEED case, and only setting unknown_MC to 2*SINGLE_MOVE in the event some terrain is not native. For classical units, this represents no difference. Specific differences for other units are:

1) UCF_TERRAIN_SPEED units that are UMT_SEA now are charged 2 * movement_cost for the most awkward native terrain, rather than 2 * SINGLE_MOVE.

2) units that are neither UCF_TERRAIN_SPEED nor UMT_SEA are now charged 2 * SINGLE_MOVE if there exist any terrains not native to the unit, rather than SINGLE_MOVE.

In both cases, the value of unknown_MC should be larger than before, so non-classical units with additional restrictions (e.g. seagoing units that respect terrain speed or amphibious non-mountaineering units) may be less likely to plot paths through unknown terrain.

As mentioned in the original discussion, it might make sense to set values for unknown_MC based on unit class once, and use these cached values when constructing pathfinding maps, rather than recalculating the value every time a parameter is defined. These may even be interesting to ruleset authors, who might want to express something like "Merchant units never find paths through unknown tiles" or "Intercontinental Missiles care nothing about the underlying surface". That said, implementation of these is well beyond the scope of the current patch.

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 #19892:  pf_unkown_MC.diff added by pepeto (6kB - text/x-diff)
file #17928:  native-unknown_MC.patch added by persia (2kB - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by pepeto (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 14 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 03 Feb 2014 07:46:22 PM UTCpepetoStatusReady For Test=>Done
      Open/ClosedOpen=>Closed
    Wed 29 Jan 2014 09:46:09 PM UTCpepetoAttached File-=>Added pf_unkown_MC.diff, #19892
    Wed 29 Jan 2014 09:38:19 PM UTCpepetoAttached File#19874=>Removed
    Mon 27 Jan 2014 03:05:41 PM UTCpepetoAttached File-=>Added text_pf_unkown_MC, #19874
    Mon 27 Jan 2014 02:57:34 PM UTCpepetoAttached File#19823=>Removed
    Wed 22 Jan 2014 11:22:56 PM UTCpepetoAttached File-=>Added text_pf_unkown_MC, #19823
      StatusIn Progress=>Ready For Test
    Tue 21 Jan 2014 07:01:16 PM UTCpepetoAttached File#19811=>Removed
    Tue 21 Jan 2014 07:01:06 PM UTCpepetoAttached File-=>Added pf_unkown_MC.diff, #19811
      StatusNone=>In Progress
      Planned Release=>2.6.0
    Wed 08 Jan 2014 12:42:29 PM UTCpepetoAssigned toNone=>pepeto
    Wed 08 May 2013 11:38:14 AM UTCpersiaAttached File-=>Added native-unknown_MC.patch, #17928
    Show feedback again

    Back to the top


    Powered by Savane 3.1-cleanup