Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (777)
Games in Android Showcase (231)
games submitted by our members
Games in WIP (856)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Dungeon Crawl Movement AI/Steering/Flocking this time :)  (Read 6022 times)
0 Members and 1 Guest are viewing this topic.
Offline kevglass

« JGO Spiffy Duke »

Medals: 319
Projects: 25
Exp: 22 years

Coder, Trainee Pixel Artist, Game Reviewer

« Posted 2005-09-10 23:22:38 »

So, I'm still pushing ahead with this dungeon crawl. I've got the networking side working happily, and the renderer looks pretty neat. I've reached the point where I've got my player (or players) running round the random dungeon with monsters (skaven for those interested) coming after the player.

I'm using DJK or A* depending on mood for the path finding. When my player clicks the character moves to the appropriate location. Equally, as my player moves round I have a AI framework that finds light-of-sight from monster to player and causes the monster to choose a path to the player and attempt to follow him/her (eventually to attack).

The problem - my path finding chooses the best path (account for other monsters getting in way optionally). If the monster gets blocked (by other entity or wall) the path is recomputer. The problem is I'm getting the effect of a swarm of monsters approach the player and then sort of lining up on approach. 

I've been reading about flocking/steering and seems like its the sort of thing I need to push the monsters away from each other. However, I'm finding they get in loops like:

1) Monsters move close enough to have steering effect, hence they don't follow their path perfectly
2) Next cycle, monsters are far enough away from each other that steering has no/little effect, they now move along the path as before
3) The monsters have now moved back close to their original positions and hence get pushed away from each other again..

and round and round.. giving a horrible little jitter.

I started here:

Does anyone know of any more in depth resources about the subject or knows how to resolve these steering vs pathfinding conflicts.


Offline Matzon

JGO Knight

Medals: 19
Projects: 1

I'm gonna wring your pants!

« Reply #1 - Posted 2005-09-11 06:08:08 »

I remember reading this once:
might want to check the flocking swarms applets.

Offline Orangy Tang

JGO Kernel

Medals: 57
Projects: 11

Monkey for a head

« Reply #2 - Posted 2005-09-11 09:04:40 »

I think you might just be stuck with tweeking the weights and such between the two behaviours. Increasing the stearing range (but reducing the affect) could do it. And add a little damping/smoothing to the whole thing so you don't get the horrible twitching when the two almost cancel each other out.

Surely though your pathfinding is just another steering behaviour? Just a very specific and data-driven one. So tweeking it to produce the results should work like most other behaviours (ie. quite tricky IMHO).

[ - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline kevglass

« JGO Spiffy Duke »

Medals: 319
Projects: 25
Exp: 22 years

Coder, Trainee Pixel Artist, Game Reviewer

« Reply #3 - Posted 2005-09-11 19:26:49 »

Thanks for that guys, interesting useful stuff. For anyone interested this is what I've done:

1) Remove the concept of path finding from the monsters


In my world I have "Actors". At any given time an Actor is driven by a "Action". I've implemented a "SteeringAction" which contains a set of "Steer" implementations and combines them based on their weights to work out the direction of movement each cycle. I then have a StandardMonsterSteeringAction subclass that configures a particular set of "Steers" for monsters.

To get reasonable results I've combined :-

MoveToTargetSteer - just tends the Actor to a particular target. In this case this causes the monsters to move towards the targeted player.

AwayFromFriendsSteer - this causes monsters to tend away from each other (but not players, hence the reference to friends). This is a seperation steering algo. There are two subclasses that each use different priorities to determine which Actor in a conflict will move (one picks an arbitary one, one chooses based on the distance from the current target)

TendFromWallsSteer - this causes monsters to tend away from walls and hence they're more likely to reach the player.

These 3 combined give me almost as good as path finding results while maintaining a steering framework which means interactions given relatively decent results.

All in all, its pretty cool - I need to think how to make the swarm around the player a bit more obvious, just changing the weighting isn't having the desired effect.

Thanks for the pointers,


Pages: [1]
  ignore  |  Print  

hadezbladez (276 views)
2018-11-16 13:46:03

hadezbladez (154 views)
2018-11-16 13:41:33

hadezbladez (287 views)
2018-11-16 13:35:35

hadezbladez (69 views)
2018-11-16 13:32:03

EgonOlsen (2124 views)
2018-06-10 19:43:48

EgonOlsen (2148 views)
2018-06-10 19:43:44

EgonOlsen (1361 views)
2018-06-10 19:43:20

DesertCoockie (1957 views)
2018-05-13 18:23:11

nelsongames (1598 views)
2018-04-24 18:15:36

nelsongames (2245 views)
2018-04-24 18:14:32
Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08

Deployment and Packaging
by gouessej
2018-08-22 08:03:45

Deployment and Packaging
by philfrei
2018-08-20 02:33:38

Deployment and Packaging
by philfrei
2018-08-20 02:29:55

Deployment and Packaging
by philfrei
2018-08-19 23:56:20

Deployment and Packaging
by philfrei
2018-08-19 23:54:46 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!