A small evolution "game"

Developed or developing a new product in PureBasic? Tell the world about it.
Hurga
Enthusiast
Enthusiast
Posts: 148
Joined: Thu Jul 17, 2003 2:53 pm
Contact:

A small evolution "game"

Post by Hurga »

Hello

I played a bit around with some game/simulation.

Here is the result...
Image

There a a constant plant-food (the green dots) and there are some plant eater (herbivores- the with boxes). You can set some parameter for them (which will applied for new Herbivores)

And there are some hunters :twisted: as well. (The red boxes)
They hunt (and eat) herbivores. And you can set some parameter for them, too.

You see in a graph with the population of the herbivores and the carnivores at the bottom of the window.

You can also see and edit the "genes" of each individual.

The refresh rate means after how many cycles the screen will redrawn.


What doenst work right now
herbivores: the sences, cannibale
carnivores: cannibale



Here you find the download

http://purebasic.stdojedmahr.de/projekte/Evolution.zip


Your hints, suggestions and opinion is welcome.
Hope you have some fun with it.
UserOfPure
Enthusiast
Enthusiast
Posts: 469
Joined: Sun Mar 16, 2008 9:18 am

Re: A small evolution "game"

Post by UserOfPure »

It's very hypnotic. :)
Tipperton
Addict
Addict
Posts: 1286
Joined: Thu Jun 19, 2003 7:55 pm

Post by Tipperton »

This looks like an enhanced version of a simulation that was published in Creative Computing back in the early 80s.

The original published version didn't allow for real time changing of the parameters, you had to edit the code then run it again. I modified it so that parameters could be changed while it was running.

I have fond memories of playing with it's many parameters for hours to see what affect they had over time.

I later added the ability to save and restore a simulation so I wouldn't have to start over every time I ran it.
dige
Addict
Addict
Posts: 1406
Joined: Wed Apr 30, 2003 8:15 am
Location: Germany
Contact:

Post by dige »

I like it - could watch for hours.. :)
Hurga
Enthusiast
Enthusiast
Posts: 148
Joined: Thu Jul 17, 2003 2:53 pm
Contact:

Post by Hurga »

Thx for your comments

Nice that you like it.

I worked on it a bit...
- the Herbivores now may use their sences (it they had some) to run away from carnivores
- the movement-speed is more exakt, so small differences may effect the outcome of a hunt
- the statistic with individuals is a bit better, (but it has sometimes a bug that creashes the proggie (an ima...)

Same link ...

The idea is old. I first read in a magazin "Spektrum der Wissenschaft" (is it "science"?) about it.
So it just played around with the main idea... ;-)
Foz
Addict
Addict
Posts: 1359
Joined: Tue Nov 13, 2007 12:42 pm
Location: Manchester, UK

Post by Foz »

I love this :)

Three possible things to do with this:
1. For watching full screen would be awesome.

2. (This ties into 1) Make this into a screensaver where you can give a time to create ### amount of herbivores and then ### amount of carnivores.

3. To speed rounds up, if you want to make some slight changes, but want to speed up the process times: switch off screen output - I'm guessing that screen output this is the slowest part of this.
Derek
Addict
Addict
Posts: 2354
Joined: Wed Apr 07, 2004 12:51 am
Location: England

Post by Derek »

Nice, passes the time away in work quite well. :wink:
User avatar
Demivec
Addict
Addict
Posts: 4270
Joined: Mon Jul 25, 2005 3:51 pm
Location: Utah, USA

Post by Demivec »

Hurga wrote:- the statistic with individuals is a bit better, (but it has sometimes a bug that creashes the proggie (an ima...)
The "ima" I think is related to the gadgets used. I noticed in the previous version that there was a big delay in drawing the gadgets on the main display. I suspect you are using #PB_ANY when creating multiple new gadgets and you are not freeing the former, no unused gadget #'s.

I enjoyed using your program. Now that the herbivores can run from the carnivores the carnivores have to gang up on them to drive them into each other. :wink:
Hurga
Enthusiast
Enthusiast
Posts: 148
Joined: Thu Jul 17, 2003 2:53 pm
Contact:

Post by Hurga »

I suspect you are using #PB_ANY when creating multiple new gadgets and you are not freeing the former, no unused gadget #'s.
Strangly not. I used constants (the good ol visual designer greets you ;-) )

But i recogniced this behavior as well...

I compiled the exe with 4.2 and it runs well.. maybe a bug in 4.1...?

The new version is available with the old link in the first post...


@Foz
Let me see what I can do... maybe an option to switch it to full space as an option in the pref... (not sooo cool, I know... ;-) )

The screensaver idea is nice .. I think I´ll try this when the proggie is running fine. Thx for the idea

To increase the speed, you can change the "refresh" - value. A value of 1 means, the screen will be refreshed after 1 cycle, 10, after 10 cycles and so on. That is, in other words switching off the screenoutput for (refreshrate) cycles.

Hope that speeds it up for you :-)
User avatar
IceSoft
Addict
Addict
Posts: 1695
Joined: Thu Jun 24, 2004 8:51 am
Location: Germany

Post by IceSoft »

If you like Evolution....maybe you like also PetriDish?
http://www.purearea.net/pb/showcase/sho ... yProj&sQ=0
Image
Belive! C++ version of Puzzle of Mystralia
Bug Planet
<Wrapper>4PB, PB<game>, =QONK=, PetriDish, Movie2Image, PictureManager,...
Hurga
Enthusiast
Enthusiast
Posts: 148
Joined: Thu Jul 17, 2003 2:53 pm
Contact:

Post by Hurga »

@ Icesoft

I know petridish.. it´s a nice one, I like it...


Here is a small update

You can now use fullscreen mode
Some internal changes...

Same link in first post
Foz
Addict
Addict
Posts: 1359
Joined: Tue Nov 13, 2007 12:42 pm
Location: Manchester, UK

Post by Foz »

I'm feeling dumb. :oops:

How do I get full screen?
Hurga
Enthusiast
Enthusiast
Posts: 148
Joined: Thu Jul 17, 2003 2:53 pm
Contact:

Post by Hurga »

Hm, when you start the program, a small window appears where you can preset the display. There should be a checkbox with "Fullscreen" (left bottom)

Maybe you has an older version, then download it again...

:wink: Good luck
Post Reply