patchFreeciv - Patches: patch #3383, autosettler choose safe route to...

Show feedback again

patch #3383: autosettler choose safe route to tile to work on

Submitted by:  None
Submitted on:  Sun Jul 8 01:24:52 2012  
Category: aiPriority: 5 - Normal
Status: NonePrivacy: Public
Assigned to: NoneOriginator Email: -unavailable-
Open/Closed: OpenPlanned Release: 
Contains string changes: None

Add a New Comment (Rich MarkupRich Markup):

You are not logged in

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


(Jump to the original submission Jump to the original submission)

Wed Feb 13 04:36:28 2013, comment #15:

> What is an "EC callback" ?

Function returning Extra Cost for the move from tile to tile to path finding.

This ticket is now about selection of the safe route to destination only. Avoiding dangerous destination tiles falls to patch #3384, at least with the version I'm just finishing.

Marko Lindqvist <cazfi>
Project Administrator
Tue Jul 17 14:44:22 2012, comment #14:

You raise a number of good points. What is an "EC callback" ?

Sun Jul 15 22:23:30 2012, comment #13:

I'd like to have pathfinding part (tiles enroute) to have extra cost for dangerous tiles instead of being right off limits. So dangerous route would be taken only if there is no alternatives, but it would be taken when everything else fails (note that this path construction time dangerousness is anyway subject to change before settler actually enters tile - enemy movement can make tiles dangerous, or remove dangerousness)

Does it have EC callback defined already? If no: simply add one. If yes: can we easily (without breaking other users) adjust it, or can we make new one with existing functionality and new functionality combined?

Marko Lindqvist <cazfi>
Project Administrator
Sun Jul 15 20:33:50 2012, comment #12:

Any thinking results yet ? If you tell me about your preferred way I willing to implement & test it.

Sun Jul 8 18:51:38 2012, comment #11:

Ok, I now see how your patch works. I need to think this one a bit. I see at least five ways to proceed, each with pros and cons.

Marko Lindqvist <cazfi>
Project Administrator
Sun Jul 8 17:17:38 2012, comment #10:

No, the change was inside autosettler_enter_territory() since this functions seemed to be always called when the settler is moving.

If I understand correctly the difference between our patches is that mine considers the full path while yours considers the destination only ? At least, that is what I was trying to achieve. :-)

Sun Jul 8 16:50:53 2012, comment #9:

Umh, was your modifications inside settler movement handling (goto)? It was not obvious by simply reading the patch.

Anyway, attached is untested patch for settler not to even consider dangerous tiles (and to choose another place instead)

(file #16027)

Marko Lindqvist <cazfi>
Project Administrator
Sun Jul 8 16:20:00 2012, comment #8:

Using adv_danger_at() won't work unless pf_parameter->can_invade_tile is extended to pass the unit struct as argument. A quick look into path_finding.c left me with the impression that this won't work because the calling functions also don't have the unit at hand.

Feel free to correct me - I am a novice when it comes to the freeciv code base.

Sun Jul 8 15:35:04 2012, comment #7:

Yes, this patch was made against 2.3.2. Considered this to be a minor change that could go into the next small release. I'll check trunk and will provide a corresponding patch as well.

Sun Jul 8 14:30:04 2012, comment #6:

You're working against a release (of which 2.3.2 is latest)? Autosettlers code has been heavily rarranged to S2_4 (that will become 2.4 release series) and a bit more to current development version (TRUNK). You should provide feature patches against TRUNK.

Marko Lindqvist <cazfi>
Project Administrator
Sun Jul 8 14:26:04 2012, comment #5:

By the way, I did not consider protection against because they might be several tiles away (same as air units). Checking an enlarged radius does not seem to make sense.

But you are right - the battleship could already be at the coast waiting for us.

Sun Jul 8 14:22:19 2012, comment #4:

Where do I find adv_danger_at() ? Grepping through my tarball does not find anything.

Sun Jul 8 13:58:32 2012, comment #3:

Oh, is_square_threatened() checks only against land threats. This should also prevent autosettler from going to coastal tile which battleship is just about to sohrebombard.

Maybe adv_danger_at() is the function you want to use? It also makes callback to AI code so settler armor check could be implemented there - autosettler for human players would consistently not to enter dangerous tiles (this is good thing; consistency for human players, who can anyway order settlers manually if they want).

Marko Lindqvist <cazfi>
Project Administrator
Sun Jul 8 13:40:01 2012, comment #2:

How can we check for that ? Looking at attack_strength / defense_strength ? Can you suggest sane thresholds ?

Sun Jul 8 13:23:17 2012, comment #1:

Minor nitpick: In rulesets that introcude some kind of heavily armored unit with Settlers flag we may want that unit to work on a bit threatened tiles too (not so much when it's autosettler for human who can manually override anyway, but when used by AI)

Marko Lindqvist <cazfi>
Project Administrator
Sun Jul 8 01:24:52 2012, original submission:

When an autosettler is about to choose a tile to work on it does not care about neighboring enemy units, thus the autosettler often is killed as soon as the enemy unit can attack.

This change makes the autosettler check for danger in the tile's vicinity before considering to move there.



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

Attach File(s):

Attached Files


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 None (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.


    Error: not logged in



    Follow 7 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sun Jan 4 09:13:43 2015cazfiStatusReady For Test=>None
      Assigned tocazfi=>None
      Summaryautosettler choose safe tile to work on=>autosettler choose safe route to tile to work on
    Sun Jul 8 16:50:53 2012cazfiAttached File-=>Added AvoidDangrousSettlerTile.patch, #16027
    Sun Jul 8 13:15:03 2012cazfiStatusNone=>Ready For Test
      Assigned toNone=>cazfi
    Sun Jul 8 01:24:52 2012NoneAttached File-=>Added freeciv-autosettler-choose-safe-tile.patch, #16016
    Show feedback again

    Back to the top

    Powered by Savane 3.1-cleanup