Welcome to GameHourz.com!
FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Developer's diary

 
   Game Forums (Home) -> Roguelike -> Development RSS
Next:  Teir 0 Set  
Author Message
Andrew Doull

External


Since: May 05, 2006
Posts: 50



(Msg. 1) Posted: Fri Sep 08, 2006 12:55 pm
Post subject: Developer's diary
Archived from groups: rec>games>roguelike>development (more info?)

Hi,

I'm about to implement a new monster movement AI system in my Angband variant
Unangband, and was wondering if people were interested in a 'development diary'
of the work I'm doing.

The problem: Unangband has a complex terrain system (hundreds of terrain
types), including ice, water, lava, acid, pools of oil that can be set alight,
chasms, giant spider webs, rubble, rope bridges and so on. At the moment, I use
an adaptation of Leon Merrick's 4GAI from Oangband/Sangband for monster
movement, but it doesn't correctly handle pathfinding over the variety of
different terrain. I need something that can cope with dynamic terrain, and
various combinations of movement. I've had a look at the NPPAngband 4.5GAI
monster movement system, but it doesn't quite do what I want. So in the
Unangband tradition I'll be writing my own.

Since its probably harder to describe the details of the terrain system, I'll
instead describe some 'usage cases' that I want the new monster movement system
to handle.

Example 1: The player is crossing a bridge over a chasm. A group of orcs is
moving through a corridor at the end of the bridge, and see the player through
one of the windows from the corridor into the chasm. The orc warriors rush to
the end of the corridor and start climbing onto the bridge. Meanwhile, the orc
archers start to shoot at the player through the windows.

#.#
#o#
#o'
#.#
#oooxxxx@xxxx

FYI x is the bridge character in Unangband.

Example 2: The player is at the edge of a lake, swarming with naga. One type
of naga uses the water to its advantage, swimming underwater for cover and
popping out to cast spells at the player, while staying at a distance. If the
player enters the lake, another type of naga swarms forward, attacking the
player with their poisonous bite. This type had hidden under the water until
the player could be attacked.

Example 3: A group of giant spiders, which leave a trail of webs behind them,
swarm into a chasm to attack the player, who is on the other side. The giant
spiders crawl around the edge of the chasm toward the player. Their trails of
webs allow grow to form a spider web that fills the chasm. This allows further
spiders to crawl directly to the player over the webs.

Example 4: The player flees from a group of monsters and enters a room filled
with cupboards. The monsters follow into the room. Suspicious that the player
may be hiding in the cupboards, the monsters open then all. Meanwhile, the
player has cast an invisibility spell and used the delay to flee.

Example 5: A monster has yet to encounter the player. He wanders through the
dungeon corridors, getting to a room, and then choosing an exit from the room
to explore further. His path is predictable, so that the player can detect him
using detect monster spells. Because this monster is too much danger for the
player to handle at this stage, the player is able to use this information to
avoid the monster, while still exploring all the locations that the monster
frequents.

Regards,

Andrew

 >> Stay informed about: Developer's diary 
Back to top
Login to vote
Andrew Doull

External


Since: May 05, 2006
Posts: 50



(Msg. 2) Posted: Fri Sep 08, 2006 12:55 pm
Post subject: Re: Developer's diary [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On 2006-09-08 17:26:44, Andrew Doull <andrewdoull RemoveThis @gmail.com> wrote:

> Hi,
>
> I'm about to implement a new monster movement AI system in my Angband variant
> Unangband, and was wondering if people were interested in a 'development diary'
> of the work I'm doing.
>
> The problem: Unangband has a complex terrain system (hundreds of terrain
> types), including ice, water, lava, acid, pools of oil that can be set alight,
> chasms, giant spider webs, rubble, rope bridges and so on.

My initial problem, is that monster movement at the moment in Unangband works
okay for normal terrain, but breaks down for mixtures of terrain. I want to be
able to handle the case where a monster has to swim through acid, and then open
a closed door in order to navigate the shortest path to the player. A monster
which has only one of these abilities will have to find a longer path.

One option is to compute pathfinding for each monster. But dungeons in Unangband
can have lots of monsters. So I want to look at alternatives.

I suspect I am going to have some kind of array of path costs to get to the
player, for each x,y location, and for each 'combination' of monster
abilitiess.

If we use numbers for costs, an example might be:
############
#65432123456#
#54321@12345#
######1######
######2######
where numbers indicate the cumulative cost to get to the player. The algorithm
for monster movement then becomes pick the adjacent location with the lowest
cost for any array where it have the correct 'combination' of monster
abilities.

This is fine for moving towards the player, but for the reverse: fleeing from
the player, this breaks down. If we pick locations for higher costs, we don't
necessarily get a safe path away from the player. In the above example, the
monster will end up in a dead end that isn't safe rather than fleeing down the
corridor directly below the player.

Note that it might be possible to mark dead ends in such a way we can still use
this algorithm. If we define a dead end as a location where there is no higher
cost adjacent, below a 'certain cutoff' (e.g. far enough away from the player to
be safe). Then the 'sixes' in the above example will be marked as dead ends. We
then spread the dead ends by ignoring anything we've already marked as a dead
end and re-applying the algorithm until we have a settled state. In the above
example, assuming the corrirdor below the player is not a dead end, then
everything except the corridor is marked as a dead end. Then reverse the sign
on the dead end locations.

The movement algorithm then becomes:

1. When moving towards the player, pick the adjacent location with the lowest
ABS(cost).
2. When moving away from the player, pick the adjacent location with the
highest cost.

This may not still be correct, as it encourages monster fleeing past the player
to always run adjacent to them. We also should bias monsters to either
left-handedness or right-handedness when choosing from multiple locations of
equal cost.

Regards,

Andrew

 >> Stay informed about: Developer's diary 
Back to top
Login to vote
Balaam

External


Since: May 14, 2005
Posts: 14



(Msg. 3) Posted: Fri Sep 08, 2006 12:55 pm
Post subject: Re: Developer's diary [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Andrew Doull wrote:
> On 2006-09-08 17:54:28, Andrew Doull <andrewdoull.RemoveThis@gmail.com> wrote:
>
> > ############
> > #65432123456#
> > #54321@12345#
> > ######1######
> > ######2######
>
> Eep. A problem with using proportional fonts to draw non-proportial layout
> diagrams - you make mistakes.
>
> The correct diagram should of course be:
>
> #############
> #54321112345#
> #54321@12345#
> ######1######
> ######2######
>
> I don't particularly want to get into a discussion about the cost of diagonal
> movement. In Unangband, diagonal movement has the same cost as NSEW movement,
> and the range algorithms for sight and shooting are done using integer
> approximation of a^2 = b^2 + c^2.
>
> Andrew

Maybe a blog would be a better way of presenting your development
diary?
Looks interesting though!
 >> Stay informed about: Developer's diary 
Back to top
Login to vote
Antoine

External


Since: Feb 23, 2005
Posts: 577



(Msg. 4) Posted: Fri Sep 08, 2006 1:42 pm
Post subject: Re: Developer's diary [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Andrew Doull wrote:
> On 2006-09-08 17:26:44, Andrew Doull <andrewdoull RemoveThis @gmail.com> wrote:
>
> > Hi,
> >
> > I'm about to implement a new monster movement AI system in my Angband variant
> > Unangband, and was wondering if people were interested in a 'development diary'
> > of the work I'm doing.
> >
> > The problem: Unangband has a complex terrain system (hundreds of terrain
> > types), including ice, water, lava, acid, pools of oil that can be set alight,
> > chasms, giant spider webs, rubble, rope bridges and so on.
>
> My initial problem, is that monster movement at the moment in Unangband works
> okay for normal terrain, but breaks down for mixtures of terrain. I want to be
> able to handle the case where a monster has to swim through acid, and then open
> a closed door in order to navigate the shortest path to the player. A monster
> which has only one of these abilities will have to find a longer path.
>
> One option is to compute pathfinding for each monster. But dungeons in Unangband
> can have lots of monsters. So I want to look at alternatives.
>
> I suspect I am going to have some kind of array of path costs to get to the
> player, for each x,y location, and for each 'combination' of monster
> abilitiess.

You can apply some shortcuts here, as you've probably already
considered...

You only need this array for combinations of abilities which are
actually represented by monsters in the vicinity. This suggests some
kind of lazy evaluation (only produce the path cost array for a given
combination of abilities when a monster with those abilities wants to
move, and when the move for that monster is not obvious).

Also, if there is a clear best path to the @ for a monster with a given
combination of abilities including the ability to move over terrain
type X, and that path does not cover any tiles of terrain type X, then
a monster with exactly the same abilities except lacking the ability to
walk over X, should use the same path. This should provide shortcuts...

A.
 >> Stay informed about: Developer's diary 
Back to top
Login to vote
Andrew Doull

External


Since: May 05, 2006
Posts: 50



(Msg. 5) Posted: Fri Sep 08, 2006 1:55 pm
Post subject: Re: Developer's diary [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On 2006-09-08 17:54:28, Andrew Doull <andrewdoull DeleteThis @gmail.com> wrote:

> ############
> #65432123456#
> #54321@12345#
> ######1######
> ######2######

Eep. A problem with using proportional fonts to draw non-proportial layout
diagrams - you make mistakes.

The correct diagram should of course be:

#############
#54321112345#
#54321@12345#
######1######
######2######

I don't particularly want to get into a discussion about the cost of diagonal
movement. In Unangband, diagonal movement has the same cost as NSEW movement,
and the range algorithms for sight and shooting are done using integer
approximation of a^2 = b^2 + c^2.

Andrew
 >> Stay informed about: Developer's diary 
Back to top
Login to vote
konijn_

External


Since: Jul 12, 2005
Posts: 214



(Msg. 6) Posted: Sat Sep 09, 2006 6:37 am
Post subject: Re: Developer's diary [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Andrew Doull wrote:
> On 2006-09-08 17:54:28, Andrew Doull <andrewdoull.RemoveThis@gmail.com> wrote:
>
> > ############
> > #65432123456#
> > #54321@12345#
> > ######1######
> > ######2######
>
> Eep. A problem with using proportional fonts to draw non-proportial layout
> diagrams - you make mistakes.
>
> The correct diagram should of course be:
>
> #############
> #54321112345#
> #54321@12345#
> ######1######
> ######2######

Just to be certain , I hope you will also think of making monster more
swarm the player

If T is Troll

#######
#21112#
#21@12#
#2TTT2#
#33T33#
###4###

The troll at the bottom shouldnt wait for the other 3 to drop to the
floor, but actively seek a spot to whack the player.


> Andrew

Cheers,
T.
 >> Stay informed about: Developer's diary 
Back to top
Login to vote
ywg.dana

External


Since: Sep 02, 2006
Posts: 11



(Msg. 7) Posted: Sat Sep 09, 2006 8:58 am
Post subject: Re: Developer's diary [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Andrew Doull wrote:
> Hi,
>
> I'm about to implement a new monster movement AI system in my Angband variant
> Unangband, and was wondering if people were interested in a 'development diary'
> of the work I'm doing.
>

I would certainly enjoy reading your developer diary or blog!
 >> Stay informed about: Developer's diary 
Back to top
Login to vote
stu

External


Since: Aug 31, 2006
Posts: 4



(Msg. 8) Posted: Sat Sep 09, 2006 4:01 pm
Post subject: Re: Developer's diary [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

> However, assume the player can slay a troll in say 2 rounds of combat. If the
> troll goes to the left in your example, and the player kills the troll to the
> right then it may have been a smarter move to stay in the current location and
> 'step in' to fill ranks.

Sounds more like a dwarf tactic than a troll tactic. If the troll's
really smart he'd run the other way if he knew the player could kill
his buddy in two shots.

>
> That suggests a solution. Treat the movement cost of any square adjacent to the
> player currently filled by a monster as the number of rounds the player would
> take to kill that monster in hand-to-hand combat.
>

That's a good idea. You could even add an arbitrary number if the
troll next to the player is a spellcaster or extra-tough or something.

Btw,
I'll definitely read your diary.
Thanks,
Christopher
 >> Stay informed about: Developer's diary 
Back to top
Login to vote
Andrew Doull

External


Since: May 05, 2006
Posts: 50



(Msg. 9) Posted: Sat Sep 09, 2006 5:55 pm
Post subject: Re: Developer's diary [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On 2006-09-09 15:37:55, "konijn_" <konijn.RemoveThis@gmail.com> wrote:

> Andrew Doull wrote:
> > On 2006-09-08 17:54:28, Andrew Doull wrote:
> >
> > > ############
> > > #65432123456#
> > > #54321@12345#
> > > ######1######
> > > ######2######
> >
> > Eep. A problem with using proportional fonts to draw non-proportial layout
> > diagrams - you make mistakes.
> >
> > The correct diagram should of course be:
> >
> > #############
> > #54321112345#
> > #54321@12345#
> > ######1######
> > ######2######
>
> Just to be certain , I hope you will also think of making monster more
> swarm the player
>
> If T is Troll
>
> #######
> #21112#
> #21@12#
> #2TTT2#
> #33T33#
> ###4###
>
> The troll at the bottom shouldnt wait for the other 3 to drop to the
> floor, but actively seek a spot to whack the player.

That's an interesting and tricky problem, because its not necessarily always
true.

We'd usually want a troll to take the alternate patch in the following as well.

##########
#21112...#
###@###.#
#2TTT2#.#
#33T33...#
###4###

However, assume the player can slay a troll in say 2 rounds of combat. If the
troll goes to the left in your example, and the player kills the troll to the
right then it may have been a smarter move to stay in the current location and
'step in' to fill ranks.

That suggests a solution. Treat the movement cost of any square adjacent to the
player currently filled by a monster as the number of rounds the player would
take to kill that monster in hand-to-hand combat.

Andrew
 >> Stay informed about: Developer's diary 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
New developer - advice appreciated - Greetings I am a new rouge-like developer that is currently working on writing a rouge-like from scratch. As such I have afew ideas that I would like to get feedback on, and I am also requesting some advice on various features that are typically..

7DRL: Invader - Well, I've talked myself into attempting a game for the 7DRL challenge. :-) Invader will be a sci-fi RL where the player is the planet's only hope of stopping a dread alien invasion ship. The character's base of operations will be their docked ship. ....

7DRL: TBA! :P - I'm going to throw my hat into the 7drl arena by taking on a project I've wanted to do for ages. I think it will get me past the mental block of actually getting started. My concept is based around the remains of a post apocalyptic world with gang..

7DRL : Commander - It is 13.40 in my time zone (GMT +100). Time to start my 7DRL project: Commander. I will do it in Free Pascal. Plans are quite big so there is real danger of failure. Good luck to all participants of 7DRL contest. -- Michal ''Ancient'' Bielinski

7DRL : Valley of Ge-Hinnom - Info : @ goes chase to Moloch, java, using my library, so if I fail at least I can post an updated library. T.
   Game Forums (Home) -> Roguelike -> Development All times are: Ekaterinburg, Islamabad, Karachi, Tashkent (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]