Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

The 20 Line Challenge / [DBP] Bacteria

Author
Message
Rapidrory
14
Years of Service
User Offline
Joined: 21st Aug 2009
Location:
Posted: 28th Dec 2010 20:13 Edited at: 29th Dec 2010 01:04
A little bacteria simulation in 12 lines

You start with one bacterium which will divide up to a maximum of 1000 bacteria. You can feed them by clicking anywhere on the screen. The size of each bacterium corsponds to how hungry it is, and the colour indicates it's age.

EDIT: Forgot to metion but it does use the Matrix1 Utility Plug-in. It's not as an essential part of the code, so you can just replace it if you need to.

Compressed



Uncompressed



There is no such thing as "Too Fast!"
29 games
18
Years of Service
User Offline
Joined: 23rd Nov 2005
Location: not entirely sure
Posted: 30th Dec 2010 00:43
That's quite fun, I like it.
Rapidrory
14
Years of Service
User Offline
Joined: 21st Aug 2009
Location:
Posted: 17th Jan 2011 22:44 Edited at: 17th Jan 2011 23:28
I've changed the code now so that the bacteria evolve depending on how its set up. It basically works by adding abnormalities to the variables when a bacteria reproduces, so if that abnormality helps it survive, it lives to pass it on when it divides.

The challenge is to get the starting parameters as low as possible and still get a stable colony. You now no longer have to manually place food or restart if the colony dies, thats all automatic.

If you leave it running for a while you can get some quite intresting changes

(The parameters that can be changed are in the code itself, and not set in-simulation, so you have to recompile to change them)



This style of simulation would actually be useful for the solving of a variety of problems... like i've got to have a finished working design for a race car by tommorow so we can start work on it on thursday... if i made a simulator like this (but alot more complex!) so it could handle a whole load of variables, just set the environmental constants, load a rough model, run the program and after a while you get a high performance car! (or you would do if i could code to that level...)

There is no such thing as "Too Fast!"
n008
17
Years of Service
User Offline
Joined: 18th Apr 2007
Location: Chernarus
Posted: 21st Jan 2011 17:57
Yeah, evolution is an awesome thing like that.

"I have faith, that I shall win the race, even though I have no legs, and am tied to a tree." ~Mark75
TheConnorian
14
Years of Service
User Offline
Joined: 18th Dec 2009
Location: I\'m in ur game, pwning ur noobs
Posted: 31st Jan 2011 01:19
dude i would love to play this but i keep getting errors with the fill circle bit.
Rapidrory
14
Years of Service
User Offline
Joined: 21st Aug 2009
Location:
Posted: 1st Feb 2011 20:18
just change the 'fill circle' bit to 'circle' and then use ink comands to set the colour..

There is no such thing as "Too Fast!"
n008
17
Years of Service
User Offline
Joined: 18th Apr 2007
Location: Chernarus
Posted: 11th Feb 2011 19:29
Interesting bug: After running this for about 18 hours (By accident) it crashed with an Image error on line 227. 0.o

"I have faith, that I shall win the race, even though I have no legs, and am tied to a tree." ~Mark75
enderleit
16
Years of Service
User Offline
Joined: 30th May 2007
Location: Denmark
Posted: 15th Feb 2011 15:50
That's pretty cool... I made an Ant simulator once, but the graphics we're really crappy compared to this...

Rapidrory
14
Years of Service
User Offline
Joined: 21st Aug 2009
Location:
Posted: 17th Feb 2011 21:52
@n008

I think thats due to the number of bacteria. if you increase 'Mcnum' at the beggining it should solve that problem.

There is no such thing as "Too Fast!"
sadsack
20
Years of Service
User Offline
Joined: 27th Nov 2003
Location: here
Posted: 20th Feb 2011 01:58
would like to see it but don' have the plug in.
it sound neat
renny

Life is not fair, so deal with it.
http://www.gusroundtable.com/
xilith117
14
Years of Service
User Offline
Joined: 1st Nov 2009
Location:
Posted: 20th Feb 2011 19:02
hey thats pretty awsome! good job!

29 games
18
Years of Service
User Offline
Joined: 23rd Nov 2005
Location: not entirely sure
Posted: 22nd Feb 2011 00:13
I really like this.

It might be quite cool to have the food grow, so they would act like plants it that respect, and then the bacteria as animals that feed off the plants.

I've also fancied doing something like predators and prey.

I might have a go at something like that myself.

@sadsack, I don't have any plugins and just changed the fill circle command to a normal circle command (like Rapidrory mentioned a few posts back) and it works fine.
sadsack
20
Years of Service
User Offline
Joined: 27th Nov 2003
Location: here
Posted: 22nd Feb 2011 02:19
Hey, I like it, do you mind if I play around wirh the code.
renny

Life is not fair, so deal with it.
http://www.gusroundtable.com/
Rapidrory
14
Years of Service
User Offline
Joined: 21st Aug 2009
Location:
Posted: 23rd Feb 2011 12:56
@sadsack, Go for it, I always like to see other peoples ideas

There is no such thing as "Too Fast!"
sadsack
20
Years of Service
User Offline
Joined: 27th Nov 2003
Location: here
Posted: 24th Feb 2011 02:04
thanks

Life is not fair, so deal with it.
http://www.gusroundtable.com/
Rich Dersheimer
AGK Developer
14
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 8th Mar 2011 23:57 Edited at: 9th Mar 2011 01:24
Cool! I made a different looking bacteria. Here's a demo of the way it looks. I'd like to combine it with your logic/AI and see how it behaves.





EDIT: Woah! Both sets of code make my home computer freak out! They ran okay at work (WinXP) but totally spaz out my display on my home Vista system. Ouch!

Attachments

Login to view attachments
Rich Dersheimer
AGK Developer
14
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 9th Mar 2011 21:46 Edited at: 9th Mar 2011 21:52
Here's what I came up with - it's pretty simple. I'm guessing it could be compressed to 20 lines or less. Oh, and you MUST have IanM's matrix plugin to compile, I use his fill commands.





Attachments

Login to view attachments
Rapidrory
14
Years of Service
User Offline
Joined: 21st Aug 2009
Location:
Posted: 10th Mar 2011 23:13
wow, that looks awesome Rich! unfortunately texture backdrop is now an obsolete command apparently, but still quite cool!

There is no such thing as "Too Fast!"
Rich Dersheimer
AGK Developer
14
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 11th Mar 2011 00:44
Thanks!

Quote: "unfortunately texture backdrop is now an obsolete command"


Nah, it was put back in for Dark Clouds with upgrade 7.4, however SCROLL BACKDROP was taken OUT, for some unexplained reason.

Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 25th Apr 2011 14:20
I found Rich's picture so cool, I started working on another type of amoeba-like thing you might be able to use.

IBOL
Retired Moderator
20
Years of Service
User Offline
Joined: 30th Mar 2004
Location: @IBOL17
Posted: 4th May 2011 08:02
hey rich, could you compile and package up a .zip for us?

i'm looking at this today and it is awesome!
you have started a buzz, rapidrory!
(and it's so captivating to watch...i let it go 15 minutes...
longer than i probably play most games i try out!)

Rich Dersheimer
AGK Developer
14
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 4th May 2011 17:34 Edited at: 4th May 2011 18:33
Quote: "hey rich, could you compile and package up a .zip for us?
"


I just tried cutting and pasting from my above code snippet, and it doesn't work at all. Has something changed with the way the forum code snippets works?

Anyway, here's the .exe, in a .zip file.

Attachments

Login to view attachments
IBOL
Retired Moderator
20
Years of Service
User Offline
Joined: 30th Mar 2004
Location: @IBOL17
Posted: 4th May 2011 22:09
thanks, rich, i don't have any of the plugins mentioned,
so that helps.
your version looks beautiful, but i can only keep
one bacteria alive at a time (or one group of them)

Rich Dersheimer
AGK Developer
14
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 4th May 2011 22:47
@IBOL - thanks! Mine's not really a game or anything, just a demo of how I made the amoeba graphic.

IBOL
Retired Moderator
20
Years of Service
User Offline
Joined: 30th Mar 2004
Location: @IBOL17
Posted: 6th May 2011 17:17
i'm working on my own version now. thanks for the inspiration.

Rapidrory
14
Years of Service
User Offline
Joined: 21st Aug 2009
Location:
Posted: 7th May 2011 01:06
Glad to see it being appreciated.

Can't wait to see what you make from it IBOL, having been a great fan of your previous games (i spent hours playing space conflict and random realms!)

Thanks for the .exe Rich, it was looking a bit plain without the background

There is no such thing as "Too Fast!"
IBOL
Retired Moderator
20
Years of Service
User Offline
Joined: 30th Mar 2004
Location: @IBOL17
Posted: 8th May 2011 08:37
here's what i have so far.
it is similar to what i've seen here, but multiple "food's" are placed randomly,
and i use procedurally generated "bacteria" pictures.

here are some of the rules that apply:


the whole thing is full of remmed out stuff and random thoughts,
since it's been designed at the same time as being programmed
(not the best way of doing things!)

you can click on a particular bacteria to see its information.
hold controlkey to make the bacteria disappear.
(in case you need to read stuff)



Rapidrory
14
Years of Service
User Offline
Joined: 21st Aug 2009
Location:
Posted: 12th May 2011 00:00 Edited at: 12th May 2011 22:52
Looking good so far IBOL.

I had a look at making it into a game also, and here is what i've come up with as a sort of prototype. it's pretty basic atm and has a few glitches, but its quite interesting. It's kinda a bacteria herding sort of game where you herd them by drawing fences with the mouse (you can remove the fence again with right mouse button)... you'll see what i mean...



I would have added more to it but i'm supposed to be revising for A levels atm so spare time is very limited... any ideas welcome

There is no such thing as "Too Fast!"
Rich Dersheimer
AGK Developer
14
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 12th May 2011 00:54
That was cool. One thing you might change is, at the end, the white letters were not very readable over my blockade. Maybe grey blocking sprites?

And how about if the blocking sprites have a limited lifespan, so you have to scramble when your fence starts to fade away?

Rapidrory
14
Years of Service
User Offline
Joined: 21st Aug 2009
Location:
Posted: 12th May 2011 22:52 Edited at: 12th May 2011 22:55
cool idea on the fading!

The aesthetics of the whole thing is going to be changed at some point and the ending will be replaced with more levels or similar...
This was only a proof of concept so that ending screen won't be there on the main game. But point accepted, i had tried vaguely to do something about it but i wasn't too concerned...

There is no such thing as "Too Fast!"
IBOL
Retired Moderator
20
Years of Service
User Offline
Joined: 30th Mar 2004
Location: @IBOL17
Posted: 13th May 2011 17:08
well, mine is still a simulation, and not a game,
but it's really interesting (at least to me) how the life-forms evolve over time.
you can even get a graph of the first 1600 seconds of a run by hitting shift.
i borrowed a lot from the ideas here, and came up with something i'm happy with.

Rapidrory , i tried yours, and it's a neat idea. i got them all on one side, but nothing happened. must have been the wrong side.
you should continue with it. fading fences would be a good idea.




Rapidrory
14
Years of Service
User Offline
Joined: 21st Aug 2009
Location:
Posted: 13th May 2011 19:02 Edited at: 13th May 2011 22:34
I like the graphics IBOL, very cool! motion seemed a bit mechanical but otherwise it looks pretty awesome.

I've just added the code for the fading, i haven't modded anything else yet.

And IBOL, It does sometimes not register when you've one, I've fixed that and a few other bugs now.



EDIT:
Having looked around some old files i found the bit of code that inspired the whole bacteria thing in the first place. I was trying to make AI that would learn from it's experiences about it's environment. I thought i would post it as it has some interesting concepts.

The environment in this code was very simple, grey blocks are rock, red rocks are fire. If the AI touches rock it remembers where it is and avoids it. If it touches fire it runs away and doesn't go near it again.

If it gets stuck or you want to move it somewhere it follows the mouse when you click the mouse button. To see the remembered objects you press space.



There is no such thing as "Too Fast!"
Mudbud Productions
12
Years of Service
User Offline
Joined: 1st May 2011
Location: Cloud 9
Posted: 20th May 2011 03:42
wow, you have talent! That is really cool

Always have your stuff when you need it with @Dropbox. 2GB account is free! http://db.tt/Zo04mva
You get 250MB extra by using the link ^^
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 21st May 2011 23:33
IBOL, your variable "sgn" conflicts with the Matrix1 dll, so I changed it.

I had a go at creating an amoeba:
http://forum.thegamecreators.com/?m=forum_view&t=184427&b=6

Rapidrory
14
Years of Service
User Offline
Joined: 21st Aug 2009
Location:
Posted: 23rd May 2011 18:05
Phaelax, I saw that, looked pretty cool

I assume it would be possible to integrate into my bacteria program?
I haven't had a chance to look at your code closely yet.

Might give it a go when I've finished with my exams.

There is no such thing as "Too Fast!"
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 23rd May 2011 18:12
I'm not sure what the performance would be like with multiple amoebas.

Login to post a reply

Server time is: 2024-04-20 00:45:39
Your offset time is: 2024-04-20 00:45:39