New membrane shapes

Most membranes are fluid and end up having simple blob shapes. In Thrive, this is implemented as a mesh that “hugs” the organelle layout.
In reality, though, only lipidic membranes are fluid and end up having a blob shape. Cells with rigid cell walls do not exhibit this for obvious mechanical reasons. In Thrive, we do have these kinds of cell walls: cellulose, chitin, calcium carbonate and silica. They still use the default shape generation algorithm and graphically they look the same except for the texture.

New membrane shapes

My idea is to implement different shape generators for each type of membrane. The reason for this is not only just to have more realistic cell shapes, but also because they look beautiful.

For example, we can have diatom-shapes for silica membranes, that can be implemented by using procedural techniques.

A prototype

I’ve already implemented an early prototype as a concept by using the Superformula.


Implementation

This algorithm generates a parametric curve and then adapts it to the organism, instead of just hugging the organelles. The algorithm is yet to be refined, and requires careful handling of the physics collision shape, due to commonly having concavities.

What do you think?

I wanted to have a more general game design feedback from you, to understand how to proceed from here.

  • Do we need to implement more complex shapes, or shapes different than the subset generated by the Superformula?
  • Do we need different pipelines/curves for carbonate, chitin and cellulose?
  • What are, if any, the constraints to this?
  • Should the shape influence, even slightly, MP cost and bonuses?
  • To continue the last question, shapes have a relevant effect on homeostasis in real life. Should it reflect those in-game?
5 Likes

This has been basically my main concern since seeing the first images about this: how do these new shapes work in the physics engine and the gameplay side of things.

2 Likes

My idea was to feed a simplified, convex shape into Jolt. The generated membranes shouldn’t be too concave anyways, so we can approximate the collision shape with either:

  • A convex hull
  • An average convex shape

The biggest thing about this would be that the collision shape of cells with these cell walls will be slightly larger than cells with lipid membranes. This is kind of inevitable to prevent organelles from popping out of the membrane, even though the organelle room constant could be lowered for such membranes. It would make sense though as in real life these cells do have thicker walls.

3 Likes

I really like the idea! More diversity in shapes would really help with the visuals I think. And even make it easier to recognise which cells have which membranes for gameplay purposes (though textures are definitely also a factor in that).

As for your specific questions:

For silica walls (diatom inspired) I don’t think we need more complexity than what you’ve already shown. In fact, I think your second example might already be more complexity than we strictly need? If I look at photos of diatoms, what strikes me the most is that they have very sharp lines (as in defined, not necessarily “spiky”), instead of being blobby. Almost “geometric”.

Diatoms


So, that’s not necessarily even very complex shapes, more so “sharply defined” and “smooth”.

I would say so. The diatom shapes don’t necessarily fit with these other types.

Calcium Carbonate:

I think in theory these could be formed in the same shape as diatom frustules? But that’s not entirely what we see in nature. In the most common form, coccolithophores:

Coccolithophores

So that’s just spherical, more-so with a unique texture (To be fair, circular is also a diatom shape. Though most of those are “discs” rather than “spheres”). But there are also others, like Foraminifera:

Foraminifera



…And some of those actually look similar to the shapes of diatom frustules. So maybe just a big texture difference? I wouldn’t be against just taking a different base shape to make them distinct though.

Chitin/cellulose:

(I think these are similar enough to equate). The big word here is turgor: instead of carefully regulating osmotic pressure, cells with cell walls can just leave things unbalanced, with water always trying to “get in”. This creates constant outward pressure from the cell, held back by the pressure from the cell wall. But unlike mineral walls, cellulose/chitin have some flex to them and can deform under the pressure. Which ends up with the cells looking either like spheres (again) or like boxes, sometimes “bloating” outward under the pressure:

Chitin


Cellulose




So that’s in my opinion quite different from the geometric shapes of diatoms.

As mentioned already, the collision shapes should not deviate too much.

And another thing: the hex design of the cell should definitely still have an effect on the shape.

I think this is already covered by the membrane types themselves? I don’t think the shape makes enough of a gameplay difference to put additional costs or benefits on it.

Right now, these membrane types specifically reduce osmoregulation cost a lot, so I don’t think this would make enough of a difference? In any case, I don’t think we want an automatically generated shape to have a major impact.

1 Like

Thank you for your considerations. Here’s my thoughts:

The second example is a result of the first shape (triangle) mixed adequately with the cell layout membrane wrap. This was necessary to make the organelles stay inside the cell and not pop somewhere on the sides. Right now, the membrane is calculated roughly as:

smoothmax(superformulaShape, blobShape)

to ensure the organelles stay strictly inside the membrane.
Of course, this makes the approach slightly unrealistic, because it it doesn’t look like a diatom anymore, so it needs to be refined. My idea is to use two (currently unused) superformula parameters: a and b. These are not used because they sometimes produce shapes with extremely long protrusions. This is more of a mathematical problem rather than a programming one, as I need to figure out how to smoothly clamp those long “legs” without breaking everything too much. Some possible solutions are (non-exclusive):

  • Use a blob-dependent sigmoid gate that cuts off the bulges.
  • Use a blob-dependent sigmoid gate that enhances the effect of the superformula near the hex layout (though this might provide results similar to what we already have now).
  • Use simple polygons/shapes to wrap around the organelles that can be mixed with the superformula.

So, returning to your thought, the complexity does not arise from the superformula itself, but from the organelle layout and the current mixing algorithm.

The shapes I see in the images you posted are mostly covered by the superformula alone.

Yes, I believe the difference here would be mostly done by a good texture, maybe procedurally generated as well.

This is probably the biggest challenge, because as I said before, the issue stays in consistently mixing the layout with the shape.

My biggest concern here is that to keep the shape true to the underlying parametric curve, is that the membrane itself becomes bigger than the current blob shape, even double in average radius. This came from my first tests, where I tried to adapt the shape simply by ensuring the size of the parametric curve was big enough to wrap all organelles. Again, here I need to figure out the math to make this possible.

For the other couple answers I find myself agreeing with you.

1 Like

I tried out the current version from GitHub. Seems like it is currently only applying the “star” shape, deformed to fit whatever your design is. The plan is to actually have different products of the superformula used, correct?

I won’t pretend to understand the mathematics, but I figured the solution would be to:

  • Take the editor hex layout.
  • Use that to generate the superformula shape that can most easily fit the hex design inside it. (Including potential “rotations” of the shape)
  • Scale, and if necessary rotate and/or stretch along one dimension the shape so that all hexes can just fit inside.

For example, a roughly triangular design would get the triangle shape, a rectangular design would get a stretched version of that square shape, etc.

The example shapes I was looking at

So it meets the requirement of “hex design determines the shape”, but by determining which superformula shape is used, not by applying blob deformation to fit. I think that would be preferable so that we can have the more “pure” superformula shapes.

Yes. You can currently modify the parameter directly in the code (line 52 in MembraneShapeGenerator.cs). As I said before, the a, b parameters of the superformula are not implemented.

This requires some complex fitting method. Unfortunately, the superformula is not analytic so it will probably require some sort of montecarlo method to have a satisfactory result. That should still be doable in principle but it definitely increases the complexity of the code.

These don’t use the a, b parameters so you can already try them, except for the decimal ones because I’m forcing the usage of integers to avoid discontinuities or other weird behaviours.

To conclude, your idea is absolutely valid but even more complex in terms of both math and algorithms.

2 Likes