Balancing Processes


#1

Continuing a discussion from the Discord:

Me and @tjwhale have been trying to figure out how to reasonably balance Glycolysis and Osmoregulation so that they both fairly limit the size and complexity of organisms lacking a Mitochondrion, Aerobic Respiration Proteins, or any more efficient means of producing ATP. (I’m not sure if there are any)

To summarize, TJWhale has had a couple ideas for how costs for both processes could scale with microbe size: the amount of ATP produced per second by Glycolysis could scale linearly with the amount of Cytoplasm in a cell, while the ATP costs of Osmoregulation would increase quadratically. This would result in an increase and then eventual decrease in net ATP production as more Cytoplasm is added to the cell, until at some point the cell becomes too large to produce enough ATP to completely fuel Osmoregulation along with its other processes and activities.

Below is a graph depicting how net ATP production changes with size:
x = number of hexes in cell, assuming all are cytoplasm
y = ATP cost of Osmoregulation subtracted from ATP production of Glycolysis


I also made a thing on Desmos that allows you to tweak the different values going into the equation, including how many non-cytoplasm hexes a cell has, whether or not they perform a limited form of Glycolysis as well and how efficient that is, how many mitochondria it has and how much energy each mitochondrion produces, etc… https://www.desmos.com/calculator/5tqxojq1i3

His other suggestion was that Osmoregulation could be linear, simply based on the total amount of hexes in a cell, and instead Glycolysis itself would decrease in efficiency as more and more Cytoplasm is added, as in this formula where c is the number of hexes of cytoplasm and n is the number of hexes of non-cytoplasm.
4c - (1/14)(c^2) - c - n
image
Whichever sort of formula we decide on, in my opinion the curve it generates should be rather small and flat, so that cells relying on Glycolysis will be limited to a fairly small size and low ATP production. I believe we also need to be sure that adding a few non-Cytoplasm hexes won’t starve a small cell. Since we eventually plan for our starting cell to be a single hex of cytoplasm, adding a protein to that single hex shouldn’t completely disable Glycolysis.

Along with Glycolysis, we also need to determine how effective Mitochondria and Aerobic Proteins are so that they aren’t too overpowered or underpowered, and we also need to keep in mind how much Glucose and other Compounds all these processes are using, and whether a cell will be able to even collect and hold that much.

What do you guys think? @tjwhale anything to add?


#2

These are all good points, you’re right the start of the game needs to be nicely balanced, it’s pretty complicated!

One thought I had yesterday is whether it’s simpler just to have a cap on cell size. For example each cytoplasm could produce 4 atp/s, each hex could use 1 atp/s, each flagella could use 9 atp/s etc and just have it all linear. Then if the player tries to add too many hexes in the editor it just forbids it. It’s ugly and I think the players will find it an annoyingly artificial way of limiting size, also I find it a bit disappointing as an idea, however it is super simple both to think about and implement.

Another thought I had is about reproduction. So if we had any of the non-linear formulas above then your energy production would change as your cell gets bigger and the organelles split. For example maybe 10 cytoplasm + 10 non-cytoplasm hexes might be viable but 20 + 20 might not be.

We could leave that in as a feature, where pregnancy in a cell is quite a big deal where you slow down a lot and it’s hard to breathe and if you are right at the limit then you can only just reproduce without dying. However it might be quite complicated for new players especially. However maybe it might be really interesting for more experienced players.


#3

Yeah, I agree that artificially capping the size like that isn’t quite ideal, and I feel a size limit should be more clearly due to how the processes work, not because of some limit the devs decided upon. Maybe in the future you could even improve your cell’s Glycolysis a little so that it allows for more complexity (though of course Aerobic Respiration should always be a pretty big improvement)

As for reproduction, if we show cell statistics in the editor we could show idle ATP production for both normal size and about-to-reproduce size, assuming calculating all that every time the cell is updated isn’t too difficult. Perhaps if either of them are in the negatives, the game could give a warning popup when the player tries to save, prompting them to either rethink their design or confirm their changes.
(These are just numbers I made up, but it shows what I mean)

And of course we have to also consider how many compounds these processes are using in comparison to how much the cells can store. For instance, the cell described by the statistics above would use up all of its Glucose (assuming its vacuoles were totally full) in only 12 and a half seconds… oops. In the discord, you also suggested that ATP should act as more of a “stamina” bar, which I thought was interesting and a nice way to differentiate it from Glucose.

Perhaps someone could make a simple prototype that lets you test out and tweak a cell’s processes in a closed environment. I don’t have any experience with programming at all though, but I suppose I could look into it


#4

Yeah nice I agree about the editor, I think the player needs good warnings about when their cell is not viable. I agree that an organic size limit is a good idea.

The relationship between glucose and atp can be set independently from all this. Basically first we can work out how much atp is produced and how much is used by different organelles. Then we can seperately set how much glucose is used to produce that atp. Like if a cytoplasm produces 4 atp/s then how much glucose does that cost? It could be 0.1 or 100.

The stamina bar thing will work well I think if the atp usage to storage ratio is quite high. For example if you produce 4 atp/s when still and use 4atp/s when moving if your storage is size 12 then the bar will empty and fill up in 3 seconds, if it’s size 400 then it will take ages. So again we can set that relationship seperately by scaling the numbers. It’s quite nice that we can do all three of these things independently.

I think it might work well to put the diminishing returns in the energy production forumulae. So cytoplasm and mitochondria have complicated formulae for working out how much atp they produce but then all other values can be simple. For example base movement can cost 1 per hex, flagella can cost 3 atp/s etc. Basically every organelle and just have a single usage value because what will cap your cell size is the diminishing returns in power production, if that makes sense, like it keeps all the complexity in a single place.

Here’s a spreadsheet I made to play around with the numbers. Feel free to edit as I have a backup. Basically you can set how many organelles the cell has and it will tell you how much power it makes normally and how much when it is ready to reproduce. As you can see the small cells work pretty well, you can start as a single hex of cytoplasm and then add two more hexes of whatever you want but then you have to deal with power problems.

Anyway let me know what you think, have a play around with it. The forumlae so far are

cytoplasm: the first makes 4 atp/s and each one after that is 1/7 atp/s less efficient. So first = 4, second = 3.86, third = 3.72 until the 28th which makes 0.14 and they are useless after that.

mitchondria: the first makes 14 atp/s and each one after that is 2 atp/s less efficent. So first = 14, second = 12, third = 10 etc until the 7th which makes 2 and they are useless after that. Mitochondria need to be quite powerful as they need to support the nucleus and they are made of 2 hexes which costs a lot.

I’ve probably made a bunch of errors in the formulae, that’s my signature move :slight_smile:


#5

I think the spreadsheet you made is pretty cool, but I’m not sure I like the way Mitochondria decrease in efficiency, especially not how they (I think) eventually start to drain ATP instead of producing it (I think your cytoplasm does this too), which players might find counter-intuitive, and I’m not sure if there’s really a need to limit the size of Eukaryotic cells like there is for Prokaryotic cells. I also think the “curves” generated by these formulas are a bit too large and steep, with a max size of around 56 hexes for a Cytoplasm-only cell, and the most efficient cytoplasm-only cell being about 10 times as effective as a cell with only one hex. (I’m not really sure if this is a bad thing or not, I guess we’ll have to see how it is in motion compared to ATP storage and movement costs and such… I do think 56 hexes is a bit too large, though.)

I tried to graph the formulas on the spreadsheet but the results I got didn’t quite match what was happening, and I also wasn’t really quite following what was going on with the =IF() statements at the start of the energy production formulas and I’m not quite sure if I copied something wrong or something. Could you clarify what each of the formulas are here? I’m not very good at math, sorry.


#6

I suppose one thing about a 56 hex cell is that you would very rarely see anything that size. As soon as you add any non-cytoplasm hexes it needs to get smaller to support them. I’m cool with lowering the max size if we need to.

I think for gameplay and engine reasons we do need a max size on Eukaryotes, like we can’t have auto-evo making 200 hex cells for example.

I don’t think that there’s a big problem with cells being able to produce too much atp, like what is the advantage of that? If you already produce enough so that you can move indefinitely and produce enough atp to fund that as you go then having more really isn’t a problem. If you have 65 atp storage then producing even 60 a second will still mean it takes 1s for the bar to fill up if it’s drained which is not unreasonably fast for a computer game, for an extreme case. If you make 3 then it will take 20 seconds.

Yeah so the IF statements are just to deal with that problem you identified, that after a certain point the cytoplasm is draining energy which I agree is not quite correct. So the formulae are

If you have less than 28 cytoplasm you get 4c - (1/14)c^2, where c is the number of cytoplasm. If you have more than 28 cytoplasm you just get 56 atp/s which is the max.

Same with mitochondria: if you have less than 7 you get 14m - m^2, where m is the number of mitochondria. If you have more than 7 mitochondria you get 49 which is the max they can produce.

I’m very happy to alter any or all of this as needed.


#7


I just made a little calculator that shows how different values and methods for calculating processes works in real time, since I think it’d be helpful for us to be able to see different numbers in motion without having to put them into the game first. A few processes are missing, I might add them in later.
Let me know if I forgot anything or you’re confused about anything.


#8

I’ve updated and fixed some bugs related to the second method, added configurability for the diminishing values, and added more controls for the compounds plus two presets you can select.
Feel free to mess around with it, experiment with values and see what works well, as well as suggest any changes I should make. Same link should work