Newsgroups: comp.ai.games
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!fas-news.harvard.edu!newspump.wustl.edu!news.starnet.net!news.starnet.net!news.dra.com!feed1.news.erols.com!dispatch.news.demon.net!demon!fido.news.demon.net!demon!sun4nl!oce.nl!not-for-mail!news
From: "A. Jans-Beken" <jabe@oce.nl>
Subject: Re: Multiple-Choice best-path algorithm?
X-Nntp-Posting-Host: pc1-jabe
Content-Type: text/plain; charset=us-ascii
To: Andrei Feheregyhazi <ad541@sfn.saskatoon.sk.ca>
Message-ID: <330391ED.4124@oce.nl>
Sender: news@oce.nl (The Daily News @ nntp01.oce.nl)
Content-Transfer-Encoding: 7bit
Organization: Oce-Nederland B.V.
References: <5d6fec$guh$1@missing.link.ca>
Mime-Version: 1.0
Date: Thu, 13 Feb 1997 22:13:01 GMT
X-Mailer: Mozilla 3.0 (Win16; I)
Lines: 62

Andrei Feheregyhazi wrote:
> 
> I am in the process of writing the A.(semi-)I. for a tile base/turn based
> game. I do not know how exactly it will turn out, whether as a war sim,
> or a personal combat sim, or something entirely different. But I do know
> that while playing around with ideas about how different 'units' in the
> game should act, I got lost in the net of best path algotithms.
> 
> I should mention that I am a high school student in Saskatchewan, and
> therefore my math level is really sh*tty.
> 
> I vaguely understand the span-the-map method pointed to in this group's
> FAQ, but would be extremely apreciative if someone could explain it to me
> like I'm an idiot.

The following site has some nice docs. I found lots of valuable info
there...
http://www.europa.com/~viper/C-CPP_Links.html

> The other problem I have is that the span-the-map algorithm does not
> allow for choosing the 'best' path - for example, avoiding tough terrain
> if the unit can't handle it, avoiding or approaching enemy units, etc..

In a tile-based game you can store properties for each tile. These
properties indicate for example what kind of vehicles can drive over
these tiles.

struct TILE {
  BITMAP *bmp;
  BOOL Man_Can_Walk_Here;
  BOOL Car_Can_Drive_Here;
  BOOL Ship_Can_Sail_Here;
  etc.
  };

(To save memory try to put all boolean properties in one BYTE.)
In your path-finding algorithm you should include code to check for the
right properties that you want.
 
> I have attempted to solve this by having a separate array, the same size
> as the terrain map, filled with the 'cost' of moving on to each tile. The
> cost is a number 0-1, 1 being impassable, 0 being super-preferable. Each
> value depends on the terrain, line-of-sight, line-of-fire, known enemy
> positions, etc..
> 
> I decided that at least *A* way to find the path would be to have a
> function that returns a list of every possible path from a starting
> point, that reaches a destination point, in a given number of moves,
> without hitting 1-valued position. The list is composed of the list of
> directions to move at each tile, and a 'cumulative' cost (am i using the
> right word there?) of each path. Then the unit would take the path that
> offers the best tradeoff of fast vs. 'costly'.
> 
> Problem.
> 
> I have no idea how to accomplish this. My brother the Computer Science
> student say that most computer science students can solve this one. I am
> posting this here because it seems like the best newsgroup for the topic.
> 
> Thanks for your time.
> 
> and never pet a burning dog...   (you all know that one, i'm sure.)
