Outerra forum

User mods, screenshots & videos => Aircraft => Topic started by: andfly on April 17, 2016, 08:39:00 pm

Title: Flock of birds
Post by: andfly on April 17, 2016, 08:39:00 pm
(http://i67.tinypic.com/24dkidy.jpg)

Here's a little game ...   :))

A flock of birds flying in a completely autonomous manner in Anteworld sky.
I used the eagle  because it was the only bird I had available even if, in reality, the eagles do not fly in group ... but the purpose is just for demonstration: I liked the effect I had obtained, and the sense of majesty that inspired me, and ... I thought it was nice to share it.
Create the model was not overly complicated (I already had at their disposal a single eagle model).
Most of the time I employed in an attempt to endow the birds of the little artificial intelligence to know how to act in all possible flight situations, and then not crashing to the ground and do know where to go.
And, unfortunately, I have to admit to not have succeeded as I wanted.
I'm missing something basic: I have not found a function of JsbSim or of Outerra APIs that notify me of the presence of an obstacle on the route and the relative distance.
The one feature that all flight simulators fans know and that triggers the dramatic warning "Pull Up .. Pull Up !!" or "Eject.. Eject  !!" which invites you to immediately change a risky collision course with the ground.
The only comparison that, in the end, I could make was the one with the altitude above the ground, which works well enough if you fly on a hilly terrain and in any case with "soft" changes in altitude, but it does not work equally well if you have to overcome the barrier of a vertical rock wall.

The principle of operation of the model is simple.
As soon as you create the first eagle start the creation of twenty birds alike in the immediate vicinity.
Each bird takes as a reference, for its route, the location where it was created.
The flight directives are:
- Maintain the reference altitude.
- Maintain a fairly constant attitude: correct roll and pitch if they become too prominent.
- Pull up quickly if the height of the terrain becomes too small.
- Increase the frequency of flapping of wings and "take a nosedive lightly" when you approach the stall speed.
- Set a slight turn when you move too far from their point of reference.

Every bird of the flock will perform a wide circle (about two kilometers) and will return to the coordinates of its point of reference and, if no obstacles that break down, will continue to fly indefinitely.

The result seems pretty nice though, of course, after a while it gets boring ... ::)
The purpose of this model, in fact, is to "animate the scene" creating an environment a little "more alive" while using another driveable model or to decorate a movie!

TIPS:

The birds that I used (eagles of fifteen meters, I'd already available) are large enough to be visible from a distance, but also the flight path is vast and you are likely to "lose sight" or not being able to follow all the their evolution.
For this purpose it is very useful to set the "min_obj_size = 1.0" in the file "eng.cfg".

Another curiosity is to try the power of your computer:
If you stay at the controls of an eagle and, during the simulation, you press ALT + R, will cause the reload of the model and are created twenty other eagles in addition to those already present.
My Computer (Asus Laptop, Core i7, Nvidia 940M) bears fine until sixty eagles, begins to suffer with eighty and a hundred no longer offers an acceptable result.
Whereas the original model eagle single is already full of calculations enough I was very pleasantly surprised at how optimization of Outerra engine can allow this performance ... with more powerful computers is perhaps possible to achieve even better performance!

Good fun!


To download the model:
https://drive.google.com/file/d/0B6114pZ3kPTgaFpxUnpqaXNxclE/view?usp=sharing
( This Download is now updated to version which includes the recognition of the obstacles and the change of course to avoid them)

A short movie:
https://youtu.be/1L00YNLFOEE
Title: Re: Flock of birds
Post by: HiFlyer on April 17, 2016, 10:03:45 pm
Awesome, as always!
Title: Re: Flock of birds
Post by: cameni on April 18, 2016, 01:02:03 am
Great job!

I'm missing something basic: I have not found a function of JsbSim or of Outerra APIs that notify me of the presence of an obstacle on the route and the relative distance.
The one feature that all flight simulators fans know and that triggers the dramatic warning "Pull Up .. Pull Up !!" or "Eject.. Eject  !!" which invites you to immediately change a risky collision course with the ground.

There was a new function added in the api that can be used for that purpose:

Code: [Select]
    ///Test if ray cast from model intersects with terrain
    //@param pos model-space position
    //@param dir model-space ray direction
    //@param maxdist max ray distance to check (keep short if possible)
    //@param joint bone id to be relative to
    //@return intersection distance or >= maxdist if no hit
    float ray_test( const float3& pos, const float3& dir, float maxdist, uint joint = -1 ) const;
Title: Re: Flock of birds
Post by: Acetone on April 18, 2016, 03:29:23 am
Wow, this is awesome  :D

If I'm not wrong it's the first public release of an AI flying object (well, several flying objects in that case) :)
Title: Re: Flock of birds
Post by: KW71 on April 18, 2016, 09:19:17 am
This is great, Andfly! It prints an awesome sense of life!
Title: Re: Flock of birds
Post by: andfly on April 18, 2016, 01:06:23 pm
Awesome, as always!

And ... as always ....
thanks for the support most welcome!   :) :)
Title: Re: Flock of birds
Post by: andfly on April 18, 2016, 01:09:47 pm
Great job!

I'm missing something basic: I have not found a function of JsbSim or of Outerra APIs that notify me of the presence of an obstacle on the route and the relative distance.
The one feature that all flight simulators fans know and that triggers the dramatic warning "Pull Up .. Pull Up !!" or "Eject.. Eject  !!" which invites you to immediately change a risky collision course with the ground.

There was a new function added in the api that can be used for that purpose:

Code: [Select]
    ///Test if ray cast from model intersects with terrain
    //@param pos model-space position
    //@param dir model-space ray direction
    //@param maxdist max ray distance to check (keep short if possible)
    //@param joint bone id to be relative to
    //@return intersection distance or >= maxdist if no hit
    float ray_test( const float3& pos, const float3& dir, float maxdist, uint joint = -1 ) const;

Thank you very much, cameni  !!!   :)

If I can apply this function the flock will tackle any situation!
I have to study a little ....
Title: Re: Flock of birds
Post by: andfly on April 18, 2016, 01:13:54 pm
Wow, this is awesome  :D

If I'm not wrong it's the first public release of an AI flying object (well, several flying objects in that case) :)

First of all: Thank you for the appreciation !  :)

Then take advantage of your post for a clarification ...
When I spoke of "the little artificial intelligence" I did not mean to refer to "REAL AI" of the computer world that regards, if I remember correctly, all the software that has the ability to self-planning during its execution, forever refining of more algorithms responsible for solution of events to process.
My few lines of script has certainly not this claim and respond programmatically to events without learning anything from the mistakes.

The approaching of the flock with a "too small form of AI", however, makes me very proud, and I thank you ... :)
Title: Re: Flock of birds
Post by: andfly on April 18, 2016, 01:16:42 pm
This is great, Andfly! It prints an awesome sense of life!

Is my primary desire!
Enjoy the great outdoors of Anteworld , building "something" that allows to "immerse themselves" in this wonderful atmosphere, feeling participate ...

Thank you !  :)
Title: Re: Flock of birds
Post by: HiFlyer on April 18, 2016, 02:12:25 pm
This is great, Andfly! It prints an awesome sense of life!

Is my primary desire!
Enjoy the great outdoors of Anteworld , building "something" that allows to "immerse themselves" in this wonderful atmosphere, feeling participate ...

Thank you !  :)

I wonder if things like this can be used for ambiance....... Smaller (life-sized) birds located in random locations, fished in the oceans based on your Orca program, sea traffic (boats) etc.
Title: Re: Flock of birds
Post by: 2eyed on April 18, 2016, 03:46:41 pm
Chasing eagles with the Corby Starlet is fun (and slightly queasy with the rift :D ).
Title: Re: Flock of birds
Post by: bomber on April 18, 2016, 04:30:09 pm
I read once about bird flocking... birds aren't rocket scientists so they behave simply with no leader and all have the same command which creates the typically seen effects.

1) maintain min max distance to nearest bird.
2) maintain min max height above ground.

This isn't a racing pigeon flock which must have.

1) if no bird in front fly circular path around co-order x y z
2) maintain min max distance to bird in front .

It's a wwii  bomber formation type set of simple requirements

Regards

Simon.
Title: Re: Flock of birds
Post by: KW71 on April 18, 2016, 06:13:23 pm
This may be the foundation to have something like this!

https://www.youtube.com/watch?v=eakKfY5aHmY


Althoug for that, perhaps would be beter use particles.
Title: Re: Flock of birds
Post by: HiFlyer on April 18, 2016, 07:18:36 pm
There is an FSX video about birds and other things "bringing the world to life"

But some people take a long time to catch on........  http://www.flightsim.com/vbfs/showthread.php?248991-Birds-in-FSX

Title: Re: Flock of birds
Post by: HiFlyer on April 18, 2016, 07:20:25 pm
I read once about bird flocking... birds aren't rocket scientists so they behave simply with no leader and all have the same command which creates the typically seen effects.

1) maintain min max distance to nearest bird.
2) maintain min max height above ground.

This isn't a racing pigeon flock which must have.

1) if no bird in front fly circular path around co-order x y z
2) maintain min max distance to bird in front .

It's a wwii  bomber formation type set of simple requirements

Regards

Simon.

This goes under the heading of "Emergent behavior"
Title: Re: Flock of birds
Post by: bomber on April 19, 2016, 05:54:07 am
"Emergent behavior" as defined thus...

Emergent behavior is behavior of a system that does not depend on its individual parts, but on their relationships to one another.

The starling example posted above is a good example... of course it's not the only example of emergent behavior and isn't limited to lower forms for intelligent life... a simple set of rules could be developed for NASCAR racing... (although there's some bebate about if it's not a lower form of intelligence)

A convoy of ships sailing across the Atlantic have one set of rules to behave too... yet upon sighting of a U-boat another set of rules for a limited period before adhering yet again to the previous set.

In star-trek this would be called 'defense pattern Delta'.

A submarine would do a 'crazy Ivan' a Lancaster bomber a 'corkscrew'.... it's not AI just very basic rule based behavior.

Be great if this could be worked out.
Title: Re: Flock of birds
Post by: Acetone on April 19, 2016, 07:25:19 am

First of all: Thank you for the appreciation !  :)

Then take advantage of your post for a clarification ...
When I spoke of "the little artificial intelligence" I did not mean to refer to "REAL AI" of the computer world that regards, if I remember correctly, all the software that has the ability to self-planning during its execution, forever refining of more algorithms responsible for solution of events to process.
My few lines of script has certainly not this claim and respond programmatically to events without learning anything from the mistakes.

The approaching of the flock with a "too small form of AI", however, makes me very proud, and I thank you ... :)

The vast majority of AI in games are really simple, reacting to a limited amount of information/parameters, so by definition, it's an AI, even if the word "Intelligence" is obviously a wrong choice, but again, deep learning AI is not something we will see soon in real time engines :)
Title: Re: Flock of birds
Post by: bomber on April 19, 2016, 07:59:57 am
Exactly Acetone, all too often I hear people wanting AI this and that when in reality all they're after is a set of rule based procedures to be applied.... take a bombers turret gunner for example.

1) scan sky
a) nearest plane is it enemy, yes/no
b) if no move onto next nearest if yes align guns with plane
c) track target

2) track target
a) align guns with target
b) is target within range yes/no
c) if no track target is yes fire guns
d) after 15 seconds of tracking scan sky

3) fire guns
a) align guns with target
b) when in range fire guns for 3 seconds 5 seconds gap
c) taking damage in last 3 seconds yes/no
d) if yes continuous fire
Title: Re: Flock of birds
Post by: andfly on April 19, 2016, 08:27:12 am

I wonder if things like this can be used for ambiance....... Smaller (life-sized) birds located in random locations, fished in the oceans based on your Orca program, sea traffic (boats) etc.


I firmly believe that Outerra is capable of all this!
Using simpler models, animations pre-built 3D graphics programs, the power and the optimization of the engine should be able to safely handle a large number of "environmental life representations" to be performed only when you get closer ...

It has already started importing the rivers ...
Then importing the streets ... then the cities ...
Natural will devise the best systems to insert a little life and movement ....

We remain confident ...    :)
Title: Re: Flock of birds
Post by: andfly on April 19, 2016, 08:31:56 am
Chasing eagles with the Corby Starlet is fun (and slightly queasy with the rift :D ).

Aaaaaaaargh !!!!!
I was attacked by a shameful but irrepressible feeling of envy!

Flying with the jewel of the "Maison Levi's" in the mountains and valleys of Anteworld, chasing a flock of birds, approach, see and hear the beating of their wings,......
and all this with the oculus rift !!!

You're a lucky guy!

Too bad for a little nauseous ....
But ... thinking deeply .... I think with some aerial acrobatics ... in the real world would be much worse!

Using just a few words and a "mental image" have demonstrated what can be Outerra better than any long speech full of majestic and uplifting words!
Thank you.   :) :)
Title: Re: Flock of birds
Post by: andfly on April 19, 2016, 08:38:47 am
I read once about bird flocking... birds aren't rocket scientists so they behave simply with no leader and all have the same command which creates the typically seen effects.

1) maintain min max distance to nearest bird.
2) maintain min max height above ground.

This isn't a racing pigeon flock which must have.

1) if no bird in front fly circular path around co-order x y z
2) maintain min max distance to bird in front .

It's a wwii  bomber formation type set of simple requirements

Regards

Simon.


This goes under the heading of "Emergent behavior"

It's true !

All the birds in the flock using exactly the same command script.

It is fascinating to see how even an extremely small difference in the initial placement or in guidance, causing, in time, enormous changes in the route and flight behavior!
Title: Re: Flock of birds
Post by: andfly on April 19, 2016, 08:46:59 am
This may be the foundation to have something like this!

https://www.youtube.com/watch?v=eakKfY5aHmY


Althoug for that, perhaps would be beter use particles.

It would be a really cool effect!  8)

We have already seen something that uses particles Outerra: the smoke tests (long ago) and recently its use, by Uriah, to give realism to start rocket under the Typhoon  wings ....
Increase the particle size and shape into small birds (also not moving) .... well ... if you can ...
Programming of movement rules that reproduce situations that are seen in the movie ...

It seems a good idea to pass the developers ...
Title: Re: Flock of birds
Post by: KW71 on April 19, 2016, 09:21:07 am

We have already seen something that uses particles Outerra: the smoke tests (long ago)

Haven't you shoot the ground lately? We have smoke now!  :D
Title: Re: Flock of birds
Post by: andfly on April 19, 2016, 02:19:45 pm
Haven't you shoot the ground lately? We have smoke now!  :D

Wow !!!    :D
I had not yet happened to touch the left mouse button ....
it was a surprise!
Title: Re: Flock of birds
Post by: KW71 on April 19, 2016, 02:54:07 pm
Perhaps this could help:

2D  Code

https://processing.org/examples/flocking.html

3D Example

http://rumblesushi.com/turbo_flock.html     (from here:  http://board.flashkit.com/board/showthread.php?822921-3D-Flock-Code-Challenge)

Different Behaviors:

http://blog.soulwire.co.uk/wp-content/uploads/2009/05/boids.swf

 


Title: Re: Flock of birds
Post by: andfly on April 20, 2016, 07:24:09 am
I included the function that identifies the obstacles on the route of flight (who kindly informed me Cameni) in the command script of the flock of birds.
Now, from my tests, even flying in the narrow gorges between the mountains, you will not lose any more bird.
This, however, is not assured "absolutely"!
For a purely "aesthetic" factor I have commanded the change of course "the last moment" because I really like to see the eagles that graze the cliffs ...
Since the flight of birds is very "random", it could happen that one set of unfavorable combinations fail to prevent a collision with the ground ...
In my tests it never happened but I only tried it for about half an hour .... and it is not enough to offer guarantees!

Here is the link to download the new script replaces the old EAGLE_Flock.js
https://drive.google.com/file/d/0B6114pZ3kPTgR2MyajU2MExIZXM/view?usp=sharing

Still .... good flight!
Title: Re: Flock of birds
Post by: DSCHILDMEIJER on April 22, 2016, 03:05:58 am
Hi!

You must love this to see too! check the young eaglts feeded by there parents click on one of the cams A or B for perfect views. Watch them growing up they are still young you can follow them 24/7 Daylight is color cam!

http://dceaglecam.org/


In 2014, a pair of mated Bald Eagles chose the most idyllic of nest sites within the United States’ National Capital (Washington, DC), nestled high in a Tulip Poplar tree amongst the Azalea Collection at the U.S. National Arboretum.

http://dceaglecam.org/

Danny
Title: Re: Flock of birds
Post by: KW71 on April 22, 2016, 12:59:07 pm
Nice, DSCHILDMEIJER!!! Thanks for sharing!
Title: Re: Flock of birds
Post by: andfly on April 22, 2016, 02:44:39 pm
I agree !!!
An excellent opportunity to share an exciting experience!

Thank you.   :) :)
Title: Re: Flock of birds
Post by: patmarrnc on November 28, 2017, 03:33:37 pm
wow, Andfly!

This is awesome! The contributions you've made to this forum and to Outerra in general are amazing! Thanks for the help and inspiration you offer to all of us!