Jump to content

  • Log In with Google      Sign In   
  • Create Account

Simulating units 'flooding' a door


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
5 replies to this topic

#1 Thanamos   Members   -  Reputation: 151

Like
0Likes
Like

Posted 08 May 2013 - 06:04 AM

Im working on a small Tower Defence kinda game with a little twist, all of the enemy units will be released at once and it's upto the player to constrict their numbers into tunnels. 

 

Of course I started with all the easy parts like towers and stuff but now I have to write the logic for crowd management, and I am abit unsure if there are any good algorithms for this?

 

Quick example...

 

queue.png

 

Here is 8 units trying to squeeze though a door which only allows one unit at a time.

 

I have already created a A* grid so I know where they are supposed to go, but it's the queue principle im struggling with.

 

Appretiate all the help.



Sponsor:

#2 Álvaro   Crossbones+   -  Reputation: 13372

Like
0Likes
Like

Posted 08 May 2013 - 08:11 AM

I am not sure what you mean by "a A* grid", but if you mean you have computed the distance map from each point to the destination (a.k.a. "value function"), you can just use simple steering behaviors for your units, so they stay away from each other but try to advance in the direction that makes the distance decrease. With a little bit of tweaking I bet you can make it look really nice.

If your map is more of a rigid grid, you can still do some discrete version of steering behaviors where a unit moves to the adjacent grid point that minimizes the distance, among the vacant ones.

All that sounds kind of obvious, so perhaps there is more to your question and I missed it. So feel free to ask about anything I haven't covered.

#3 IADaveMark   Moderators   -  Reputation: 2489

Like
3Likes
Like

Posted 09 May 2013 - 09:24 AM

Use steering instead of pathfinding.

 

http://www.red3d.com/cwr/steer/

 

Specifically... 

 

http://www.red3d.com/cwr/steer/Doorway.html


Dave Mark - President and Lead Designer of Intrinsic Algorithm LLC

Professional consultant on game AI, mathematical modeling, simulation modeling
Co-advisor of the GDC AI Summit
Co-founder of the AI Game Programmers Guild
Author of the book, Behavioral Mathematics for Game AI

Blogs I write:
IA News - What's happening at IA | IA on AI - AI news and notes | Post-Play'em - Observations on AI of games I play

"Reducing the world to mathematical equations!"

#4 Thanamos   Members   -  Reputation: 151

Like
0Likes
Like

Posted 10 May 2013 - 09:25 AM

Steering... exactly what I was looking for.

 

To clarify what I mean about the A* grid is that since the maps are dynamically changed I need to discover the best path to the target, so using A* to get a 'map' of the best path I can use steering to guide all the units along this route.

 

Really appretiate this guys, thanks a million.



#5 Kryzon   Prime Members   -  Reputation: 3083

Like
0Likes
Like

Posted 12 May 2013 - 09:21 PM

What a cool website. The live demos and concise descriptions illustrate better than a wall of text, IMO.



#6 LancerSolurus   Members   -  Reputation: 604

Like
0Likes
Like

Posted 12 May 2013 - 10:13 PM

Actually I use steering for my AI. Since it is a full 3D environment (outer space) A* isn't a viable solution. In my implementation a straight line is calculated to the target and the AI use 'feelers' to keep from crashing into objects. Eventually the AI will work their way around objects and get close enough to attack if thats their goal. The movement is nowhere near as precise as A* but is is a workable solution in the case of 3D star systems and 3D surface maps.


******************************************************************************************
Youtube Channel





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS