Complete.Org: Mailing Lists: Archives: freeciv-dev: November 2001:
[Freeciv-Dev] RFC: Fixing movement code
Home

[Freeciv-Dev] RFC: Fixing movement code

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv development list <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] RFC: Fixing movement code
From: Raahul Kumar <raahul_da_man@xxxxxxxxx>
Date: Wed, 21 Nov 2001 01:35:15 -0800 (PST)

This patch is tidying up the AI for my further patches. The aim is to allow
the replacement of 3 = Single move cost with 30. This will allow finer grained
movement costs such as 1/6 for an igter unit upgrade, as well as maglev costs.

List of proposed changes

If there are any other places in the AI code where there are changes to be made
let me know. 


 if (ferryboat) boatspeed = (unit_flag(ferryboat, F_TRIREME) ? 6 : 12);
  else boatspeed = (get_invention(pplayer, game.rtech.nav) != TECH_KNOWN ? 6 :
12);

Not very portable at all. What is supposed to be the move rate for triremes?

warmap.seacost[acity->x][acity->y] <= 6 * THRESHOLD)))

I have to get rid of all these 6 * threshold nos. I could always
just multiply threshold by 10.

if (boatspeed < 9 && c > 2)
Have to multiply that by single move cost. What does c do in this function?

total_distance in ai_tools.c

total_distance = 36 This must be 12 squares. Therefore my patch will have
360 as total distance.



File aiunit.c

static int unit_move_turns(struct unit *punit, int x, int y)
{
  int m, d;
  m = unit_type(punit)->move_rate;
  if (unit_flag(punit, F_IGTER)) m *= SINGLE_MOVE;
  if(is_sailing_unit(punit)) {
    struct player *pplayer = unit_owner(punit);
    if (player_owns_active_wonder(pplayer, B_LIGHTHOUSE))
      m += SINGLE_MOVE;
    if (player_owns_active_wonder(pplayer, B_MAGELLAN))
      m += (improvement_variant(B_MAGELLAN)==1) ? SINGLE_MOVE : 2 *
SINGLE_MOVE;
    m += player_knows_techs_with_flag(pplayer,TF_BOAT_FAST) * SINGLE_MOVE;
  }

  if (unit_type(punit)->move_type == LAND_MOVING)
    d = warmap.cost[x][y] / m;
  else if (unit_type(punit)->move_type == SEA_MOVING)
    d = warmap.seacost[x][y] / m;
  else d = real_map_distance(punit->x, punit->y, x, y) * SINGLE_MOVE / m;
  return(d);

m = max_move_rate
d = min_turns_to_dest

ai_military_find_victim

Any ideas for something better than a,b,c,d,e,f

f should be unit_build_cost

what the hell is b? 
          b = unit_type(pdef)->build_cost;
b = (b + 40) * punit->hp / unit_type(punit)->hp;



find_something_to_kill is also pretty bad

m = max_move_rate

 




__________________________________________________
Do You Yahoo!?
Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month.
http://geocities.yahoo.com/ps/info1


[Prev in Thread] Current Thread [Next in Thread]