Jump to content


Photo

Artificial Chemistry


  • Please log in to reply
18 replies to this topic

#1 sabriath

sabriath

    12013

  • GMC Member
  • 3197 posts

Posted 16 November 2009 - 09:01 AM

First, here is a link that inspired me (after searching for artificial chemistry for use in genetic constructions on neural network solutions):

http://organicbuilder.sourceforge.net/

Simple, unique...just...awesome in my opinion.

Ok, now onto GM stuff. I am calling for help, your help...yes...you. If this stuff interests you, make suggestions here, code, reactions, etc. etc. But first, we need a base:

Download 27.3KB gmk

Brief Description:

Contains 2 objects, the molecule/atom (obj_mole) and the possible bond between 2 of them (obj_bond). The molecule/atom (just going to call it 'mole' from here on) is a circle, so rotations are not an issue. Each mole can be a different type (it could be hydrogen, oxygen, methane, a, b, c, whatever letters), and with each type a different state (a number). It also has an energy value. If you right-click a mole, you effectively "drag" it toward the mouse until you let go of the right mouse button. There is a 4 point collision check that does a poor job at "bouncing" mole's off each other, while at the same time it "shares" its energy with each other (adding them together and dividing evenly), this shows transfer conservation of energy.

The room creation code contains the chemical reaction code, which right now looks like:

ac_bond_rule("a0+a1->a3#a2");
ac_bond_rule("a2+a0->a4#a5");
ac_bond_rule("a3+a5->a7#a6");
ac_bond_rule("a7+a0->a8#a9");
ac_bond_rule("a9+a6->a10#a11");
ac_bond_rule("a11#a8->a12+a4");
ac_bond_rule("a12#a10->a6#a7");

When you left click a mole, it will change it's state to "1", and they all start with type "a" as default. The above code when run for a length of time will continually add "a0" mole's to a cellular membrane mass.

So...this is my WIP. It's crude and barely has any code that is useful, BUT this is where YOU come in. I need help:

* Proper physics (so that mole's properly bounce and properly transfer kinetic energy conserving all forces).
* Better bond coherence (along with physics so that mole's can't accidentally "slip through" but allowing fluid movement).
* Better/faster code maybe? (it's pretty fast code, but there might be an easier way to do it)
* More bonding rules (right now it is only either bond, disbond, or change type with 2, I'd like coupling and decoupling rules too like "x1+y1->z0" and "z1->b0+c0")
* More bonding types maybe (like polar attraction, gravity, etc.)

* As the last proof-of-concept test, a working cell structure as best we can (membrances, enzymes, dna, etc. etc).


The last one will probably be the culmination of everyone who helps out, each piece can be made separately and introduced together. The other things I would like to have done before the end, so that it looks more realistic. I'm not here to take all of your credit, every piece of code, every rule, everything will be documented on who did it, and it will be ALL of our work, and I'll be helping out when I can.

To make a rule, you call "ac_bond_rule" script with a string, the string is a specific format depending on what you want to do (try not to have any spaces in it):

a0+a0&10->a1#a1&0
This is a fusion reaction. It says "if 'a0' mole collides with another 'a0' mole and they both together have at least '10' points of energy, then bond them together and change their states to '1' and '1', take away their '10' points of energy and give them '0' back". Although energy is possible, it is not required (defaults to 0 for both sides of the equation).

a2#a2&20->a0+a0&0
This is a fission reaction. It says "if there are 2 mole's bonded 'a2' and 'a2' with 20 energy between them, break their bond, take away their energy and change their states to 'a0' and 'a0'"

a1#a1&10->a2#a2&0
a0+a1&10->a1+a2&0
I think you're getting the hang of it, the last 2 are above. First is the transform, if 2 moles are bonded, they stay bonded but change their states accordingly (along with energy drain/gain). The second one is ionization, if 2 moles are not bonded and they collide, they don't bond, but their state changes accordingly (this is similar to "passing an electron" in photosynthesis and other chains).

Types cannot have numbers, and only numbers can come after a type, so: "a42802f" is not a valid type:state mole, and "co2" would mean it is type="co":state="2", so be careful when naming moles. You can have very long names and numbers (they are both stored as strings), so "fjdklsahfudishafdshafj372894673284632784632" is perfectly fine.

I hope I get some responses from a mature knowledgeable crowd who is into this kinda stuff at least half as much as I am. *crosses fingers* Here's to hoping.

Edited by sabriath, 07 November 2011 - 04:44 AM.

  • 0

Tutorials of Interest:
* Multiplayer: mine or True Valhalla's

Projects:
* Net39
* My 39dll scripts
* My 39dll lib
* Multiplayer Engine
* Artificial Chemistry

Posted Image

#2 sabriath

sabriath

    12013

  • GMC Member
  • 3197 posts

Posted 23 November 2009 - 10:49 AM

[BUMP] I have updated the link because of WHFF dropping. I hope someone out there is interested in this stuff.
  • 0

Tutorials of Interest:
* Multiplayer: mine or True Valhalla's

Projects:
* Net39
* My 39dll scripts
* My 39dll lib
* Multiplayer Engine
* Artificial Chemistry

Posted Image

#3 Jonlas

Jonlas

    GMC Member

  • New Member
  • 128 posts

Posted 23 November 2009 - 02:13 PM

Some screenshots would be really nice. The game itself sounds quite complex and interesting. I will try it and tell you what i think.
  • 0

Click image to visit our page!
Xbox live gamertag: aKtimelli

#4 sabriath

sabriath

    12013

  • GMC Member
  • 3197 posts

Posted 23 November 2009 - 08:31 PM

Some screenshots would be really nice. The game itself sounds quite complex and interesting. I will try it and tell you what i think.

It isn't a game, it is an experiment into the realm of artificial chemistry.

Posted Image

There's a screen shot. This isn't some shmup or rpg or anything....this is purely for science and advancement.
  • 0

Tutorials of Interest:
* Multiplayer: mine or True Valhalla's

Projects:
* Net39
* My 39dll scripts
* My 39dll lib
* Multiplayer Engine
* Artificial Chemistry

Posted Image

#5 PASSOUT

PASSOUT

    GMC Member

  • GMC Member
  • 563 posts

Posted 23 November 2009 - 08:37 PM

This is brilliant. I love things that teach you something and this is a great contribution. I'm going to look at this more later on today when I get some time.
Btw If you need any sprites I would be more than happy to help. Just great.
  • 0

#6 Obj_Control

Obj_Control

    GM Mentor

  • New Member
  • 2561 posts

Posted 24 November 2009 - 01:14 AM

I'm not getting this. I think these are supposed to be atoms, but their behavior isn't what I pictured. It seems to have great potential, but I have little or no understanding of this, so I'll have to trust the other replies and wait for more. Good luck :).
  • 0

#7 sabriath

sabriath

    12013

  • GMC Member
  • 3197 posts

Posted 24 November 2009 - 07:39 AM

I'm not getting this. I think these are supposed to be atoms, but their behavior isn't what I pictured. It seems to have great potential, but I have little or no understanding of this, so I'll have to trust the other replies and wait for more. Good luck :).

*facepalm* Ok, in chemistry, you know how you have things like:

2H2 + O2 -> 2H2O

?

Well, in artificial chemistry, you have to write the rules yourself, the above equation would be something like:

H0+H0->H1#H2 (this creates H2 molecules, the 0-2 noted are used for state-automation, not actual values)

So in a sea of H0 atoms, you'll end up with something like:

Posted Image

We create the oxygen molecules like this: O0+O0->O1#O2, add it to the field and you have the same as above but with oxygens too.

Now, since bond rules are based on state-automation, we can actually bond more than what chemistry allows because we use all bond types (covalent, charge, etc.). So, to build the water molecule from the sea of molecules, here is a possibility bonding rule setup:

H1+O1->H3#O3 (connect 1 hydrogen that is already bonded to a hydrogen to an oxygen that is already bonded to an oxygen, which would make an H2-H3-O3-O2 bond connection)

O2#O3->O0+O4 (this disconnects the tail end oxygen from the chain, making H2-H3-O4 + O0)

H2+O4->H4#O5 (this connects the leading hydrogen to the oxygen bond at the tail, making a triangle with points H4, H3, and O5)

H3#H4->H5+H5 (this disconnects the 2 hydrogen from each other, leaving only the water molecule H5-O5-H5, which is HOH, or H2O).

Posted Image

There's a chance that there could be interference between 2 molecules bonding, and that's the whole point of this experiment, to come up with artificial chemical rules and fix any interference. As you can see in the picture, there's an H5-O5-H4-H1 chain, possibly have a rule of H4#H1->H5+H0 to disconnect the tail for that error.

The rules are ours to create, we don't even have to make it follow real chemistry, that's why it's fun (at least for me). I would like to mimic it for research, and try and create an artificial cellular creature, but any ideas is welcome.

Edited by sabriath, 24 November 2009 - 07:40 AM.

  • 0

Tutorials of Interest:
* Multiplayer: mine or True Valhalla's

Projects:
* Net39
* My 39dll scripts
* My 39dll lib
* Multiplayer Engine
* Artificial Chemistry

Posted Image

#8 Sn1per809

Sn1per809

    Moderator

  • GMC Elder
  • 559 posts
  • Version:Unknown

Posted 24 November 2009 - 09:03 AM

From what I have read, you aren't "making up" elements, and you are still using Oxygen, Hydrogen etc. So perhaps you could turn your project into somewhat of an educational value. I.E, teach users basic chemistry (or even advance) and perhaps simulate the reactions of different elements when they are bonded on a molecular scale. Maybe these were never your intentions, or not even the aim of the game, I'm just assuming that when you said "Well, in artificial chemistry, you have to write the rules yourself" you meant users will be able to bond any element together.

I'm far from an expert in chemistry (I hate it so much), but just a suggestion. :)
  • 0
Indeed...

#9 LG_Linus

LG_Linus

    GMC Veteran

  • New Member
  • 358 posts

Posted 24 November 2009 - 09:34 AM

This is really nice! :) I managed to do some stuff, I really want to see this project become finished.


P.s, I would take Sn1per's advice.
  • 0
A screenshot of my in development entry for competition 05. Pm me if you want to test it The screenshot is scaled ( although not in the link ) to be less than 150 pixels high.http://img209.images...09/793/gmae.png

#10 sabriath

sabriath

    12013

  • GMC Member
  • 3197 posts

Posted 24 November 2009 - 09:52 AM

From what I have read, you aren't "making up" elements, and you are still using Oxygen, Hydrogen etc. So perhaps you could turn your project into somewhat of an educational value. I.E, teach users basic chemistry (or even advance) and perhaps simulate the reactions of different elements when they are bonded on a molecular scale. Maybe these were never your intentions, or not even the aim of the game, I'm just assuming that when you said "Well, in artificial chemistry, you have to write the rules yourself" you meant users will be able to bond any element together.

I'm far from an expert in chemistry (I hate it so much), but just a suggestion. :)

*sighs* like I said, you don't HAVE to use real chemistry...although *I* would like to have a mimic of real chemistry, you don't have to. This isn't a game, but rather a thought exercise of sorts...a sandbox puzzler. And yes, I meant you can bond any "element" together...but you can name your "element" anything you want. For all I care you could have:

Cheese0+Bread0->Cheese1#Bread1

The last post I made simply had the reaction of h2o...but that's not all you can do with it.

I apologize if my point is lost in translation, but what *I* am trying to do is find people who might like to experiment with esoteric things like CA rulesets and this stuff.
  • 0

Tutorials of Interest:
* Multiplayer: mine or True Valhalla's

Projects:
* Net39
* My 39dll scripts
* My 39dll lib
* Multiplayer Engine
* Artificial Chemistry

Posted Image

#11 -Paix-

-Paix-

    GMC Member

  • New Member
  • 20 posts

Posted 18 August 2011 - 09:42 PM

I checked out your inspiration. Got all the way through to the last challenge took one look at it and was like..... hell no... =P I might go back to it once my head stops hurting. I loved it though. Very challenging. Makes a great puzzle.
  • 0

#12 Jacuu

Jacuu

    GMC Member

  • GMC Member
  • 167 posts
  • Version:GM8

Posted 18 August 2011 - 09:52 PM

You do realize the previous post was in 2009... right?
  • 0

CO-PROGRAMMER NEEDED

Posted Image

Yes... I made those clouds


#13 Nocturne

Nocturne

    Nocturne Games

  • Administrators
  • 25708 posts
  • Version:GM:Studio

Posted 18 August 2011 - 09:59 PM

You do realize the previous post was in 2009... right?


So what? It's an interesting concept! It's nice to see a topic like this bumped occaisionally so that newer members can see other things that GM can do except "Catch the Clown"....Necro posting a Novice Q&A topic is pointless, but a WIP like this is fine.
  • 0

U1FVsm3.png

40799.png


#14 sabriath

sabriath

    12013

  • GMC Member
  • 3197 posts

Posted 18 August 2011 - 10:05 PM

Plus I am an active member, so I am pleased to continue to answer any questions for those interested, no matter how long ago my posts were made.
  • 0

Tutorials of Interest:
* Multiplayer: mine or True Valhalla's

Projects:
* Net39
* My 39dll scripts
* My 39dll lib
* Multiplayer Engine
* Artificial Chemistry

Posted Image

#15 ArcadeMeltdown

ArcadeMeltdown

    GMC Member

  • New Member
  • 17 posts

Posted 19 August 2011 - 12:03 AM

As a biochemistry major in college, I can honestly say this is the coolest f**king idea I've ever seen in a game.
  • 0
Youtube: http://www.youtube.c...eArcadeMeltdown
Soundclick: http://www.soundclic...?bandID=1196055
Add me on facebook!

Doing music composition for all genres of indie games.

HIT ME UP


#16 Rossay

Rossay

    GMC Member

  • GMC Member
  • 78 posts
  • Version:GM:Studio

Posted 19 August 2011 - 12:43 PM

As a chemical engineer, I find this interesting. While I see the uses of this "artificial chemistry" I think its potential lies in switching to real atoms and using it as a learning tool OR to change it to real atoms & bonding rules so you could use it a chemical process simulator to identify any unexpected or unwanted products that might be produced. Having said that, it would require a lot of time and chemistry knowledge to design something which could do that.
  • 0

#17 sabriath

sabriath

    12013

  • GMC Member
  • 3197 posts

Posted 19 August 2011 - 06:37 PM

As a chemical engineer, I find this interesting. While I see the uses of this "artificial chemistry" I think its potential lies in switching to real atoms and using it as a learning tool OR to change it to real atoms & bonding rules so you could use it a chemical process simulator to identify any unexpected or unwanted products that might be produced. Having said that, it would require a lot of time and chemistry knowledge to design something which could do that.

If I recall correctly, I had implemented "joule" energy transfers into the formula in the last build...so if you have the chemsheets, I'm sure it can be put in. If the last build didn't have it, I can probably find it floating around on my hdd somewhere.
  • 0

Tutorials of Interest:
* Multiplayer: mine or True Valhalla's

Projects:
* Net39
* My 39dll scripts
* My 39dll lib
* Multiplayer Engine
* Artificial Chemistry

Posted Image

#18 sub

sub

    EVIL GENIUS

  • GMC Member
  • 1905 posts
  • Version:GM6

Posted 08 September 2011 - 02:49 PM

it's strange.. i was thinking about a concept like this some months ago (reminiscing on the SETI at home project idea)

if this idea and others like it were fleshed out years ago, todays game players could be actually researching important data while playing games O_O

you have to make this more accessable to dullards like myself though (uhh, make a 'game' out of it, that's the problem i had.. wrapping my head around the initial concept which you seem to have mastered?)

thanks for contributing something to civilization before it destroyed itself :)
  • 0

#19 sub

sub

    EVIL GENIUS

  • GMC Member
  • 1905 posts
  • Version:GM6

Posted 30 January 2014 - 04:24 PM

 

Necro posting a Novice Q&A topic is pointless, but a WIP like this is fine.

cool :)


  • 0