Outerra forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Download Outerra Tech Demo. Unofficial Outerra Discord server, MicroProse Discord server for OWS.

Pages: [1] 2

Author Topic: Flock of birds  (Read 32128 times)

andfly

  • Sr. Member
  • ****
  • Posts: 347
Flock of birds
« on: April 17, 2016, 08:39:00 pm »



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:
« Last Edit: April 22, 2016, 06:33:14 pm by andfly »
Logged
I do not know the English language. I use Google Translate. I hope it's all understandable.

HiFlyer

  • Hero Member
  • *****
  • Posts: 1788
  • newbie
Re: Flock of birds
« Reply #1 on: April 17, 2016, 10:03:45 pm »

Awesome, as always!
Logged
Spex: Intel Core i7 6700K @ 4.6GHz / 32.0GB G.SKILL TridentZ Series Dual-Channel Ram / ASUS STRIX GeForce GTX 1080 / Sound Blaster Z / Oculus Rift VR Headset / Klipsch® Promedia 2.1 Computer Speakers / ASUS ROG SWIFT PG279Q ‑ 27" IPS LED Monitor ‑ QHD / 2x Samsung SSD 850 EVO 500GB / Windows 10 Pro

cameni

  • Brano Kemen
  • Outerra Administrator
  • Hero Member
  • *****
  • Posts: 6721
  • No sense of urgency.
    • outerra.com
Re: Flock of birds
« Reply #2 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;
Logged

Acetone

  • Hero Member
  • *****
  • Posts: 963
    • Youtube channel
Re: Flock of birds
« Reply #3 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) :)
Logged

KW71

  • Outerra Developer
  • Hero Member
  • *****
  • Posts: 762
  • Love OT!
Re: Flock of birds
« Reply #4 on: April 18, 2016, 09:19:17 am »

This is great, Andfly! It prints an awesome sense of life!
Logged
"A man who is contented with what he has done, will never become famous for what he will do".

andfly

  • Sr. Member
  • ****
  • Posts: 347
Re: Flock of birds
« Reply #5 on: April 18, 2016, 01:06:23 pm »

Awesome, as always!

And ... as always ....
thanks for the support most welcome!   :) :)
Logged
I do not know the English language. I use Google Translate. I hope it's all understandable.

andfly

  • Sr. Member
  • ****
  • Posts: 347
Re: Flock of birds
« Reply #6 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 ....
Logged
I do not know the English language. I use Google Translate. I hope it's all understandable.

andfly

  • Sr. Member
  • ****
  • Posts: 347
Re: Flock of birds
« Reply #7 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 ... :)
Logged
I do not know the English language. I use Google Translate. I hope it's all understandable.

andfly

  • Sr. Member
  • ****
  • Posts: 347
Re: Flock of birds
« Reply #8 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 !  :)
Logged
I do not know the English language. I use Google Translate. I hope it's all understandable.

HiFlyer

  • Hero Member
  • *****
  • Posts: 1788
  • newbie
Re: Flock of birds
« Reply #9 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.
Logged
Spex: Intel Core i7 6700K @ 4.6GHz / 32.0GB G.SKILL TridentZ Series Dual-Channel Ram / ASUS STRIX GeForce GTX 1080 / Sound Blaster Z / Oculus Rift VR Headset / Klipsch® Promedia 2.1 Computer Speakers / ASUS ROG SWIFT PG279Q ‑ 27" IPS LED Monitor ‑ QHD / 2x Samsung SSD 850 EVO 500GB / Windows 10 Pro

2eyed

  • Sr. Member
  • ****
  • Posts: 352
  • newbie
Re: Flock of birds
« Reply #10 on: April 18, 2016, 03:46:41 pm »

Chasing eagles with the Corby Starlet is fun (and slightly queasy with the rift :D ).
Logged

bomber

  • Hero Member
  • *****
  • Posts: 523
  • newbie
Re: Flock of birds
« Reply #11 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.
« Last Edit: April 18, 2016, 04:32:48 pm by bomber »
Logged
"If anyone ever tells you anything about an aeroplane which is so bloody complicated you can't understand it, take it from me - it's all balls" - R J Mitchell

KW71

  • Outerra Developer
  • Hero Member
  • *****
  • Posts: 762
  • Love OT!
Re: Flock of birds
« Reply #12 on: April 18, 2016, 06:13:23 pm »

This may be the foundation to have something like this!




Althoug for that, perhaps would be beter use particles.
« Last Edit: April 18, 2016, 07:52:27 pm by KW71 »
Logged
"A man who is contented with what he has done, will never become famous for what he will do".

HiFlyer

  • Hero Member
  • *****
  • Posts: 1788
  • newbie
Re: Flock of birds
« Reply #13 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

Logged
Spex: Intel Core i7 6700K @ 4.6GHz / 32.0GB G.SKILL TridentZ Series Dual-Channel Ram / ASUS STRIX GeForce GTX 1080 / Sound Blaster Z / Oculus Rift VR Headset / Klipsch® Promedia 2.1 Computer Speakers / ASUS ROG SWIFT PG279Q ‑ 27" IPS LED Monitor ‑ QHD / 2x Samsung SSD 850 EVO 500GB / Windows 10 Pro

HiFlyer

  • Hero Member
  • *****
  • Posts: 1788
  • newbie
Re: Flock of birds
« Reply #14 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"
Logged
Spex: Intel Core i7 6700K @ 4.6GHz / 32.0GB G.SKILL TridentZ Series Dual-Channel Ram / ASUS STRIX GeForce GTX 1080 / Sound Blaster Z / Oculus Rift VR Headset / Klipsch® Promedia 2.1 Computer Speakers / ASUS ROG SWIFT PG279Q ‑ 27" IPS LED Monitor ‑ QHD / 2x Samsung SSD 850 EVO 500GB / Windows 10 Pro
Pages: [1] 2