Behold, I have created life!!!
- FlukeDude
-
FlukeDude
- Member since: Sep. 18, 2006
- Offline.
-
- Forum Stats
- Member
- Level 14
- Blank Slate
This'll show those creationists! :D
They used to call me souled...
- Yhtomit
-
Yhtomit
- Member since: Jan. 27, 2006
- Offline.
-
- Forum Stats
- Member
- Level 24
- Animator
What's most amazing is the adaptability. I was fiddling around on the black grey and white version, and after many hours, they had all evolved into giant, humungus circles, the smallest being atleast a centimeter and a half across (that's over half an inch... i think, i don't do imperial), I started trying to wipe them out, and BAM! 2 minutes later, that survivors had evolved into 3 pixel wide dots!
Absolutely amazing coding you've got here!
- West-End-Pro
-
West-End-Pro
- Member since: Feb. 15, 2006
- Offline.
-
- Forum Stats
- Member
- Level 24
- Blank Slate
- FiqStudios
-
FiqStudios
- Member since: Dec. 23, 2007
- Offline.
-
- Forum Stats
- Member
- Level 08
- Blank Slate
Wait, I've noticed an odd behavior. If you let the cells evolve without predation, they grow enormous. Size seems independent of life_span and breed_rate: The only things that matter when evolving without a predator. Even the DNA Average reports show this. If someone can offer an explanation that would be super.
I'm going to ad natural predators, with new genes controlling how close the predator has to be to the prey to realize it's there. I'll get on this soon, but on the drive home I thought of an awsome idea for me to script.
- UltraPulse
-
UltraPulse
- Member since: May. 27, 2005
- Offline.
-
- Forum Stats
- Member
- Level 20
- Blank Slate
Nice... Left it on for 2 minutes and half the screen is filled... Make a game and submit it.
I dont have a signature, stop bugging me.
- UltraPulse
-
UltraPulse
- Member since: May. 27, 2005
- Offline.
-
- Forum Stats
- Member
- Level 20
- Blank Slate
If it wasn't already said, make a game, but add bigger killing tools...
I dont have a signature, stop bugging me.
- FiqStudios
-
FiqStudios
- Member since: Dec. 23, 2007
- Offline.
-
- Forum Stats
- Member
- Level 08
- Blank Slate
Everybody says make a game, but I have no Idea how. Ideas?
Also, I forgot to add the updated script.
WEE!!!
/*Note: I could just say "Array", "Variable", and "Movie Clip" insted of "DNA", "Gene", and "Cell"; but that wouldn't sound nearly as awesome.*/
var cells:Array = new Array();
var average_DNA:Array = new Array();
var inc:int = 0;
// Initiatives, woo!!!
var right:Number = stage.stageWidth;
var bottom:Number = stage.stageHeight;
// Sets the original screen size, so rezising the window doesn't mess with anything.
function addCell(xcor:Number,ycor:Number,area:Number,speed:Number,breed_rate:Number,life_span:Number,visibility:Number,red:Number,green:Number,blue:Number) {
var cell:cell_link = new cell_link();
cells.push(cell);
stage.addChild(cell);
var redu:uint = red;
var greenu:uint = green;
var blueu:uint = blue;
var hue:ColorTransform = new ColorTransform();
hue.color = ((redu << 16) + (greenu << 8) + blueu);
cell.transform.colorTransform = hue;
cell.x = xcor;
cell.y = ycor;
cell.scaleX = cell.scaleY = area;
cell.alpha = visibility;
cell.timer = 0;
cell.DNA = new Array(area, speed, breed_rate, life_span, visibility, red, green, blue);
}
// Sets a function for the addition of cells to reduce clutter.
addCell(Math.random()*right,Math.random()*bottom,Math.random()*1.5,Math.random()*5,Math.round(Math.random()*90)+70,Math.random()*50+100,Math.random()/2+.25,Math.random()*256,Math.random()*256,Math.random()*256);
// Adds the initial, "eve", cell.
stage.addEventListener(MouseEvent.MOUSE_DOWN, mouseDown);
function mouseDown(evnt:MouseEvent):void {
for (inc = 0; inc<cells.length; inc++) {
var cell:MovieClip = cells[inc] as MovieClip;
if (cell.hitTestPoint(mouseX,mouseY,true)) {
cells.splice(inc,1);
cell.parent.removeChild(cell);
}
}
}
// After trying and failing to make a dynamic "press" event listener for each cell, I gave up and just used a hitTestPoint on every cell to see if they've been clicked.
stage.addEventListener(Event.ENTER_FRAME, enterFrame);
function enterFrame(evnt:Event):void {
for (inc = 0; inc<cells.length; inc++) {
var cell_cur:MovieClip = cells[inc] as MovieClip;
// Specifying each cell for actions.
cell_cur.timer++;
// Timer increment.
cell_cur.x += Math.random()*cell_cur.DNA[1]-cell_cur.DNA[1]/2;
cell_cur.y += Math.random()*cell_cur.DNA[1]-cell_cur.DNA[1]/2;
// Moves cell according to the speed gene in the individual cells DNA.
if (cell_cur.timer%cell_cur.DNA[2]==0 && cells.length<100) {
addCell(cell_cur.x,cell_cur.y,cell_cur.DNA[0]+Math.random()/2-.25,cell_cur.DNA[1]+Math.random()/2-.25,Math.round(cell_cur.DNA[2]+Math.random()*20-10),cell_cur.DNA[3]+Math.random()+20-10,cell_cur.DNA[4]+Math.random()/10-.05,cell_cur.DNA[5]+Math.random()*14-7,cell_cur.DNA[6]+Math.random()*14-7,cell_cur.DNA[7]+Math.random()*14-7);
// Spawns a new cell at the rate the breed_rate gene allows with DNA similar to the mothers.
// The "if" also checks if they're less than 100 cells on the stage so there isn't an overload.
}
if (cell_cur.timer>cell_cur.DNA[3]) {
cells.splice(inc,1);
cell_cur.parent.removeChild(cell_cur);
// Kills cell when the life_span gene says so.
}
if (cell_cur.x<0) {
cell_cur.x = right;
}
if (cell_cur.y<0) {
cell_cur.y = bottom;
}
if (cell_cur.x<0) {
cell_cur.x = right;
}
if (cell_cur.y>bottom) {
cell_cur.y = 0;
}
//Makes sure the cells don't go out of reach and breed where they can't be killed.
}
}
stage.addEventListener(KeyboardEvent.KEY_DOWN, keyDown);
function keyDown(evnt:KeyboardEvent):void {
if (evnt.keyCode == 32) {
average_DNA = new Array(0,0,0,0,0,0,0,0);
for (inc = 0; inc<cells.length; inc++) {
var cell:MovieClip = cells[inc] as MovieClip;
average_DNA[0] += cell.DNA[0];
average_DNA[1] += cell.DNA[1];
average_DNA[2] += cell.DNA[2];
average_DNA[3] += cell.DNA[3];
average_DNA[4] += cell.DNA[4];
average_DNA[5] += cell.DNA[5];
average_DNA[6] += cell.DNA[6];
average_DNA[7] += cell.DNA[7];
}
average_DNA[0] /= cells.length;
average_DNA[1] /= cells.length;
average_DNA[2] /= cells.length;
average_DNA[3] /= cells.length;
average_DNA[4] /= cells.length;
average_DNA[5] /= cells.length;
average_DNA[6] /= cells.length;
average_DNA[7] /= cells.length;
trace("["+average_DNA+"]");
}
}
// Checks to see if you pressed space at which point it will gather the average of all the cells DNA to see how the species is doing as a whole. - Skeik-Sprite
-
Skeik-Sprite
- Member since: Jun. 19, 2005
- Offline.
-
- Forum Stats
- Member
- Level 16
- Game Developer
My suggestion is to add some sort of food source, to simulate natural selection more.
- UltraPulse
-
UltraPulse
- Member since: May. 27, 2005
- Offline.
-
- Forum Stats
- Member
- Level 20
- Blank Slate
I attempted to use a catalyst to speed the growth of the cells, but they don't like the effects. Speedgear, you... >_>
I dont have a signature, stop bugging me.
- UltraPulse
-
UltraPulse
- Member since: May. 27, 2005
- Offline.
-
- Forum Stats
- Member
- Level 20
- Blank Slate
This game could be related to Hitler, what with me killing all the orange pieces... >_>
I dont have a signature, stop bugging me.
- Zerobeam
-
Zerobeam
- Member since: Nov. 3, 2005
- Offline.
-
- Forum Stats
- Member
- Level 07
- Blank Slate
Kinda old, i've seen this before, but then with plants.
There's no big deal here, just some arrays, I like how much work you've put into them, and yes, it's impressive for your age, but then again... it's been done before.
It's not a find, but it's definately a great job! ;)
- Yhtomit
-
Yhtomit
- Member since: Jan. 27, 2006
- Offline.
-
- Forum Stats
- Member
- Level 24
- Animator
At 3/3/08 01:43 AM, Zerobeam wrote: Kinda old, i've seen this before, but then with plants.
Plants aren't on flash, they're real. The impressive thing about this is that it's in flash.
There's no big deal here, just some arrays, I like how much work you've put into them, and yes, it's impressive for your age, but then again... it's been done before.
It's not a find, but it's definately a great job! ;)
Show us one flash that does what this does, and i'll believe that this has been done before.
Anyway, I left the coloured version on while I was at school, and this was the result.
- thedo12
-
thedo12
- Member since: May. 18, 2007
- Offline.
-
- Forum Stats
- Member
- Level 04
- Blank Slate
At 3/2/08 10:53 PM, FiqStudios wrote: Everybody says make a game, but I have no Idea how. Ideas?
Also, I forgot to add the updated script.
WEE!!!
you could make it so its like an rts,
- Yhtomit
-
Yhtomit
- Member since: Jan. 27, 2006
- Offline.
-
- Forum Stats
- Member
- Level 24
- Animator
Hey, Fiq, any more possible changes, or advances on this, like that natural predator thing?
- bornstar
-
bornstar
- Member since: Jan. 2, 2008
- Offline.
-
- Forum Stats
- Member
- Level 02
- Blank Slate
Change your nickname to God - lol
- FlukeDude
-
FlukeDude
- Member since: Sep. 18, 2006
- Offline.
-
- Forum Stats
- Member
- Level 14
- Blank Slate
Would you look at that... it's on the Swfup.com homepage.
They used to call me souled...
- DawnOfDusk
-
DawnOfDusk
- Member since: Feb. 22, 2008
- Offline.
-
- Forum Stats
- Member
- Level 14
- Blank Slate
At 3/16/08 01:15 PM, bornstar wrote: Change your nickname to God - lol
.... Not funny.
Still, extremly well done code, a good time waster.


