Results 1 to 10 of 15

Thread: Boids - group AI implemented in ThinBASIC

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,156
    Rep Power
    736

    Boids - group AI implemented in ThinBASIC

    Hi,

    during Game Access 2010 there was one nice technique mentioned "by the way" as approach used for modelling chicken flock animation - the boids.

    I googled a bit on the topic, it seems it is one of the most elemental algorithms for group AI, but I like it very much so I present it here in version, where "boids" (individual members of flock) are visualised as simplified fishes in the sea.

    The code is organised again around entities and concept of actors and animators I mentioned a while ago. It is very close to OOP and for now it seems very natural way to implement ideas in TB (at least for me ).

    The actors are the boids, that means fish in this case, the animators handle the flock behavior. There are two flocks in the demo, one are prey and second the predators.

    The code is strongly based on great pseudocode from here:
    http://www.vergenet.net/~conrad/boids/pseudocode.html
    where the 3 main rules - position, collision avoidance and speed matching are discussed in detail and very clear fashion.

    You will need thinBASIC 1.8.6.0 + latest TBGL to run it (or anything newer).

    It is not meant to be visually very impressive, I could create model for the fishes and animate it, but I wanted the code to stay as "pure" for general boids as it could be, so others can use it in their projects. That is why fishes are represented just with elipsoids.
    As said before, code is strongly OOP, so you can "instantiate" as many boids and their flocks as you need in your projects.

    The main application can be launched from Boids_DemoApp.tBasic, the actor_boid.tBasic and animator_boid.tBasic are just "units" used by the main code.


    I hope you will like it,
    Petr

    UPDATE: Added new download of BoidsEnhanced.zip where you can play more with the script:

    • Arrow keys to move view
    • F5, F6 to change area used for prey
    • F7, F8 to change area used for hunters
    • F9 default camera
    • F12 hunter camera
    Attached Images Attached Images
    Attached Files Attached Files
    Last edited by Petr Schreiber; 08-01-2011 at 21:10.
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

Similar Threads

  1. Article: Boids - group AI implemented in ThinBASIC
    By Petr Schreiber in forum vBCms Comments
    Replies: 0
    Last Post: 09-01-2011, 11:53

Members who have read this thread: 0

There are no members to list at the moment.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •