Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
5 registered members (RealSerious3D, AndrewAMD, chsmac85, dr_panther, TedMar), 942 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Flocking/Herding in Lite-C #223186
08/22/08 15:55
08/22/08 15:55
Joined: Aug 2008
Posts: 3
S
simpleton Offline OP
Guest
simpleton  Offline OP
Guest
S

Joined: Aug 2008
Posts: 3
Hi all,
i currently doing a project and need to code animal behaviours like flocking, prey and predator in Lite-C.

I know flocking is the combination of separation, cohesion and alignment. But i dont really know how to start. Any help? please?

Re: Flocking/Herding in Lite-C [Re: simpleton] #223215
08/22/08 17:36
08/22/08 17:36
Joined: Apr 2004
Posts: 516
USA
Trooper119 Offline
User
Trooper119  Offline
User

Joined: Apr 2004
Posts: 516
USA
Well let me tell you first of all I don't know the first thing about realistic behavior physics in this area, but if you are going for something that "looks good" and will behave well besides I think I can help you out, and trust you to fine tune it afterward.

Your idea intrigues me, and I personally wouldn't mind creating something like this myself if it actually fit into a project that I'm doing, unfortunately this is not the case.

I'm going to say I've borrowed the ideas in this post and they are not my own, but the fine details are simply guesswork of how the models that I have seen have worked (no models I've seen have been applied in a game though, so you should be the first that I've seen of that smile ). I must ask you what type of animal you are trying to model, since birds, fish and land animals will all move differently in each model. Regardless the following rough models should work though with some adjustments to each.

1. Leader based "flocking", this is commonly done in squad based games to some extent, but for animals these are seen among geese or ducks flying in a V in the sky.
-Given one leader, every entity relates itself to the leader, it stays close in proximity (small distance between it and the leader compared to other objects)
-It's orientation is the same or has slight deviations to the leader (more or less they are all moving in the same direction) unless their is an obstacle in their path, they will deviate from the formation and return as soon as possible once the obstacle is avoided.
-Given the type of animal and its behavior, "formation" is used loosely, for example a duck in formation would probably specify himself as 3 feet to the right and 5 feet behind the leader at practically all times and in the exact same orientation (direction moving/facing) and speed. Where a wolf of a pack would orient himself to a leader as no closer than 3 feet of the leader and closer then 100 feet from the leader, and simply going to the same destination, while arriving there within 1 minute of the leader.
-The benefits of this model is it is easy to assign sub-leaders and re-assign units within the formation so multiple groups can go to different locations, flanks and searching parties are possible with this method.
*If your going to ask someone to help, or a model, see IntenseAI, the project has done very well with this type of AI.

2. Animals with no large goal in mind would generally be considered part of an larger entity type behavior, schools of fish swim together, while sheep simply graze together in the same area. This is a bit simpler to do, but generally nothing complex or precise is being done by the group of animals.
-This introduces the idea of the "Entity" the entity can grow, shrink and move as necessary to the goals of the whole (a threatened entity may shrink in size to protect its members however it might grow if they feel safe and are looking for food)
-Units or animals of the entity don't really have to move in a given direction but instead just have to stay within it's limits to be part of the entity (usually for safety)
-Animals generally wander in this method, and moves slower then leader based movement. Although once an animal has drifted from the Entities boundaries all it simply needs to do is move towards it's center (avoiding obstacles) to get back to the entity.

If you are making different styles of animals and looking to diversify them I would suggest leader based movement for predators and Entity based movement for prey.

If your looking for predator based movement, all that is really needed is to set a far destination with random deviations in it's path every once in a while as it "wanders" to find it's prey, unless your going for pack based tactics after prey is found a simple chase and run, while avoiding obstacles would be sufficient.


A clever person solves a problem.
A wise person avoids it.
--Einstein

Currently Codeing: Free Lite-C
Re: Flocking/Herding in Lite-C [Re: Trooper119] #223273
08/23/08 05:39
08/23/08 05:39
Joined: Aug 2008
Posts: 3
S
simpleton Offline OP
Guest
simpleton  Offline OP
Guest
S

Joined: Aug 2008
Posts: 3
Hi trooper119,
i guess i would be happy to get my grazing wildebeasts to herd/flock while a pride of lions prey on them.
i not sure am i on the right direction, i'm in dilemma whether to use c_move to move the wildebeast or to use vec_accelerate.

i found some wdl file on herding, but couldn't figure out how it is being done.
http://euclid.nmu.edu/~jeffhorn/Classes/CS470/Winter2003/GStudio/Herding/herding.wdl

especially the scan_sector.PAN = 360; part, scan_sector is a var and it using .PAN.

Re: Flocking/Herding in Lite-C [Re: simpleton] #223282
08/23/08 07:16
08/23/08 07:16
Joined: Sep 2003
Posts: 929
Spirit Offline

Moderator
Spirit  Offline

Moderator

Joined: Sep 2003
Posts: 929
I dont know if this helps, but the book Game Programming Gems 2 had a chapter about predator prey flocking.

Re: Flocking/Herding in Lite-C [Re: Spirit] #223407
08/24/08 01:02
08/24/08 01:02
Joined: Jan 2008
Posts: 1,580
Blade280891 Offline
Serious User
Blade280891  Offline
Serious User

Joined: Jan 2008
Posts: 1,580
Are there any lite-c tutorials on this ,as i would love to know aswell.

Last edited by Blade28081991; 08/24/08 01:04.

My Avatar Randomness V2

"Someone get me to the doctor, and someone call the nurse
And someone buy me roses, and someone burned the church"
Re: Flocking/Herding in Lite-C [Re: Blade280891] #223906
08/27/08 16:30
08/27/08 16:30
Joined: Aug 2008
Posts: 3
S
simpleton Offline OP
Guest
simpleton  Offline OP
Guest
S

Joined: Aug 2008
Posts: 3
Kinda confused.
Is the individual herding animal aligns and moves towards the center of the herd?

or

individual herding animal follows the average heading of its neighbouring herd?

Re: Flocking/Herding in Lite-C [Re: simpleton] #223930
08/27/08 18:21
08/27/08 18:21
Joined: Oct 2004
Posts: 1,655
T
testDummy Offline
Serious User
testDummy  Offline
Serious User
T

Joined: Oct 2004
Posts: 1,655
herds; members follow alpha male / female!?
predators; packs follow herds!?
---packs select than route slower / weaker / older herd members!?


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1