Mathematical question: procedural generation of a galaxy

前端 未结 19 1533
太阳男子
太阳男子 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:06

    I use the Mersenne Twister. It is PRNG that accepts as its seed array of any length.
    For example, I want to generate galaxy on coordinates x=25,y=72. I re-init twister with seeds [25,72].
    If I want to generate 1138th planet in this galaxy, I use [25,72,1138].
    Country? [25,72,1138,10]
    City? [25,72,1138,10,32]
    and so on.
    With this method you can generate billions of trillions of zillions of objects using just one number (the one before x coordinate, in our case before 25).
    There are some projects now that use it.
    Noctis: anynowhere.com/
    Infiniverse: http://www.infiniverse-game.com/

提交回复
热议问题