Microbe colony Node design

Seeing all the problems everywhere caused by the Microbe Nodes being nested (instead of following the assumption that was followed for a year that each game object has the Translation equal to its position in the world), I think the microbe colony design needs to be changed, it’s so problematic regarding that pure design. And probably accessing the GlobalTransform requires extra matrix multiplications to compute the position, which otherwise would be a simple Vector3 copy, which can’t be that great performance-wise.

So here’s my better design:

  • Only the colony leader is a Microbe object that is attached to the scene properly (and tagged as a microbe)
  • The other cells in a colony use the preview only Microbe class instances as child nodes, or optionally the colony leader also manages creating their visuals for them. It’ll be a bit tricky to toggle a cell on unbind / bind between being a full cell or a display-only one.
  • The physics is handled by the colony leader creating hex collisions for the colony members as well. Sub shape indexes can be used to detect which individual cell was hit (if we don’t want to have colony wide single health bar.

Or maybe in the end it would be simpler to do this:

Here’s a meta issue about this:

Once the design is changed, most uses of GlobalTransform.origin should be safe to remove.

1 Like

Initial thoughts from someone who only briefly read the binding agents changes and noped out:

  • The scariest part for me with this design is the physics of unbinding. It seems like you need to spawn an object into the world while at the same time shrinking one it overlaps with.
  • I wouldn’t use the same preview class for the editor and colony members. Those are two very different roles, and I foresee that causing problems down the line.
  • I like the idea of only calculating the physics of a colony from one place, but I still feel like the notion of a “lead” cell leads to a whole issue with lop-sided colonies where the non-lead cells swing around like a giant sword rather than around a centroid.

I don’t have any real answers to this problem, but I did want to ask if we need colonies to actually consist of separate microbes. I know we have code to add organelles to a microbe, and code to support pretty big microbes. We don’t have code to chop membranes into individual cells, but sometimes I wonder if that would have been a better angle than trying to keep a group of microbes in formation.

That seems much less problematic than currently when it seems that the colony leader cell physically collides and glitches with the colony members even when they are child nodes of it and have collision exceptions with each other.

Having two separate variables to stop the cell from acting like a normal cell seems a waste.
Additionally this design needs to be balanced against writing separate custom logic to generate the cell visuals, which seems error prone to me as we already have the Microbe class capable of generating the visuals for the cell.

It’s even worse with the current design… so this would be an improvement because at least with a single physics body the parts of the colony that overlap with chunks would get pushed away. Now you can just basically put colony members permanently inside chunks due to the way the physics is done for them.

I was originally going to go with this design, but I was busy around the time the binding agents code was started so, we now have the current design we have, and we need to consider what’s the best way forward considering that we have almost working binding agents now.

(I’ll paste a google translate version below)

我对细胞群的想法可能比较复杂. 我觉得在群中的细胞可以被视为AI的另一种逻辑. 就是选定一个Leader之后让其他细胞由AI的另一种逻辑控制其向细胞群对这个细胞的期望点靠近.

My idea of a colony might be complicated (unrealistic?). I think the cells in the colony can be regarded as another kind of logic for AI. The idea is to select a Leader cell and let the other cells move closer to the ideal position of the colony by a different kind of AI logic.

这样可以通过给细胞群中的细胞一个合适的期望点来避免碰撞, 通过AI部分检测Leader状态和方向调整自己, 并且可以用同一套逻辑实现AI间细胞群. 所有的坐标都可以使用绝对坐标. (更新相对坐标为绝对坐标)

In this way, collisions can be avoided by giving the cells in the colony an appropriate ideal position, and the AI part can detect the state and direction of the Leader to adjust itself, and the cell group between AI cells can be realized with the same set of logic. All coordinates can use absolute coordinates. (Updates relative coordinates to absolute coordinates)

I think that approach was tried by @FuJa0815 and determined to be even more problematic than the other options (especially regarding rotation requiring far from the center cells needing to move very fast to the positions they should be at).

We almost have working binding agents, but are we almost to multicellular? I genuinely don’t know the answer to that question, but keep in mind that the code for colonies need to carry us the rest of the way through microbe stage, whatever else that entails. Late in lifecycle compromise is a good idea, early on it can be better to bite the bullet not than have to do work to work around the same limitation in several spots.

1 Like

There’s just a little needed work to add a button to become multicellular, then add a new “body plan” tab for the editor, logic for that, and logic in Microbe to handle the non-disbandable colonies. Overall, I’d rate the work to be less than the binding agents themselves to have the first bit of multicellular stage done.

Multicellular stage will work just fine with the current (or my suggested) binding agents design.

I have tried using various joints provided by the godot engine in a seperate project. Using the Generic6DOFJoint I had some pretty good results, but spinning too fast produced horrible glitches, as well as huge gaps when spinning due to centripetal force. Sadly, I don’t think I have the prototype anymore. The only prototype I have found on my drive is one where the tree looks like this:
grafik
This yielded the best results among all prototypes therefore I’ve decided to use this for the BAs.