# Proceduraly generated concentric circle sectors

Hi all!
Im trying to create a procedurally generated galaxy and subdivide the area in concentric sectors generated the following way:

Id like this to be dynamically and randomly generated.

Bonus points: Sectors should grow in a spiral-like way

Whats a good formula to achieve this?
i tried using a pair coordinate system but it fails the further away from the center i am, since the further i am from the center, the bigger each tile is.

Thanks!

a spiral-like way

Well that’s a quite vague definition. Though given your example image we could imagine what you had in mind.

Also you need to think of some kind of limiting factors. To how many rings a sector could reach out? How many actual sectors (of the 24 sectors) should one region spread at max / min? Should the limit be per ring or for the region as a whole?. Should there be an area limit per region? Since the sectors grow the further out you go, does that matter regarding the area?

Anyways, what concrete issues do you have implementing your algorithm? You would just start at any cell in the inner ring and follow the above mentioned rules. Roll some random numbers to define how many cells on the first ring you may occupy. Roll another random number to decide how many rings to go out. For each ring, roll another random number to decide how many cells it should be offset compared to the first Once one region is finished, just start again at the first ring at the end of the last one. Since you probably don’t want any gaps, each ring would simply start at the end of the previous ring. The outer rings should always have at least as many cells as the next inner ring. This ensures that you don’t move backwards like you did in the yellow region, second ring.

Since you have a fix sector count, the whole thing can be stored in a single flattened array where 24 elements represent one ring and the next 24 elements the second ring and so on.