Mathematical question: procedural generation of a galaxy

前端 未结 19 1515
太阳男子
太阳男子 2020-12-22 17:25

I\'m going to make a space/trading/combat game that is completely procedurally generated. But, I know that storing all of the details of the whole galaxy in memory is unfeas

19条回答
  •  北海茫月
    2020-12-22 18:18

    Suppose you start with a seed for the galaxy, i.e. 1234, take this seed, and generate 10000 random numbers, each one represents a star system. When you approach the star, you take the star's random number, and you it as a seed for a new random function. Generate a random number for the quantity of celestial bodies orbiting the star, and the generate one number for each body (always using the second random function)and so on. I dont know if this helps you, but you need to remember that the random functions, are internally chaotic, for a initial condition, the whole function changes.

    The seed for the stars in the galaxy must produce always the same stars, the seed of the stars must produce the same bodies, etc.

    You can always turn things more interesting using statistics, density calculations, improving the results. Check always that the functions will produce the same result for the same input.

    Sorry if my english sucks, i'm from Argentina, and english language is not one of my trained qualities :p

    PD: I'm doing the same type of game ;)

提交回复
热议问题