To avoid having hundreds of entities at the same place, one solution would be to inflict damage on entities if they are too tight to other entities. For example, we could take away 1 hp from each entity if at least 20 other entities are present within 10px, and this every 3 seconds (the numbers are to be adjusted empirically).
Note
It was also considered to add collision physics to the game, so that an entity cannot overlap other entities, but this would likely reduce the performance of the game considerably, complicate the spawning system (which currently looks to see if two entities overlap), and generally reduce the movement of entities too much.
To avoid having hundreds of entities at the same place, one solution would be to inflict damage on entities if they are too tight to other entities. For example, we could take away 1 hp from each entity if at least 20 other entities are present within 10px, and this every 3 seconds (the numbers are to be adjusted empirically).