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