-
Notifications
You must be signed in to change notification settings - Fork 1
/
Planet Numbering Scheme.txt
35 lines (30 loc) · 1.19 KB
/
Planet Numbering Scheme.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
Int32 can hold up to 2,147,483,647 numbers
8 planets per solar system
8 solar systems per galaxy
33,554,431 galaxies
33,554,431x8x8 = 2,147,483,584 planets
can you mathematically devise the galaxy, sol sys, and distToStar from just the seed?
galaxy = Mathf.CeilToInt(seed / 64.0f)
sol sys = Mathf.CeilToInt(seed / 8.0f)
distToStar = (int)(seed - 8.0f * (sol sys - 1))
24 = 1,3,8
can you mathematically build the planet number from a given galaxy, sol sys, and distToStar?
seed = (int)(galaxy - 1) x 64.0f + (sol sys - 1) x 8.0f + distToStar
1,3,8 = 24
seed sol sys galaxy
1 2 3 4 5 6 7 8 (1) 1
9 10 11 12 13 14 15 16 (2)
17 18 19 20 21 22 23 24 (3)
25 26 27 28 29 30 31 32 (4)
33 34 35 36 37 38 39 40 (5)
41 42 43 44 45 46 47 48 (6)
49 50 51 52 53 54 55 56 (7)
57 58 59 60 61 62 63 64 (8)
65 66 67 68 69 70 71 72 (1) 2
73 74 75 76 77 78 79 80 (2)
81 82 83 84 85 86 87 88 (3)
89 90 91 92 93 94 95 96 (4)
97 98 99 100 101 102 103 104 (5)
105 106 107 108 109 110 111 112 (6)
113 114 115 116 117 118 119 120 (7)
121 122 123 124 125 126 127 128 (8)