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.
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).
In a reaction, chemical can either loose or gain a single chemical group.
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.
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.
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.
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.
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.
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.
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.
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.