artificial life

My first time trying this engine i want to see if i can imitate artifcial life, not sure if i can do this with the GE. Here is my question: can i make some objects that will school when together then scatter if a predator comes around? If so do i need a special A I or will logic bricks be enough? if i can do this a little detail please


Learn all that you can about python. Programming is power.
One question; For how long have you been using the BGE?

Also if you’re a newcomer to programming and such this is no easy task, however this phrase “imitate artificial life” makes me think you’ve pondered about these things for quite a while.
Know that it is quite possible with python, but I don’t know if it is viable within the BGE.

Use search and use the links below.

It’s definitely doable. Learn a lot of python. Depending on the complexity of the life you want to simulate, it could be pretty simple, or incredibly hard.

very preceptive John, i have pondered it quite awhile. I know C++ but teaching myself was slow considering what i want to do so i decided to try BGE .To answer your question i have been using BGE about two days but if i can get it to do what i want it is worth it to learn but i really don’t know anything about python ( was trying to avoid coding, not very good at it.) hoping there are some scripts already out there, I just don’t want to spend too much time with the game engine only to learn it is not possible


Flocking technology or more accurately “software” is definitely possible through python, so simulating birds and sheep crowds should not be too much. However I am first and foremost an artist, so perhaps someone else might give you a better answer.

As for using only logicbricks, definitely possible, however I cannot recommend it.
This is because logicbricks and low-poly meshes start to lose their upside as they grow in complexity.

Hope this helps you out. Keep at it dude.

flocking behaviour? Boids!

You inspired me to make some boids in python, I attached the file. Its based of this pseudo code:

To scatter the flock press and hold space, releasing it lets the boids return to the centre.

Also, because boids is vector heavy I decided to use 2.5 because game object velocity and position are given as vector types. So you’re going to need to use a 2.5, the one I used is build 23438 win 32. This can be done in 2.49 you would just need to convert positions and velocities into vector instances.

Boids is actually pretty simple, there are 3 base rules.

  1. A boid will move to the centre of the flock
  2. A boid will move at the average flock velocity (speed + direction)
  3. A boid will move away from other boids if its to close.

The scattering was done by making the boid move away from the centre of the flock. I also added some bounds in so the flock stays on screen.


boids.blend (139 KB)

Andrew, what i really wanted to make is an aquarium the fish (more sim than game) will have eyes, mouth, gills, fins all rigged they will be able to eat and scatter when a predator comes comes next to them. there movements should be very realistic. So this will be hard to write i think. i was trying to do it in C++. Python seems to be a bit easier to understand but either way it will be complicated if you make headway let me know




@andrew-101: Do you have a portfolio? You always seem to have an answer when it comes to python. Great work by the way.

Python’s advantage is it’s “readability” as in you can actually, truly compensate what you are programming.
Artist here :stuck_out_tongue:

@digiman; I’m not sure if you looked at my file (I don’t blame you if you didn’t with having to download a whole build to see it) but I think boids is very well suited to what you are trying to achieve. Have a look at this

Heres a summary of boids from the creator of boids:

@john; Thanks. I put all the files I make aside in a folder, I don’t really have a portfolio though. However that would make an interesting portfolio, can’t say I’ve seen many code portfolios.

Python is really easy to code. I’ve heard that in c++ you have to plan your code which would be a pain because I usually make it up as I go.

It’s a great start Andrew, you did this in a short time? I was learning C++ becuase people on forums told me python could not handle what i wanted after skimming over python a bit I think it can but i am no expert. I think i might take a deeper look at python
what i need is a script that will do what your boids are doing plus control the armature with incredible detail like wagging back and forth eyes moving. mouth and gills moving. if i can get that in the BGE enviroment what i want might be doable

take a look at the links the first one is a blender boids (birds) as a predator comes into the picture
the second is a spider moving in realtime with incedible detail. Thats’ what i am talking about


The wagging, eye movement ect. would be simple to do in blender. What you want is doable, especially now, with the script andew-101 provided(I dont know how he keeps doing it:rolleyes:)

Fingers crossed for the portfolio dude XD

Also that’s what I meant by readability, you sort of sense the code, furthermore it’s alot easier to understand other peoples python code as opposed to other peoples c/c++ code.

That being said I think there is only so and so much you can code on the fly when it comes to making AI brains.

  1. In all games that I’ve played to date, there have only been dum AI’s.
  2. In all games that I’ve played the AI cannot trick you.
  3. In all games that I’ve played to date AIs cannot improve.
  4. In all games that I’ve played to date AIs cannot communicate properly.

The list goes on but the main thing is: The AI is perfectly outlined. It cannot do human level randomness, although these are quite possible to program, however since you want to program a fish, I guess my points are invalid. :stuck_out_tongue:

PS: English is my 3rd language so just give me a holler if I need to clarify something.

Hey Andrew101 would it be possible to for you to be able to convert this for use in 2.49? I can’t get the 2.5 downloaded… If not it’s allright.

Heres a 2.49 version, its probably a bit neater and I added some comments so you can read it easier.


boids_249.blend (152 KB)

Nice implementation.

Artificial life (commonly Alife or alife) is a field of study and an associated art form which examine systems related to life, its processes, and its evolution through simulations using computer models, robotics, and biochemistry.[1] There are three main kinds of alife[2], named for their approaches: soft[3], from software; hard[4], from hardware; and wet, from biochemistry. Artificial life imitates traditional biology by trying to recreate biological phenomena.[5] The term “artificial life” is often used to specifically refer to soft alife.Artificial life studies the logic of living systems in artificial environments. The goal is to study the phenomena of living systems in order to come to an understanding of the complex information processing that defines such systems.
Also sometimes included in the umbrella term Artificial Life are agent based systems which are used to study the emergent properties of societies of agents.

@ruselrones: Did you get that from wikipedia or did you make that up yourself? sounds like a dictionary =)
Thanks alot for the 2.49version Andrew!!!