Getting AI to recognize teammates.

Started by
5 comments, last by starstriker1 20 years, 11 months ago
Just to keep the starstriker-bashing to a minimum, I have already searched this site and forums for information on this. But I''m either searching for the wrong thing, or what I''m looking for isn''t here. First, heres a link to my game: www.geocities.com/momogames/deltawing.zip Right now, the AI is DECENT, but they hardly make for a good fight. What I want to implement is a system where they can recognize each other''s presence. Right now, the only ship that they arfe aware of is their target. What this brings up is the AI being extremely incompetent at any kind of offensive attack. They don''t attack in groups, therefore any assaults on the enemy defense are ill fated and useless. Even the flag runners have a hard time. The ships fast enough for flag capping are more fragile (what did you expect?), so the defense can allways tear them apart. However, on the off chance that a capper attacks while a teammate is present, the flag is usually grabbed and the trip home will sometimes work, because the chasers won''t have the rest of the defense to back them up. Links, suggestions, and bashes for not searching google are welcome.
Advertisement
quote:Original post by starstriker1
What I want to implement is a system where they can recognize each other''s presence.


Group coordination can be achieved in a number of ways. Two of the more obvious, are via distributed or centralized control.

In distributed control, each agent will perceive the environment, recognize friend or foe, determine or communicate what known friends are doing, develop a plan of action, negociate that plan with all known friends, compromise on the role the agent will play in the plan, communicate the plan components, and execute them.

In a centralized control, an uber-AI (or master AI) does all of the above and decides what each member of the group perceives and is going to do, and sends them an order to do it based on a central plan.

Read some of William''s papers at http://www.cgf-ai.com/ for some ideas of how to do this specifically.

Another consideration, is an adaptation of some of the steering behaviors. See http://www.red3d.com/cwr/steer/ for insights into the various steering behaviors. Leader and crowd following might give you some ideas.

You are not going to find a specific solution to your game''s needs. Instead, at best, you will find ideas on how you might adapt basic concepts to your game''s specific needs.

Try that approach and good luck.

Eric
Given the way players interact in my game, I think I''ll use "distributed control". This way, I might get some of the bots to help the player.

How would I manage this, though? Would I set up a list of requests for each bot?

Come to think of it.. in order to implement any of these AI ideas, I''m ngoing to have to rewrite the AI code... probably from scratch. Oh well, I guess its back to the drawing board.

...

Hey, uh, how...

(manages to shut up self before saying something stupid)
You might try the ''swarm of ants'' model. In this, each individual unit has a small amount of built-in behaviors, sensory apperatus for detecting the enviornment, and some method of communicating with others. The advantage here is that it''s robust and self-organizing; if a ship or a dozen get destroyed, the system will re-organize itself most efficently. If a ship or a dozen are added, the same thing will happen. The primary disadvantage is that it''s difficult to discover what behaviors are needed to have an emergent organization which will be competent at the task in hand.

Ants, in nature, typically have 13 distinct behaviors. This number varies very little between species (Some may have one or two additional ones, some may have one or two less). Functionally, each ant acts like a Finite State Machine in which it takes in input from limited variables (enviornment and communication with other ants), computes a specified behavor, then executes it. The main difference between species is the weighting and priority level different behaviors are given. One ant species may have a high priority given to the ''cleaning'' behavor, for instance, because they live in an enviornment where parasitic fungi grow easily on their exoskeleton. Others may have a high aggressive factor due to limited resources in their envoirnment -- can''t tolerate interloopers eating you out of house and home. Using some kind of Fuzzy Logic system may produce similar results.

In social robotics, the robots in a colony typically are always broadcasting their current actions to any other robot that happens to be in range via radio or infra-red emitters. This is different from ants who require sending chemical singles either through depositing them on surfaces or through direct contact.

You can either take a best guess at what behaviors and sensory apparatus are needed for each ship in your game and then try to refine that until you get the behavior you want, or take a much more complex (but automated) approach in that you use some type of genetic algorithm or even genetic programming to evolve up the solution. Personally, to start with, I''d suggest the previous. You may find that it ends up being pretty simple to develop a string of behaviors to get the gestalt performance you want (my first thought would be for stronger ships, if they detect a ''flag barer'' stating it''s going towards a goal, that they follow at a nearby distance. Another behavior would be to attack enemy ships within a certain range. Muck about with the priority of these two behaviors and you should be able to get a system by which strong ships will automatically guard a flag ship when it''s going for the gold).

Hope this helps!
Well... I''ve got a few commands thought up that should be general purpose... Kill, escort, wait, and attack.

When I went about planning my AI on paper, I found that only two sections would need changes: the target choosing section (right now, distance is the only qualifier), and I''ll need to add a "request" processing loop. And force the AI to not complete it''s "job" while other AI''s are requesting help.

Anything else that I''ve likely missed?
quote: Well... I''ve got a few commands thought up that should be general purpose... Kill, escort, wait, and attack.

When I went about planning my AI on paper, I found that only two sections would need changes: the target choosing section (right now, distance is the only qualifier), and I''ll need to add a "request" processing loop. And force the AI to not complete it''s "job" while other AI''s are requesting help.

Anything else that I''ve likely missed?


Looks like things are pretty well in hand for you. My one concern is over the ''escort'' behavior. This may be too high-level, depending on the actual semantics of it. A better one may be ''follow'', in which a ship will go and simply follow another ship a set distance away, rather than the implication that ''escort'' includes protecting the ship they''re following. That''s the sort of behavior you''d want to have happen naturally, without any special programming from you.
The idea is, yes, that it will follow, and engage ships that get too close. But I might want to make it more inclined to shoot up people attacking the ship being escorted.

The sappers in my game allready have an "escort" behaviour built in... somewhat. They will allways move towards the enemy flag, but if someone else is allready holding it, they will fight nearby enemies, throwing of the chasers.

This topic is closed to new replies.

Advertisement