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.