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

 
 
Show feedback again

patch #3383: autosettler choose safe tile to work on

Submitted by:  None
Submitted on:  Sun 08 Jul 2012 01:24:52 AM UTC  
 
Category: aiPriority: 5 - Normal
Status: Ready For TestPrivacy: Public
Assigned to: Marko Lindqvist <cazfi>Originator Email: -unavailable-
Open/Closed: OpenPlanned Release: 

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 13 Feb 2013 04:36:28 AM UTC, 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 AdministratorIn charge of this item.
Tue 17 Jul 2012 02:44:22 PM UTC, comment #14:

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

Anonymous
Sun 15 Jul 2012 10:23:30 PM UTC, 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 AdministratorIn charge of this item.
Sun 15 Jul 2012 08:33:50 PM UTC, comment #12:

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

Anonymous
Sun 08 Jul 2012 06:51:38 PM UTC, 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 AdministratorIn charge of this item.
Sun 08 Jul 2012 05:17:38 PM UTC, 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. :-)

Anonymous
Sun 08 Jul 2012 04:50:53 PM UTC, 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 AdministratorIn charge of this item.
Sun 08 Jul 2012 04:20:00 PM UTC, 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.

Anonymous
Sun 08 Jul 2012 03:35:04 PM UTC, 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.

Anonymous
Sun 08 Jul 2012 02:30:04 PM UTC, 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.

http://freeciv.wikia.com/wiki/Svn

Marko Lindqvist <cazfi>
Project AdministratorIn charge of this item.
Sun 08 Jul 2012 02:26:04 PM UTC, 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.

Anonymous
Sun 08 Jul 2012 02:22:19 PM UTC, comment #4:

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

Anonymous
Sun 08 Jul 2012 01:58:32 PM UTC, 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 AdministratorIn charge of this item.
Sun 08 Jul 2012 01:40:01 PM UTC, comment #2:

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

Anonymous
Sun 08 Jul 2012 01:23:17 PM UTC, 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 AdministratorIn charge of this item.
Sun 08 Jul 2012 01:24:52 AM UTC, 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.

Anonymous

 

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

Attach File(s):
   
   
Comment:
   

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.

     

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

     

     

    Follow 4 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sun 08 Jul 2012 04:50:53 PM UTCcazfiAttached File-=>Added AvoidDangrousSettlerTile.patch, #16027
    Sun 08 Jul 2012 01:15:03 PM UTCcazfiStatusNone=>Ready For Test
      Assigned toNone=>cazfi
    Sun 08 Jul 2012 01:24:52 AM UTCNoneAttached File-=>Added freeciv-autosettler-choose-safe-tile.patch, #16016
    Show feedback again

    Back to the top


    Powered by Savane 3.1-cleanup