Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags
(3 edits)

When performing an evolution with many entities, the time per generation is wrong because of the slowdown due to the amount of entities. And to solve this problem it is necessary to optimize or separate the tasks to be carried out, which can be done with the cpu cores. Instead of a single core having to perform the calculations for 100 entities, let the task be divided equally among the other available cores. My computer contains 14 cores, each core could be performing the calculations of approximately 7 entities instead of 100. When performing the evolution with the quoted amount, the game only uses:

CPU -  10%-15%  -- 65% available

GPU -  4%-8%  -- 86% available

MEM -  2%-3%  -- 93% available

it is visible when you have around 100 entities and quote 5 seconds per generation, which in the end takes 12 seconds to switch to the next generation.

I would recommend relying on the computer's internal time for the time to work properly.

if (startTime - currentTime >= GenerationTime)
    nextGeneration()
(1 edit)

You may be using the video card to help with tasks other than rendering the game, as the video card usage reaches 15%.