The Frustum's Iterator
When I published the first video devlog, one of the many little details that I left out for brevity's sake was how exactly the Frustum Iterator worked. If you recall, the iterator is used to check the area within a given radius around the player, and see if said area is within the player's frustum. If it is within the player's frustum, a sector is created at that location if none exist there already.
Originally, each area was only checked one at a time per frame. Since the framerate is locked at 60, this means that only 60 out of the 8,000 areas that it needed to check (square shape, s=20) where being iterated upon every second. This obviously needed to change, and I upgraded it so that every frame it could check multiple sectors. The exact amount will likely be modifiable within the game's settings further down the road of development, but for now I have it at 30. The other major improvement I added is, since checking for whether a sector is within the frustum is pretty much an instantaneous process, I allowed the iterator to graze each sector outside of the frustum within a single frame.
This still brought forward another issue, and that was the fact that the iterator's shape of motion was fixed on a certain corner of the square surrounding the player. This made sector generation kind of awkward as it felt unfocused and strange. Sure, the end result would be the same, but the fact that there's a possibility that sectors could generate away from the player first would be disorienting, and would also present problems for the game's physics engine which I'm currently working on. So, after some complicated and seemingly convoluted problem-solving, I eventually managed to get the iterator to iterate around the player's position. I also made sure it reset itself if the player turns or moves beyond their original position, to ensure that sectors will always generate outward the player's perspective rather than inward.
There's still some improvements that can be made, such as with the frustum itself, but for now I'm pretty happy with it.
--2--