0

I have been thinking about the quickest way to distribute 1200 asteroids with procedurally generated positions and sizes when needed, but I can't get my head around how to do this.

I've currently got a system that has asteroids that get primed for re-placement when they get a certain distance from the player. But, assuming I want them to be consistently in the same positions, how do I determine where a re-positioned asteroid should be placed next?

Edit
Based on the comment below, I've realised the issue I'm having is not how the coordinates are generated, but how they are chosen at run time. When an asteroid is primed for re-positioning, how do I determine which coordinates are within a given zone (ahead of the player, but at a distance where the re-spawned asteroid will go unnoticed at first) without having to iterate through a vast amount of coordinates?

I think I need to be able to quickly extract which pre-generated coordinates are in that spawning zone. How would I do that?

Or am I going about this all wrong?

moosefetcher
  • 1,841
  • 2
  • 23
  • 39
  • 1
    I may be missing something, but why not random coordinates? Just use some sort of tiling system to get your random seeds: https://docs.unity3d.com/530/Documentation/ScriptReference/Random-seed.html – Josep Valls Jun 21 '17 at 17:45
  • Thanks for the comment. Are you suggesting generating the coordinates when they are needed, or having them pre-generated for the entire asteroid field? I guess the question I'm asking - irrespective of how the pre-generated coordinates are determined - is: Without having to iterate through a huge list of coordinates, how do I determine which coordinate is the best candidate to be chosen as the 'spawn' point for a re-positioned asteroid? I strongly suspect there's something I'm not getting. If you know what that is, I'd be glad to hear it! – moosefetcher Jun 23 '17 at 10:20

0 Answers0