# Revisiting engulfment mechanics

So this is an attempt to consolidate concepts and adding my own thoughts regarding ways to revamp the engulfing mechanics and how it is represented in the game as of the current version (0.5.7) but I’ll focus more about ingestion in this post.

There has been previously suggested idea for bounding engulfed objects inside an engulfer cell. I think this is pretty good detail to add, but this warrants a sizable rework of the engulfment mechanics. For this to make sense in game I think we need to change how ingestion works, the idea is to separate the two processes, that is the engulfment (ingestion) and digestion, so that instead of happening concurrently the digestion process happens after the engulfed is wholly inside of the engulfer.

To expand on the point above, first we have engulfing, this is when the player presses G and moves into some engulfable object. There are two approaches on what would happen afterwards, both ways providing a momentary window of time for the prey to escape engulfment either by wiggling out or some other means:

• Continually apply a physics impulse to the object in the direction of engulfer’s center of mass until it’s fully inside (where it can’t escape). Not sure if this will actually work and probably will be harder to implement correctly.

• Slowly restrain engulfed cell’s movement until complete stop, where it then gets locked or bound to the engulfer cell (and be pulled inside if a cell is not completely inside the engulfer). Maybe this can be done by simply reparenting the object node (with its physics disabled) into the engulfer and in case if not wholly inside then just simply lerp the position to a point within the engulfer’s membrane.

Then there would be a question of how many things should be allowed to be engulfed within a cell at once. One proposition I have and also Buckly has suggested before is to limit them by relative cells size (cells’ hex count). This would be pretty easy to implement as the same method is already used in the microbe code for checking whether a cell can engulf another. Adding on top of this, an ingestion capacity could be the number of hexes a cell has. If a cell is engulfed, the engulfer’s ingestion fill-meter is increased by the engulfed cell’s hex count and if it reaches capacity due to engulfing too many things or big objects, the cell can no longer ingest things. You can still enter engulf mode but your cell won’t try to actually engulf (think of trying to engulf too big cells in the game, similar behavior). Now what about non-microbe objects such as chunks? Fortunately we can use the same logic, floating chunks in the code has a similar size property predefined in json that in this case emulates hex count.

Visually it could be the case that an engulfed cell is as big as the engulfer, for this I propose shrinking all objects already ingested to be half of its original size, maybe with simple shrinking animation after it has been ingested. Afterwards, their position may stay unchanged inside the cell, this is probably fine but actual floating-inside-cytoplasm effect may be added to enhance the visuals.

For digestion I think this can just be a set duration, default 30 seconds is probably enough. During that timespan, the compounds would be gradually absorbed after which the cell/chunk is deleted. I think we can implement this by first pre-calculating the maximum compounds that can be obtained from the engulfed cell/chunk, and from that then somehow find a way to spread the compound adding step to the engulfer microbe across that timespan. To visualize the digestion process I think we can simply reuse the current dissolve animation we have for the membrane, chunks and organelles. Overall quite a simple base process which can be enhanced and built on top of by more advanced features later on such as lysosomes, enzymes [1][2] for increasing digestion speed, efficacy etc.

Let me know what you think and if there are something missing feel free to add/correct.

2 Likes

I don’t have really anything to comment on the specifics of the design, I just wanted to say I support this kind of rework. One thing I want to mention is that we’ll likely want to add a tutorial that pops up if the player is full and tries to engulf more, otherwise it might be a bit too confusing as to why the player can sometimes engulf things and sometimes not. Also I would have linked the lysosomes here if you hadn’t already.

1 Like

I don’t have anything else to add that I haven’t already; The concept is pretty cut and dry, and can mesh really well with all the other concepts and current features we have from the get-go.

In regards to the different methods you have proposed; I would personally say that the first one would be preferred, but if that is too impactful on performance or otherwise just too much trouble, the second option remains perfectly fine.

Great job, and thank you for taking the time to flesh out this idea of yours!

1 Like

I linked them in the last paragraph, though in inline citation-style so it’s probably not too obvious: 0.4.3 New Organelles, Membranes characteristics - #37 by Buckly

@Buckly Thanks! Also yeah I think I need to make some prototypes of the different methods to see which one works the best and how it actually affects gameplay.

You can make words into links (with markdown link syntax) as well, that would be more visible.

1 Like

I’ve now made a basic prototype demonstrating the first method (pulling engulfed things to cell’s center of mass), feel free to test it out. I think this feels the most intuitive out of the two now that I’ve seen it work in-game, this also surprisingly works quite well, so I guess we’ll go with this method for ingestion.

Video of this in action (likely doesn’t embed as I took this from discord, so probably needs to be downloaded first nevermind it embeds):

It shows some basic initial steps, noticeably the “locking” after crossing a certain distance within the membrane. I moved a lot in the video so barely any pulling action is visible, it’s most noticeable only if you idle at the edges of cells or chunks while in engulf mode, I think this particular aspect adds to the gameplay though as it provides an incentive of chasing/moving into your prey for faster engulfment.

Anyways, on another note, I realized poisonous cells (cells with oxytoxisomes or toxin vacuole organelle) needs special handling for digestion. Normally they eject toxins upon death and some of these toxins will then end up hitting the player and damaging them. For the new mechanics however, this needs to be changed as the cells don’t instantly die and ejecting everything at once. Maybe by slowly damaging the engulfer cell over time as the digestion process went on? Also I wonder if we could tie this in with enzymes or lysosomes in the future, maybe providing a way to neutralize toxins and make poisonous cells safer to eat.

3 Likes

Few months have passed and the new engulfment mechanic is shaping up nicely. Here’s a summary of the overall progress and what ended up being implemented for future reference as of the current state of this revamp’s pull request at the time of writing.

The engulfment process for any valid engulfable objects starts upon immediate contact with the engulfer’s membrane, this completely removes the ability for preys to escape engulfment so they have to find another way to combat this. Few things already proposed:

(overall engulfment process)

The initial step in engulfment is planned to be visualized with pseudopods, this is where part of the membrane stretch out onto the engulfable objects, enveloping them and finally pulling them in. There has been some progress on this front thanks to @Nunz, so it will likely be added in the near future. For now it will just look like the clip above. Also if you haven’t noticed already, there are “bubbles” forming around the engulfed things. This visualizes phagosomes (or endosomes? can’t tell the difference). I wanted to add more intracellular action by animating the fusion of lysosomes and phagosomes to more accurately replicate the real-life process but I think I’ll reserve this for another time.

If the ingested food can’t be digested it will be thrown out. And if the cell is already full of compounds, its digestion process pauses until it needs food again, allowing you to stock up food.

(Iron chunk immediately getting ejected as the cell can’t digest it)

Next comes the digestion, not with a fixed duration anymore, instead the duration scales with the volume of the compounds contained within the food and is also affected by lysosomes which I’ll explain shortly. Toxin damage from toxic cells is now implemented and works the way how I described on the previous post. Damage scales with quantity so don’t try to eat lots of toxic things at once as your cell would explode (exaggerating). Note that currently lysosomes doesn’t neutralize toxic cells as I’m not sure if it’s really what they do (instead I think it’s peroxisomes?), would love to hear a scientific basis on this.

Lysosome which is now implemented is what you will use to make digestion 20% more efficient and faster for each placement, only available for eukaryotes, prokaryotes however only get 40% (values subject to change) of compounds yielded from engulfment. This incentivizes the players more to get a nucleus to evolve predator based microbes. For more details about lysosomes refer to the links and posts above.

The cell’s metabolism also plays a major role. Engulfment and digestion can be an unreliable method to acquire energy if the cell is highly active; higher energy output + slow inefficient digestion = energy deficit. This amplifies the need for lysosomes. A balanced metabolism and digestion can make for a fearsome apex organism.

(New Lysosome organelles)

I think that is all for now. There are still much more to do, so this revamp is in by no means complete yet. All in all I think this goes to show how in-depth a single gameplay mechanic for Thrive can be and just how much we can make it further engaging and interesting for players even for an existing one that has been around probably as old as the game itself by just giving it a bit of a touch up.

3 Likes

I’m going to go ahead and put my pseudopodia concept into writing here, as it’s been drifting about as a loose idea for a while.

Psuedopodia are extensions of the cell’s membrane, extended and manipulated by the cytoskeletal structure to create “arms” to reach and grip prey, or otherwise provide a means of locomotion.
In Thrive there’s essentially two routes we can take with pseudopodia; A cosmetic feature potentially replacing the blue flashing of engulfment mode, or an adaptation that bolsters a cell’s predatory abilities.

## Cosmetic

As a cosmetic feature, pseudopodia would replace the classic blue flashing used to represent a cell in engulfment mode. This would result in a more immersive experience by shedding blatant “gamey” elements like color flashing with a more natural and organic representation, while still remaining visually recognizable.

However, it is likely we would need to redesign the sounds associated with the feature so that it matches accordingly without being jarring.
We could either change the sound to somehow audibly represent pseudopodia, or make a sound that conveys a sense of being alerted, or aggressive intention that plays only on initial activation.

Instead of replacing the engulfment mode outright, pseudopodia could be an upgrade that boosts a cell’s ability to engulf at some kind of detriment.
Pseudopodia could grant a pulling force to engulfment, that would help the cell draw in prey at a larger radius or faster rate. It would likely cost a higher rate of ATP to use engulfment mode as a result.

There are three ways that pseudopodia could be implemented;

#### Fluidity Slider

Pseudopodia could be a feature of fluid membranes, appearing on the cell when fluidity is below a certain threshold.
We would need to communicate the point at which this occurs, and what exactly it does. It’s also worth considering if this would make high rigidity less desirable.

#### Button Toggle

The occurrence of pseudopodia could be toggled through the membrane tab. This would be clear and concise in implementation but might look a bit odd on it’s own.

### Placable Part

The player could place pseudopodia on their cell as an external organelle, which would appear when entering engulfment mode. Each additional part would increase the strength, at the cost of energy.

## Graphical Representation

Pseudopodia are unique compared to other features of cells, as they need to be flexible and able to move around the cell’s shape compared to the rigidity of external features like flagella or pili.

This would require a model that handles stretching fairly well, such as a simple oval or perhaps more of a “hill” shape. When engulfment mode is activated, the shapes will stretch out from within the membrane, or along it’s outer edge depending on how it works behind the scenes.

When nothing is nearby, the pseudopodia will simply wave about idly. When an engulfable object nears, they will begin to reach towards it automatically to simulate the cell grasping it to consume.

Personally, without more attributes to justify them being an adaptation, I think psueodopodia will be just fine as a cosmetic feature.

1 Like

With the psuedopedia, you don’t need those weird seperate meshes. It’s more efficient to distort the membrane.

3 Likes

So crazy thing about that, just a couple days ago I made this branch just for funsies: GitHub - Revolutionary-Games/Thrive at cilia_attraction

It makes cilia generate little currents to attract chunks to you.

3 Likes

Adding one of the unique aspects differentiating eukaryotes from prokaryotes just for funsies.

I honestly think it would be pretty nifty if pseudopodia came through the slider as you suggested, with only eukaryotes being able get that ability with maximum fluidity. I think we’d need to think a bit on how to differentiate pseudopodia from current generation with cilia. Perhaps pseudopodia allows you to do that without an increase in ATP you would see with cilia but would come with the disadvantages of being very fluid?

Perhaps pseudopodia allows you to do that without an increase in ATP you would see with cilia but would come with the disadvantages of being very fluid?

Just as a note I doubt having a fluid membrane is that much of a disadvantage. The bonus speed is so vital I never do anything else than a 100% fluid cell (and that’s a problem of its own I guess).

3 Likes

same, I just can’t justify greater rigidity

I’m thinking that we should just make max rigidity (on cell walls) completely immune to or deflect 90% of damage from pili attack. There’s just too much cons with cell walls in the game currently I think, so this should be a counterbalance. This also give more reason for evolving specialized digestive enzyme to be able to instead consume these types of cells by breaking them down with enzymes.

4 Likes

I actually tried doing something like that a while back, but gave up because I’m just bad at programming and making the fluidity/rigidity slider effect different membranes differently was something I couldn’t figure out without basically making different copies of it.I decided to spare hh from the conniptions that would likely come about.

But yes I do like the idea of increased defenses for rigidity.
I attempted a solution by revisiting membrane stats here;
https://forum.revolutionarygamesstudio.com/t/pacing-and-combat/71/5
I actually successfully implemented healing rate variance between them, but I can’t remember why I never tried merging it. (Probably too hacky)

2 Likes

I love the overall idea of using rigidity to counter pili (current bonus is too low to really bear much effect), but I wouldn’t restrict it to cell walls. Because then you still have no incentive for simpler membranes. And given that cell walls are already intended to make you resist physical damages better (as a rule of thumb), rigidity would only happen to be a duplicate…

We probably need to give each position on the slider a good reason to exist, or just scrap it altogether I believe. But surely that discussion shouldn’t be pursued over here?

PS: don’t hesitate to ask around for programming help

The revamp branch is now merged, all that’s left to do regarding the mechanics for future reference:

• Implement pseudopodia.
• Implement Thim’s cilia attraction (I think I can add this before 0.5.9).
• Digestion affecting auto-evo.
• Further balancing
• Proper multicellular digestive system
• Squash bugs

That’s it I think.

2 Likes

If you do implement cilia attraction, I personally feel it should be implemented as a specialization/upgrade of the cilia, rather than being a feature of cilia in general. This is because motile cilia are typically specialized in purpose in real life ciliates.

That being said it’s a fairly minor detail, and if you want to get the feature implemented within the span of this update, it might be frugal to implement it as a default feature of cilia until a later time.

2 Likes

I agree, but this tiny mechanic I think has such a good fun to effort ratio, and the opportunity to include this along with engulf revamp and cilia addition is too good to pass, at the same time there’s limited time until feature freeze, so having this as a default feature of cilia in the meantime can be justified I think. More things for the players to mess around with in the new update I guess.

1 Like