AI

new topic     » goto parent     » topic index » view thread      » older message » newer message

Hello

Someone asked about AI (I deleted the mails accidentally) and someone
else gave a long complicated explanation.
So, here's my shot at it:
I haven't done much with ai but here is what I know:
Your game is the strategy game thingy like C&C, right?

1. Decide who is making the decisions
   A. The AI comander would make descisions about where
      to deploy units and what units and buildings to build.
   B. The unit itself would decide whether to attack
      another unit in transit and how to get to a destination
2. Gather info
   A. The comander would know about terrain and positions
      of enemy units that all of its units could see
   B. The unit would know only about what it could see
      and any destination that the commander has given it
3. Identify options
   A. The commander's options would be like a list of commands
      1. give unit destination
      2. build unit at specific building
      3. build building at specific destination
      4. tell unit to wander (good idea?)
   B. The units options would be
      1. move
         a. up
         b. down
         c. left
         d. right
      2. attack (list of possible locations in range)
4. Choose action
   A. Commander examples of pseudo code
      1. alert_pos = find (enemy, radar)
         if alert_pos then
             give_unit_dest (alert_pos, pick_close_unit (alert_pos))
         end if
      2. if curent_cash > possible_units [tank] [cost] then
             build_unit (possible_units [tank], building)
         end if
   B. Unit examples of pseudo code
      1. illegal_moves = {}
        next_step = choose_next_step (pos, dest, illegal_moves)
        while next_step = obstacle do
            illegal_moves = illegal_moves & next_step
            next_step = choose_next_step (pos, dest, illegal_moves)
        end while
      2. unit [alert] = find (enemy, sight)
         if unit [alert] then
             if find (unit [alert], unit [wep_range])
                 enemy = unit [alert]
                 attack (enemy, unit)
             end if
         end if

hope this helps.
As Hawke' (I think) said we'd have to know more about the
"rules" of the game to help you more

Lewis Townsend

______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu