So I’ve got a proposal I want to discuss with the other programmers, @crovea, @Moopli.
Currently, the in-game spawn system draws a circle around the microbe every frame and sees if the circle moved from the last frame. It then despawns entities that were part of the old circle and not part of the new one and adds additional entities (such as compounds and other cells). In my opinion, this is unintuitive and wastes processing time. For one, the player screen is rectangular, so you have to make the circle quite large and end up spawning too many entities off-screen in the verticle direction and too little in the horizontal. It is also a pain to have to check every frame if something is no longer in the circle around the player.
I propose to move over to a tile-based computing system for lack of a better word that is used in every other game. Below is my failed attempt at using text to illustrate what I mean (the X is the player cell).
_____
|||_|
||X||
|||_|
We calculate all the cells, compounds, velocity fields, etc… in 9 squares surrounding the player’s screen. Unlike the previous system, this allows AI cells to swim into the player’s screen (currently if you stop moving, all AI microbes disappear after a while because they don’t spawn unless the player moves). It also means that you can continue chasing an organism after it vanishes outside of your screen (right now if it leaves the screen, it’s gone). Whenever the player moves to one of the 8 bordering tiles, the 3 tiles directly opposite from it disappear and are replaced by three new adjacent ones, as shown below.
_____
|||_|
||X||
|||_|
_____
|||_|
|||X|
|||_|
___
|[b]||||[/b]
|[b]||X||[/b]
||||_|
______
|_|_|_|
|_|X|_|
|_|_|_|
Hopefully, this all makes sense.