Author: esr
Date: Thu Oct 23 08:35:30 2008
New Revision: 30330

URL: http://svn.gna.org/viewcvs/wesnoth?rev=30330&view=rev
Log:
Document some of suokko's weighting tweaks (without actually applying them) in 
FIXME comments.

Modified:
    trunk/src/ai.cpp
    trunk/src/ai_attack.cpp
    trunk/src/ai_move.cpp
    trunk/src/ai_village.cpp

Modified: trunk/src/ai.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/ai.cpp?rev=30330&r1=30329&r2=30330&view=diff
==============================================================================
--- trunk/src/ai.cpp (original)
+++ trunk/src/ai.cpp Thu Oct 23 08:35:30 2008
@@ -913,6 +913,7 @@
        std::vector<protected_item> items;
 
        // We want to protect our leader.
+       // FIXME: suokko tweaked these from (1.0, 20)->(2.0,15).  Should this 
have been kept?
        const unit_map::const_iterator leader = find_leader(units_,team_num_);
        if(leader != units_.end()) {
                items.push_back(protected_item(
@@ -1258,6 +1259,7 @@
                // is still alive, then also summon reinforcements
                if(choice_it->movements.size() == 1 && 
units_.count(target_loc)) {
                        LOG_AI << "found reinforcement target... " << 
target_loc << "\n";
+                       //FIXME: sukko raised this value to 5.0.  Is that 
correct?
                        add_target(target(target_loc,3.0,target::BATTLE_AID));
                }
 

Modified: trunk/src/ai_attack.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/ai_attack.cpp?rev=30330&r1=30329&r2=30330&view=diff
==============================================================================
--- trunk/src/ai_attack.cpp (original)
+++ trunk/src/ai_attack.cpp Thu Oct 23 08:35:30 2008
@@ -223,6 +223,7 @@
                        }
 
                        // Find out how vulnerable we are to attack from enemy 
units in this hex.
+                       //FIXME: suokko multiplied this by a constant 1.5. 
Should this be done?  
                        const double vulnerability = 
power_projection(tiles[j],enemy_dstsrc);
 
                        // Calculate how much support we have on this hex from 
allies.
@@ -491,11 +492,12 @@
                aggression = 1.0;
        }
 
+       //FIXME: One of suokko's reverted changes removed this.  Should it be 
gone?
        // Only use the leader if we do a serious amount of damage,
        // compared to how much they do to us.
        if(uses_leader && aggression > -4.0) {
-               LOG_AI << "uses leader..\n";
-               aggression = -4.0;
+               LOG_AI << "uses leader..\n";
+               aggression = -4.0;
        }
 
        double value = chance_to_kill*target_value - 
avg_losses*(1.0-aggression);

Modified: trunk/src/ai_move.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/ai_move.cpp?rev=30330&r1=30329&r2=30330&view=diff
==============================================================================
--- trunk/src/ai_move.cpp (original)
+++ trunk/src/ai_move.cpp Thu Oct 23 08:35:30 2008
@@ -622,6 +622,7 @@
                        for(std::vector<location>::const_iterator i = 
locs.begin(); i != locs.end(); ++i) {
                                const int distance = 
distance_between(*i,best_target->loc);
                                const int defense = 
best->second.defense_modifier(map_.get_terrain(*i));
+                               //FIXME: suokko multiplied by 10 * 
current_team().caution(). ?
                                const double vulnerability = 
power_projection(*i,enemy_dstsrc);
 
                                if(best_loc.valid() == false || defense < 
best_defense || (defense == best_defense && vulnerability < 
best_vulnerability)) {
@@ -656,7 +657,9 @@
                //if any point along the path is too dangerous for our single 
unit, then we hold back
                for(std::vector<location>::const_iterator i = 
best_route.steps.begin(); i != best_route.steps.end() && movement > 0; ++i) {
 
+                       //FIXME: suokko multiplied by 10 * 
current_team().caution(). ?
                        const double threat = power_projection(*i,enemy_dstsrc);
+                       //FIXME: sukko doubled the power-projection them in the 
second test.  ?
                        if((threat >= double(best->second.hitpoints()) && 
threat > power_projection(*i,fullmove_dstsrc)) ||
                           (i >= best_route.steps.end()-2 && unit_at_target != 
units_.end() && current_team().is_enemy(unit_at_target->second.side()))) {
                                dangerous = true;
@@ -715,6 +718,7 @@
                        for(move_map::const_iterator i = itors.first; i != 
itors.second; ++i) {
                                const int distance = 
distance_between(target_loc,i->second);
                                const int defense = 
un.defense_modifier(map_.get_terrain(i->second));
+                               //FIXME: suokko multiplied by 10 * 
current_team().caution(). ?
                                const double threat = 
(power_projection(i->second,enemy_dstsrc)*defense)/100;
 
                                if(best_loc.valid() == false || (threat < 
std::max<double>(best_threat,max_acceptable_threat) && distance < 
best_distance)) {

Modified: trunk/src/ai_village.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/ai_village.cpp?rev=30330&r1=30329&r2=30330&view=diff
==============================================================================
--- trunk/src/ai_village.cpp (original)
+++ trunk/src/ai_village.cpp Thu Oct 23 08:35:30 2008
@@ -234,6 +234,9 @@
                                if(new_unit != units_.end() &&
                                                
power_projection(i->first,enemy_dstsrc) >= new_unit->second.hitpoints()/4) {
                                        LOG_AI << "found support target... " << 
new_unit->first << "\n";
+                                       //FIXME: sukko tweaked the constant 1.0 
to the formula:
+                                       //25.0* current_team().caution() * 
power_projection(loc,enemy_dstsrc) / new_unit->second.hitpoints()
+                                       //Is this an improvement?
                                        
add_target(target(new_unit->first,1.0,target::SUPPORT));
                                }
                        }
@@ -345,7 +348,9 @@
                }
 
                const unit& un = u->second;
-               const size_t threat_multipler = (current_loc == leader_loc?2:1) 
* current_team().caution() * 10;
+               //FIXME: suokko turned this 2:1 to 1.5:1.0.  
+               //and dropped the second term of the multiplication.  Is that 
better?
+               const double threat_multipler = (current_loc == leader_loc?2:1) 
* current_team().caution() * 10;
                if(un.hitpoints() < 
(threat_multipler*threat*2*un.defense_modifier(map_.get_terrain(current_loc)))/100)
 {
                        continue;
                }


_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits

Reply via email to