Newsgroups: comp.ai.games
Path: cantaloupe.srv.cs.cmu.edu!europa.chnt.gtegsc.com!gatech!swrinde!elroy.jpl.nasa.gov!lll-winken.llnl.gov!fnnews.fnal.gov!gw1.att.com!nntpa!not-for-mail
From: nak@gwe486.cb.att.com ()
Subject: Re: BattleTech simulator: tank-like AI; working together?
Message-ID: <DC8J8C.Jt0@nntpa.cb.att.com>
Sender: news@nntpa.cb.att.com (Netnews Administration)
Nntp-Posting-Host: gwe486.cb.att.com
Organization: AT&T GBCS/Bell Labs
References: <3uuj46$aga@cd4680fs.rrze.uni-erlangen.de>
Date: Mon, 24 Jul 1995 19:24:11 GMT
Lines: 91

In article <3uuj46$aga@cd4680fs.rrze.uni-erlangen.de>,
Klaus Breuer <sz0759@rzmail.uni-erlangen.de> wrote:
>Hi everybody!
> 
[snip: Battletech, squad o Mechs]
> 
>The graphics etc are no big deal, but the AI is giving me 
>hassles. Having no idea where to start, I've thought of 
>assigning each location a 'preference number', based on 
>distance to enemy (player) Mechs, terrain type, etc, and have 
>each Mech move to the best possible place.
> 
>Disadvantages: 
>a) Slooooow
>b) The Mechs work as independent Units, and will be torn apart 
>by anybody with even a simple grasp of strategy.
> 
>Can anybody recommend anything? I'm probably missing something 
>very simple and very basic - could you perhaps recommend a 
>book or outline an idea I can improve on?
> 
>Thanks a lot!
> 
>Ciao,
>Klaus        
>---

THis is close enough to one I did that I'll  comment on it.

I used an evolutionary approach.  Write the simplest code that doesn't
break the rules of the game.  And I do mean DIRT SIMPLE.  It moves, it
shoots, it gets warm, it take damage.  In my case, I had one process per
unit.

Let your playtest group go shoot them to bits.  Start fixing the glaring
errors, even if they are little things.  Fix only those that you know how
to fix.  Test again, and, in the words of Maniac, "Watch and learn!."
Run this cycle as fast as your players can.

A couple of things will happen.  First, you will gain experience at turning
observation into behavior code.  Do the simple ones, and soon you will be
able to come up with code for the hard ones.  

Second, you'll find that some simple things work very, very well.  Keep
them simple.  Simple code often runs fast and is bug free.

Third, you will start to use the human intelligence of your playtest group
in your algorithms.  The code won't be as brilliant as good players, but it
never gets too excited and forgets to do the right thing.

The game I designed was to keep myself from implementing BattleTech, so the
lessons should apply in BT quite nicely.  It went from blundering stupidity
to lethal intesity in a nice progressive fasion.  Experts went from near
inifinite kill ratios (20:1 was all you could kill over lunch) to 
something far more reasonable (2.5:1 was a mistake free day from a team of
experts).  Trained newbies were getting kicked even when they had 2:1 odds.

Add teamwork later.  

For Battletech, I'll get specific:
First work on "duel" code.  Write code that plays any unit well in one on
one combat.  A key feature here is self analysis of the mech when the
program loads the data for the mech.  That way the mech fills in variables 
used as parameters in behavior code.  Such things as, "What's the longest
range that puts me at short range?"  Medium?  What's the range bracket that
maximizes my outbound damage?

More anaylsis is dynamic: How much heat am I carrying?  If I am too hot to
fire, I want to change the priorities of my movement for cover and
protection instead of setting up for fire that I won't be able to take.

This then gets put into the manuever code.  If you are doing by the book
BT, you want to tag enemy units that have already moved because you KNOW IN
ADVANCE where they will be at the beginning of fire phase.  The others you
have to guess at.

Fire code is pretty simple, run through the weapons in possibly a variable
order of priority and shoot all that can be shot without violating
constraints in effect.  

Use random values to pick in the case of a range of options.  A warm mech
has to decide between close and pound and get HOT or back off to get cool
or away from enemy fire.

Finally, read my paper from the 1991 Computer Game Developers Conference.
I think a copy of it is in the archive at x2 in Finland.
---
Neil Kirby	DoD# 0783	nak@archie.cb.att.com
AT&T Bell Labs  Columbus OH     USA (614) 860-5304
President Internet BMW Riders
The BMW R1100RSL - Because the Britten V 1000 is not street legal.
