[Freeciv-Dev] [patch #3887] Use UCF_MISSILE to identify missiles for pathfinding

2013-05-23 Thread Emmet Hikory
Follow-up Comment #4, patch #3887 (project freeciv):

I believe the apparent issue with bomber handling is related to the current
get_MC() callbacks not providing the correct value for the cost of an attack
for UTYF_ONEATTACK units, rather than being an issue in
pf_fuel_map_attack_is_possible().  If airmove() is modified to charge the
remainder of that turn's possible moves for these units, I don't believe the
bomber logic needs further changes in pf_fuel_map_attack_is_possible().

One possible way to handle this is that from patch #3901 (in the
attack_move_cost() function, although that depends on
pf_fuel_map_adjust_cost() from patch #3897).  Another would be to perform
similar conditionals and modulo math inside airmove(), preserving the current
nativity issues.

With correct attack cost charges, pf_fuel_map_iterate() should only allow
attack in cases where there would be sufficient fuel to return to base *after*
the attack.

___

Reply to this item at:

  http://gna.org/patch/?3887

___
  Message sent via/by Gna!
  http://gna.org/


___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


[Freeciv-Dev] [patch #3887] Use UCF_MISSILE to identify missiles for pathfinding

2013-05-22 Thread pepeto
Update of patch #3887 (project freeciv):

  Status:None = In Progress
 Assigned to:None = pepeto 

___

Follow-up Comment #3:

When I wrote this part of the code, there weren't a UCF_MISSILE unit class
flag.

I agree that bomber hanlding may be incorrect in
pf_fuel_map_attack_is_possible(), I will investigate more.

I can't remember why had I added the line || 0 = moves_left for fixing bug
#15244, I will investigate.


___

Reply to this item at:

  http://gna.org/patch/?3887

___
  Message posté via/par Gna!
  http://gna.org/


___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


[Freeciv-Dev] [patch #3887] Use UCF_MISSILE to identify missiles for pathfinding

2013-05-02 Thread Marko Lindqvist
Follow-up Comment #1, patch #3887 (project freeciv):

Reading the patch file only (not checking larger context) I suspect that
Bomber handling is not quite right. You are not checking fuel (=how many turns
flight time left) at all, but only how much movement for this particular turn
is left, when you deduct that this is last turn (running out of fuel) and unit
cannot both attack and return to base.

___

Reply to this item at:

  http://gna.org/patch/?3887

___
  Message sent via/by Gna!
  http://gna.org/


___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


[Freeciv-Dev] [patch #3887] Use UCF_MISSILE to identify missiles for pathfinding

2013-05-02 Thread Emmet Hikory
Follow-up Comment #2, patch #3887 (project freeciv):

In pf_fuel_map_iterate(), the function exits early in the event that there
aren't enough moves to return to a refueling point unless either the unit in
question is a missle or it has no moves anyway (as mentioned, I don't really
understand the purpose of this OR condition: I would think it just wastes
cycles processing the rest of the function for units that can't move anyway). 
If the unit is a missile, we can perform suicidal attacks (we don't care if we
will later be able to return to base because we wouldn't survive anyway).  We
later exit early in the event that we're targeting an enemy tile and wouldn't
be safe to attack (with pf_fuel_map_attack_is_possible()).

In pf_fuel_map_attack_is_possible(), we check to see if it makes sense for
the unit to attack: for missiles, we always attack (the unit would die anyway,
so we don't care about fuel), for bombers, we only attack if we have more
moves left than our move_rate (moves_left is initialised with pf_move_rate(),
so fueled units are treated as having many more moves per turn than move_rate
to simplify the pathfinding logic), which means that we are not on the last
turn of fuel.  If we are on the last turn of fuel, we don't attack, otherwise
it is safe to attack.

I agree there may be remaining issues with bombers (the logic doesn't
check to make sure that there will be enough moves_left to return to base
after the attack has been performed), but this patch doesn't change the
conditionals for bombers except in the case where fuel == 1, in which case it
is a bit more conservative (and won't actually attack: committing suicide is
only permitted for UCF_MISSILE units).

___

Reply to this item at:

  http://gna.org/patch/?3887

___
  Message sent via/by Gna!
  http://gna.org/


___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


[Freeciv-Dev] [patch #3887] Use UCF_MISSILE to identify missiles for pathfinding

2013-04-29 Thread Emmet Hikory
URL:
  http://gna.org/patch/?3887

 Summary: Use UCF_MISSILE to identify missiles for pathfinding
 Project: Freeciv
Submitted by: persia
Submitted on: Mon 29 Apr 2013 07:29:48 PM JST
Category: ai
Priority: 5 - Normal
  Status: None
 Privacy: Public
 Assigned to: None
Originator Email: 
 Open/Closed: Open
 Discussion Lock: Any
 Planned Release: 

___

Details:

The current code uses the combination of UTYF_ONEATTACK and fuel==1 to
determine that a given fueled unit is a missile.  This is suboptimal, as it
causes units that don't need to die in the attack consider suicide an
acceptable option, which ought be something done purposefully, rather than as
a side-effect of pathfinding being confusing.

This patch changes the two places that are checks for missiles to use
UCF_MISSILE instead.  For the pf_fuel_map_iterate() hunk, I'm not entirely
sure why the || 0 = moves_left check exists, so I've left it, but I suspect
it of causing AI missiles not to attack as much as they might.  Explanations
or suggestions to drop welcomed.

One side effect of this patch is that units that are UTYF_ONEATTACK, have fuel
== 1, and are not UCF_MISSILE will only attack from pathfinding when they are
currently on a refueling point (which I think appropriate, but some ruleset
author might consider unexpected).



___

File Attachments:


---
Date: Mon 29 Apr 2013 07:29:48 PM JST  Name:
use-UCF_MISSILE-for-missile-ID.patch  Size: 2kB   By: persia

http://gna.org/patch/download.php?file_id=17855

___

Reply to this item at:

  http://gna.org/patch/?3887

___
  Message sent via/by Gna!
  http://gna.org/


___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev