OK, here is a very simple version of the system. It always starts at one point, which is why you'll probably notice lag. You can make it less laggy by:
1. Spreading the grid triggers over several trigger cycles.
2. Using wiser starting points. The simplest example is to start in the middle - that will cut the mean amount of grid triggers by half. If you need to reduce lag even more, split the map into quadrants and have a separate starting point per quadrant.
If you have any questions, please ask.
EDIT:
OK, I decided to analyze this from a mathematical point of view. Let each create/remove be one 'laggy' action in the grid. The most effective way to get to the desired point is to move on the diagonal and then in a straight line - this way the number of grid steps needed to get from point (x1, y1) to (x2, y2) is max{mod(x1-x2), mod(y1-y2)}; in other words, it is the largest coordinate distance. In a 1x1 grid, we use 2 laggy actions to move down/left, 3 laggy actions to move down, etc... So if we move in the most effective manner (diagonals -> straight lines), the maximum number of grid steps we have to use is equal to the greatest dimension of the area we move in (in our case, it's 256).
The least average number of laggy operations is used in grid steps associated with moving in the following three nearby directions: down/left, down and down/right (3, 4 and 5 respectively). Hence if we start our grid from the upper left corner, the maximum number of laggy operations needed to cover the entire quadrant/area is (3+4+5)*N/3 = 4N. If we decide to move from the middle of the quadrant/area, the average number of laggy operations is (2+3+4+5+6+7+8+9) / 8 = 5.5. Hence the average is 5.5*N/2 = 2.75N (because we have to move only half the distance).
This means that the middle start position for the grid is less laggy 'in the long run'. This is, however, highly dependent on chance. You may get trigger cycles that require you to use the up/left grid step, which is the laggies one, to cover long distances (this might cause more lag). The upper-left starting position is more stabile i nthe lag it makes, as it will never exceed 5N laggy operations.
Just some info for you to help you make the right choice.
I noticed that in the version of the system that I've made, the lag might get quite strong; perhaps I'll enchance it with the help of this knowledge and split it up into quadrants, etc...
Attachments:
Post has been edited 3 time(s), last time on Aug 2 2009, 3:09 pm by JaFF.
None.