AminetAminet
Search:
84749 packages online
About
Recent
Browse
Search
Upload
Setup
Services

misc/sci/bird.lha

Mirror:Random
Showing: ppc-morphos icongeneric icon
No screenshot available
Short:Small program of flocking birds
Author: allen at ukonline.co.uk
Uploader:allen ukonline co uk
Type:misc/sci
Version:5.01
Architecture:m68k-amigaos
Date:2001-08-17
Requires:68020
Download:misc/sci/bird.lha - View contents
Readme:misc/sci/bird.readme
Downloads:5144

Synopsis:

This is a simple program I wrote to simulate the action of birds.
It is currently compiled for a 68020.  You will also need
a screen large enough to have a 500x500 window.  This is now fixed!!

Sorry about the restrictions but I only wrote it to see if I could do it!

One argument, birds,  allows you to determine the number of birds in the flock.

USAGE:

bird birds=10

gives you 10 birds.

<should now work Ragnar!>

Due to some mails I have updated the program! (Thanks!  Mails are most appreciated as it shows some people are interested in what I am doing! :)

Now it is possible to play with some of the rules...

Can't see whats going on?  

Use the speed gadget to slow things down a little < Ragnar (again!) >

Want to affect the rules?  

Then switch them in and out using the rules buttons. (see below for an explanation of the rules)

Each bird of the flock follows three simple rules:

1.  Avoid the other birds. (not working too good!)
2.   Fly to the centre of the flock.
3.   Follow the flocks direction.

Still to do:

Add more cli argument/tooltypes.
Allow more than one flock. (could be interesting).
Better collision detection.
Get the slider gadget to work on loadup.  Seems to "lose" the speed string when first loaded, move it and it comes back!?!?

History:

V1:  Learning C++ so thought I'd write a "life" program, Birds
V2:  Bit better fixed loads of bugs, figured out timer device
V3:  Finally sorted timer device and ironed out ideas on collision
V4:  Optimised a few routinues and compiled.  First public release.
V4.5: After a few mails, had a look at the source and sorted a LOAD of mistakes! Thanks for the replies!
V4.8: Learnt about clipping and regions, pretty cool...this makes a birds fly off the window rather than disappear.
V4.9: Re-organised the code a bit
V5.0: Finally got round to implementing the GUI!  Had to learn Gadtools first though!
V5.01: Changed collsion detection to something simplier.  So it now "works".  Sort of.


Bugs:

Well Mr. McKenzie has a problem with his setup, I am still looking into this as I use Intuition calls which use the background pen and pen 1 to draw with.  So I don't know what is going on there.

The collision routine...I have kinda given up on that!  What I was trying to achieve never seemed to work!  Ok here is how I was thinking so anyone can give me a better idea then please do!

1.  Find the distance between two birds, A and B.
2. Is that distance below the minimum if so goto 4
3. Choose another B bird goto 1.
4. Is the angle of the intercept vector BA below PI/2
5. If so then move away.
6. Choose another B bird.

Repeat for each bird in the flock.

My reasoning behind this....?  Well I liked the idea of the birds being able to "see" around them, well 45 degrees (PI/2) around them and then to avoid anything in thier field of view.

Anyhow hope you enjoy watching the birds float about a bit...

Give us a mail!

Allen


Contents of misc/sci/bird.lha
 PERMSSN    UID  GID    PACKED    SIZE  RATIO     CRC       STAMP          NAME
---------- ----------- ------- ------- ------ ---------- ------------ -------------
[generic]                 1625    3085  52.7% -lh5- ef73 Aug 15  2001 bird/bird.readme
[generic]                 1844    2781  66.3% -lh5- 393f Aug 15  2001 bird/bird.readme.info
[generic]                31780   78876  40.3% -lh5- a45e Aug 15  2001 bird/newbird
---------- ----------- ------- ------- ------ ---------- ------------ -------------
 Total         3 files   35249   84742  41.6%            Aug 17  2001
Page generated in 0.02 seconds
Aminet © 1992-2024 Urban Müller and the Aminet team. Aminet contact address: <aminetaminet net>