Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (475)
Games in Android Showcase (106)
games submitted by our members
Games in WIP (530)
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 3812 times)
0 Members and 1 Guest are viewing this topic.
Offline kevglass

JGO Kernel


Medals: 118
Projects: 23
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Posted 2005-09-11 01: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: http://www.red3d.com/cwr/steer/gdc99/

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

Kev

Offline Matzon

JGO Knight


Medals: 19
Projects: 1


I'm gonna wring your pants!


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

I remember reading this once: http://www.theparticle.com/applets/swarm/index.html
might want to check the flocking swarms applets.

Offline Orangy Tang

JGO Kernel


Medals: 56
Projects: 11


Monkey for a head


« Reply #2 - Posted 2005-09-11 11: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).

[ TriangularPixels.com - 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 Kernel


Medals: 118
Projects: 23
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #3 - Posted 2005-09-11 21: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

2)

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,

Kev

Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

ctomni231 (34 views)
2014-07-18 06:55:21

Zero Volt (30 views)
2014-07-17 23:47:54

danieldean (25 views)
2014-07-17 23:41:23

MustardPeter (27 views)
2014-07-16 23:30:00

Cero (42 views)
2014-07-16 00:42:17

Riven (44 views)
2014-07-14 18:02:53

OpenGLShaders (32 views)
2014-07-14 16:23:47

Riven (33 views)
2014-07-14 11:51:35

quew8 (30 views)
2014-07-13 13:57:52

SHC (66 views)
2014-07-12 17:50:04
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
java-gaming.org 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‑gaming.org
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!