Revolutionary-Games / Thrive

The main repository for the development of the evolution game Thrive.
https://revolutionarygamesstudio.com/
Other
2.79k stars 496 forks source link

Fix lag spikes from organelle duplication in very large cells #3273

Open hhyyrylainen opened 2 years ago

hhyyrylainen commented 2 years ago

probably caused by the approach of starting at 0,0 coordinates and spiraling outwards until an empty spot is found. That probably starts running quite long when the cell is very large in radius.

I think we have two choices to fix this:

astral-grayson commented 2 years ago

Could we just compute the growth path when saving an organism from the editor? Or is the order of growth not deterministic.

hhyyrylainen commented 2 years ago

That would be possible as well but all species need to have the growth path computed and it needs to be made sure that cells that were partially grown when entering the editor can continue growing properly.

astral-grayson commented 2 years ago

Ok looking into this a little more it looks like the best solution is probably to just keep track for each cell of where the last organelle was grown to and start the spiral from there. If we compute a growth path for every species on exiting the editor I worry the extra time before getting back to gameplay might be annoying if there are many large species around.

RacerBG commented 2 years ago

Here is a bonus from me (the largest cells which I had ever created in Freebuild mode):

Vohin.zip Tuxespion_Cedata.zip

hhyyrylainen commented 1 year ago

Turns out that the membrane generation for huge cells took up a lot of time, so with https://github.com/Revolutionary-Games/Thrive/pull/4251 done this should be less of an issue. But still the logic for finding a place to put a duplicated organelle does still get very expensive computationally in truly huge cells.

hhyyrylainen commented 4 months ago

I'll write that there is now endosymbiosis soon in the game which will create extraneous organelles, which also need positions calculated for them. So the approach of pre-calculating a growth pattern is not possible.