Code center > Suggestions
Metabolism
shvarz:
Once again we come back to this. It's been discussed so much, everyone is sick of it and just wants to see something done. I think we are almost there. What I'm describing below is pretty much a completely designed system that will go this way into DB version 3, unless some real issues come up in this discussion.
Nums is up to date on this and we discussed it in details. He thinks the system is do-able.
NOTE: The system described below is not meant to be a replication of real physical or chemical laws. It is just a general system designed for two purposes: a) to allow more diverse energy storage compartments and B) provide possibility of food specialization.
NOTE 2: If you have something to add to the proposed system, please don't! :) Seriously though, please concentrate on evaluating the current system for faults. We know it's not complete and we know things can be added, but let's get the minimal system up and running before we add something else on top of it.
OK, let's go.
PART 1: Chemicals
Chemicals will be represented as 8-strings of 1 and 0. One means a chemical has certain group, 0 - does not. There are total of 256 chemicals.
--- Code: ---Example: 11111111 has all of the possible groups, 00010000 has only one group, 00000000 has none of the possible groups (but is still considered to be a chemical).
--- End code ---
In a reaction, chemical can either loose or gain a single chemical group.
--- Code: ---Example: chemical 11110000 can lose one of the 4 groups it has, becoming 11100000 or 11010000 or 10110000 or 01110000. Or it can gain one of the missing groups becoming 11111000 or 11110100 or 11110010 or 11110001.
--- End code ---
Through chemical reactions each chemical is connected to 7 other chemicals. Therefore the whole metabolism can be viewed as 8-dimensional matrix with two values in each dimension.
We don't care where the individual groups are coming from or where they go, we don't keep track of them. We assume there are tons of them in the environment.
PART 2: Energy
Each chemical will be assigned a certain energy value. This value will not correlate with any chemical groups being present or absent. One option will be for program to pick these values from a certain range at random. Another option is for user to define what energy values correspond to each chemical.
PART 3: Equilibriums
Let's take a single reaction where chemical A is converted to chemical B (written as A<>B). An equilibrium state for this reaction is such that the total amounts of energy are equal on the left and on the right.
--- Code: ---Example: Let's say that energy of A is 1 and energy of B is 10. Then if a bot has 11 molecules of and B total, then equilibrium is when 10 molecules are in state A and 1 in state B; 10 A=1 B. Total amount of energy is equal on both sides.
--- End code ---
When chemicals are present in equilibrium, bots can't get any energy from them. Even though there is a high-energy compound B in the example above, it cannot be split to produce energy.
PART 4: Reactions
Energy can be extracted by a bot if two chemicals are not in equilibrium. Now let's consider two possibilities, which are going to be treated differently.
A. The equilibrium is shifted toward high-energy compound (the total energy of high-energy chemical is higher than total energy of low-energy chemical). This results in high-energy chemical being converted into low-energy chemical. The difference in energy is given to bot as nrg to spend. This happens until both chemicals come to equilibrium.
--- Code: ---Example: Consider A<>B reaction. Bot has 1 molecule of A (energy=1) and 10 molecules of B (energy =10). The system is not in equilibrium, total energy on the left is 1 and total energy on the right is 10x10=100. To bring system to equilibrium 9 molecules of B (energy=9x10=90) are converted into 9 molecules of A (energy=9x1=9). The difference in energy 90-9=81 is given to bot as nrg. At the end bot has 10 molecules of A and 1 molecules of B. The system is in equilibrium. No more energy can be extracted.
--- End code ---
B. The equilibrium is shifted toward low-energy compound (the total energy of low-energy chemical is higher than total energy of high-energy chemical). This results in low-energy chemical being converted into high-energy chemical. The energy for the conversion comes from complete utilization of low-energy molecules. No energy is given to the bot to spend, but it gains a high-energy molecule, which it might spend at a later time.
--- Code: ---Example: Consider A<>B reaction. Bot has 110 molecules of A (energy=1) and only 1 molecule of B (energy=10). The system is not in equilibrium, total energy on the left is 1x110=110 and total energy on the right is 1x10=10. To bring system to equilibrium, energy of 50 molecules of A is completly utilized (the molecules are destroyed) to create 5 molecules of B. Bot gains no energy. The final equilibrium is 60 molecules of A and 6 molecules of B. No more energy can be extracted.
--- End code ---
NOTE: Please don't tell me that laws of conservation of matter and/or energy are broken. Living organisms are not closed systems and can loose energy and matter as much as they care to. As long as they don't gain energy from nothing we don't care what happens to them.
PART 5: Enzymes
For each chemical reaction we have two enzymes, one for forward reaction and one for reverse. Enzymes affect the rate at which two chemicals move to equilibrium. So, in essence it is just a multiplier for the amount of chemicals being processed during a single cycle. The grand total of all rates for any given bot remains constant. Mutations that increase the rate for any given reaction, automatically decrease the rates of all other reactions and vice versa.
In general enzymatic rates cannot be controlled from bot's DNA (see Control from DNA for more details).
Part 6: Interaction with environment.
Each chemical withn a bot will also try to achieve the equilibrium with its concentration in the environment. The equilibrium here is reached when amount of chemical inside a bot is equal to the amount outside. For each chemical there will be a single rate constant that will define how quickly the equilibrium is reached (in both directions). The range for these constants will be from 0 (no secretion or adsorption) to 1 (immidiate equilibration with environement).
Part 7: Energy flow.
The energy flow within a bot will be a flow toward a complete equilibrium of all 256 chemicals in its body. Nums thinks he can program it and I just have to trust him on that.
The whole energy flow in a simulation will depend on a energy/matter gradient. The gradient will be created by giving large amounts of a certain chemical to veggies (similar to how feeding is done in current version). It can be any chemical, even one with low energy, because the matter gradient will drive formation of high-energy chemicals, which can then be broken down to release energy. Ideally we would want to give them a chemical with intermediate energy value, so that some of it can be immediately broken to release energy and some can be turned into high-energy storage chemicals.
It can be predicted that eventually the environment will get saturated with chemicals that none of the bots in the sim are able to utilize. Two approaches can be taken. One - allow bots to die in their own shit, if they can't evolve to utilize it. Two - clean up the shit for them evry now and then.
Part 8: Physical properties.
At least some (and maybe all) chemicals will be assigned certain physical qualities, such as mass, volume, toughness, sliminess etc. These will replace the current body, shell and slime fnctions. If a bot wants to be tougher to resist incoming shots, it has to evolve to channel energy onto creation of chemicals with higher toughness rating. If a bot wants to run quickly, then it has to avoid accumulation of chemicals with high volume.
Part 9: Control from DNA
As a rule we are not going to encourage and even allow control of enzymatic functions from DNA. After all, if I could willfully tell my enzymes to create muscle from beer that I drink, I'd be one tough guy :)
BUT, we will allow some access to enzymatic rates from DNA. There will be two new memory locations: .open and .close. Bots will be able to store a single number into each, essentially fully opening and fully shutting down one reaction per cycle.
Ok, I think I'm done here If I missed something, I'll edit the post later.
Numsgil:
About 60% of the above is adapted from here.
Technical detail:
-----------------------
There may be some technical issues we would need to address with 256 possible substances. Like the fact that the number of possible interactions between all substances is 2 * 256! = 1.7156355506856853082381645433625e+507. I'm confident I see how to resolve most of these issues. But we may modify the number of substances (say, to 128) depending on how feasible this all is...
--- Quote ---The energy flow within a bot will be a flow toward a complete equilibrium of all 256 chemicals in its body. Nums thinks he can program it and I just have to trust him on that.
--- End quote ---
I do indeed think I can do it, but I want everyone to know it's not trivial. There are some max flow/min flow algorithms I'm going to need to use, as well as probably some matrix math and numerical relaxation techniques...
Anyway, if you have a hard time figuring out how to do it, don't think you're stupid. It really is hard ;)
--- Quote ---Part 9: Control from DNA
As a rule we are not going to encourage and even allow control of enzymatic functions from DNA. After all, if I could willfully tell my enzymes to create muscle from beer that I drink, I'd be one tough guy :)
BUT, we will allow some access to enzymatic rates from DNA. There will be two new memory locations: .open and .close. Bots will be able to store a single number into each, essentially fully opening and fully shutting down one reaction per cycle.
--- End quote ---
This is sort of where shvarz and I had trouble agreeing exactly. I do think that allowing the DNA to control 256 different substances (and the corresponding 2 * 256! reactions :wacko: ) isn't a good idea.
But some control is probably a good idea.
So I was thinking the DNA has the same controls it does now, more or less, and a "subconcious metabolism" DNA is created that handles the finer details of metabolism. Think of it like a mitochondria.
In programming terms, this is simple encapsulation. DNA communicates with the "mitochondria" DNA, which communicates with the actual workings of metabolism. Users and evolution could modify the metabolism DNA much like regular DNA.
The mitochondria would have absolute control over the metabolism, much finer than just open or close. That helps keep the DNA abstract, while allowing the bot to absolutely control its metabolism.
That's my thinking anyway. Like I said shvarz and I weren't in agreeance on this point. (I believe he viewed it as a later modification perhaps, and not part of the core control.)
--- Quote ---Part 8: Physical properties.
At least some (and maybe all) chemicals will be assigned certain physical qualities, such as mass, volume, toughness, sliminess etc. These will replace the current body, shell and slime fnctions. If a bot wants to be tougher to resist incoming shots, it has to evolve to channel energy onto creation of chemicals with higher toughness rating. If a bot wants to run quickly, then it has to avoid accumulation of chemicals with high volume.
--- End quote ---
I agree with mass, volume, sliminess, and shell. I disagree on the point of Body, since body represents some intense molecular engineering by the bots that can't be represented as simple substances. Closer to groupings of substances IMO. Anyway, minor point... (Again I think shvarz wanted to save something like this for a later edition...)
shvarz:
Haha, Nums got his math wrong! :lol:
The number of interactions is not going to be 2^256. Remember, each chemical can turn only into 8 other chemicals, by changing one of its 1 or 0 values into another. So the total number of reactions is 8x256= 2048.
if anything, we can pump up the number of chemicals...
Numsgil:
Hehe, have I mentioned that I'm only in theoretical math this semester? The kind where you never see real numbers. B)
Endy:
--- Quote ---So I was thinking the DNA has the same controls it does now, more or less, and a "subconcious metabolism" DNA is created that handles the finer details of metabolism. Think of it like a mitochondria.
--- End quote ---
Would it still be possible to have some affect on the different resouces?
I was thinking of allowing the bots to reverse the mk/str (X resource) interactions and liberate some energy. This would be mainly allow the bots to have some gain from an enemy blasting their mkshell.
It would also allow the immediate creation of a venom tie feeder. Hopefully allowing more feeding diversity in sims would help out evolution.
Would this system include any sort of combined elements? Like if you combined shell and slime you could make something that blocks both.
Navigation
[0] Message Index
[#] Next page
Go to full version