Increase Simulation Performance #51
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: experiments/cellular-automata#51
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
simulation:
rendering:
We ONLY ever have to iterate over cells which are alive (since they have to be checked against 'survival' every tick) and cells which are neighboring those that are alive (since they can be 'birthed' by having a sufficient number of neighbors). No other cell has to be checked
so, one thing to do would be keeping a list of all cells that are alive (and only those) and then when updating rolls around just iterating through them. the changeSet would have to be applied to them each frame as well.
It might also be useful to work with regions - whenever a cluster of cells (i.e. a region of, say, 10-15 cells) is either completely filled, completely empty, or stagnant for a while; it would be declared 'inactive' and not looked at for the neighboring cell counting function.
(Regions could even be removed from memory when not necessary for the timeline and just replaced with an enum describing their full or empty state when completely full or empty)
changed milestone to %3