Mathematical question: procedural generation of a galaxy

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

    Here's what I have come up with. Dunno if it will be the final version though.

    Imagine a hexagonal grid, and at each vertex, a solar system. Since, we're on a hexagonal grid, there are only three lines going from any vertex. One is always horizontal, and the other two are diagonals. If we give the starting seed a value of n, we can give the solar system that is horizontally connected to the starting point a value of n+1, the others get values of n+2 and n-2.

    Oh crap. We wont necessarily get a grid. Damnit. Lets try again.

提交回复
热议问题