-
Notifications
You must be signed in to change notification settings - Fork 3
/
GalaxyGen.bas
executable file
·4280 lines (3925 loc) · 193 KB
/
GalaxyGen.bas
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
'To Boldly Go v0.3 - Kopernicus Procedural Galaxy Generator!"
'Copyright (C) 2016 Daniel L."
'
'This program is free software; you can redistribute it and/or modify"
'it under the terms of the GNU General Public License as published by"
'the Free Software Foundation; either version 2 of the License, or"
'(at your option) any later version."
'PRINT
'This program is distributed in the hope that it will be useful,"
'but WITHOUT ANY WARRANTY; without even the implied warranty of"
'MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the"
'PGNU General Public License for more details."
'
'You should have received a copy of the GNU General Public License"
'along with this program; if not, write to the Free Software"
'Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA"
TBG_Version$ = "0.3"
_TITLE "To Boldly Go version " + TBG_Version$
i& = _LOADIMAGE("Data_Folder/Galaxy-icon.png", 32) '<<<<<<< use your image file name here
IF i& < -1 THEN
_ICON i&
_FREEIMAGE i& ' release image handle after setting icon
END IF
888 PRINT
CLS
'################'
'#2017-0201 STH
'#Call a subroutine that reads in planet template names, radii, SOI, and descriptions
'#Will be used in the functions that make planets
REDIM SHARED planetKey$(-1)
REDIM SHARED thePlanetRadius(-1)
REDIM SHARED thePlanetMass(-1)
REDIM SHARED thePlanetSOI(-1)
REDIM SHARED thePlanetDesc$(-1)
REDIM SHARED thePlanetStock$(-1)
readPlanetTemplates
'###################
'BROWNSTARNUMBER = 1
'REDSTARNUMBER = 1
'KSTARNUMBER = 1
'YELLOWSTARNUMBER = 1
'WHITESTARNUMBER = 1
'BLUESTARNUMBER = 1'
DWARFSTARNUMBER = 1
NEUTRONSTARNUMBER = 1
BLACKHOLENUMBER = 1
CLUSTERCORENUMBER = 1
CORESTARNUMBER = 1
DIM SHARED GTYPE AS INTEGER
CLS 'clears the screen
'*******************************************************************************
'*******************************************************************************
DIM Backdrop AS LONG
SCREEN _NEWIMAGE(700, 518, 32)
Backdrop = _LOADIMAGE("Data_folder/Background2.png")
_PUTIMAGE (0, 0), Backdrop
_FONT _LOADFONT("Data_folder/DejaVuSans.ttf", 15, "MONOSPACE") 'select monospace font
_PRINTMODE _KEEPBACKGROUND
'*******************************************************************************
'*******************************************************************************
PRINT ""
778 PRINT
_FONT _LOADFONT("Data_folder/DejaVuSans.ttf", 15, "MONOSPACE") 'select monospace font
_PRINTMODE _KEEPBACKGROUND
IF PTOGGLE = 1 THEN
PENABLE$ = "y"
END IF
IF ATOGGLE = 1 THEN
ASTTOG$ = "y"
END IF
FOR i = 1 TO 11
PRINT ""
NEXT
COLOR _RGB(255, 255, 255)
PRINT "Please do not use capitalization"
PRINT "for anything other than the Galaxy name."
PRINT ""
INPUT "Name your Galaxy:", GNAME$
2222 INPUT " (CUSTOM/AUTO)(c/a):", CUSTOM$
INPUT " Input Seed:", SEED 'asks the user for a random seed.
RANDOMIZE SEED
SOBJECTNUMBER = 0
OSTAR = 0
BSTAR = 0
ASTAR = 0
FSTAR = 0
GSTAR = 0
KSTAR = 0
MSTAR = 0
LSTAR = 0
DWARFSTAR = 0
CLUSTER = 0
IF CUSTOM$ = "c" THEN
INPUT "Galaxy Age (0-5. 1 is recommended):", AGE
INPUT "Planets? (y/n):", PENABLE$ 'Asks the user whether they want to have planets or not
'*******************************************************************************
INPUT "Asteroids? (y/n):", ASTTOG$ 'Asks the user whether they want to have asteroids or not
'*******************************************************************************
PRINT "What Galaxy type do you want?:"
999 INPUT "Ellipse-0, Disk-1, Cluster-2:", GTYPE 'Asks the user what kind of galaxy they want.
IF GTYPE > 2 THEN
GOTO 999
END IF
'*******************************************************************************
INPUT "advanced settings? (y/n):", ADVANCED$
IF ADVANCED$ = "y" THEN
'*******************************************************************************
IF GTYPE = 2 THEN
INPUT "Clusters:", CLUSTER 'Asks the user how many star clusters they want
END IF
PRINT ""
'*******************************************************************************
INPUT "Brown Dwarves:", LSTAR 'Asks the user how many brown stars they want to generate.
LSTAR = LSTAR + 0
'*******************************************************************************
INPUT "Red Dwarves:", MSTAR 'Asks the user how many red stars they want to generate.
MSTAR = MSTAR + 0
'*******************************************************************************
INPUT "Orange Dwarves:", KSTAR 'Asks the user how many orange stars they want to generate.
KSTAR = KSTAR + 0
'*******************************************************************************
INPUT "Yellow Dwarves:", GSTAR 'Asks the user how many yellow stars they want to generate.
GSTAR = GSTAR + 0
'*******************************************************************************
INPUT "Yellow-White Dwarves:", FSTAR 'Asks the user how many yellow stars they want to generate.
FSTAR = FSTAR + 0
'*******************************************************************************
INPUT "White Stars:", ASTAR 'Asks the user how many white stars they want to generate.
ASTAR = ASTAR + 0
'*******************************************************************************
INPUT "Blue-White Giants:", BSTAR 'Asks the user how many blue stars they want to generate.
BSTAR = BSTAR + 0
'*******************************************************************************
INPUT "Blue Giants:", OSTAR 'Asks the user how many blue stars they want to generate.
OSTAR = OSTAR + 0
'*******************************************************************************
INPUT "White Dwarves:", DWARFSTAR 'Asks the user how many white dwarves they want to generate.
DWARFSTAR = DWARFSTAR + 0
'*******************************************************************************
'INPUT " BLACK HOLES:", BLACKHOLE 'Asks the user how many black holes they want to generate.
'BLACKHOLE = BLACKHOLE + 0
'*******************************************************************************
'INPUT " ROGUE PLANETS:", ROGUE 'Asks the user how many rogue planets they want to generate.
'ROGUE = ROGUE + 0
'*******************************************************************************
CLS
_PUTIMAGE (0, 0), Backdrop
FOR i = 1 TO 11
PRINT ""
NEXT
ELSE
'AGE = INT(RND * 5)
'GTYPE = INT(RND * 2)
IF GTYPE = 2 THEN
CLUSTER = INT(RND * 4) + 1
GTYPE = GTYPE + 1
ELSE
GTYPE = GTYPE + 1
END IF
SELECT CASE AGE
CASE 0
MSTAR = INT(RND * 20) + 10
KSTAR = INT(RND * 15) + 20
GSTAR = INT(RND * 20) + 5
ASTAR = INT(RND * 15) + 4
BSTAR = INT(RND * 10) + 1
LSTAR = INT(RND * 40) + 5
CASE 1
MSTAR = INT(RND * 20) + 10
KSTAR = INT(RND * 15) + 7
GSTAR = INT(RND * 10) + 5
ASTAR = INT(RND * 7) + 4
BSTAR = INT(RND * 4) + 1
LSTAR = INT(RND * 40) + 5
DWARFSTAR = INT(RND * 5)
CASE 2
MSTAR = INT(RND * 20) + 10
KSTAR = INT(RND * 12) + 7
GSTAR = INT(RND * 3) + 1
LSTAR = INT(RND * 40) + 5
DWARFSTAR = INT(RND * 10) + 5
CASE 3
MSTAR = INT(RND * 10) + 10
KSTAR = INT(RND * 7) + 3
LSTAR = INT(RND * 30) + 5
DWARFSTAR = INT(RND * 30) + 10
CASE 4
MSTAR = INT(RND * 3)
LSTAR = INT(RND * 20) + 5
DWARFSTAR = INT(RND * 40) + 10
CASE 5
LSTAR = INT(RND * 15)
DWARFSTAR = INT(RND * 60) + 10
END SELECT
END IF
ELSE
IF CUSTOM$ = "a" THEN
AGE = INT(RND * 5)
GTYPE = INT(RND * 2)
IF GTYPE = 2 THEN
CLUSTER = INT(RND * 4) + 1
GTYPE = GTYPE + 1
ELSE
GTYPE = GTYPE + 1
END IF
'IF GTYPE = 0 THEN
GTYPE = 1
'END IF
PENABLE$ = "y"
ASTTOG$ = "y"
SELECT CASE AGE
CASE 0
MSTAR = INT(RND * 20) + 10
KSTAR = INT(RND * 15) + 20
GSTAR = INT(RND * 20) + 5
ASTAR = INT(RND * 15) + 4
BSTAR = INT(RND * 10) + 1
LSTAR = INT(RND * 40) + 5
CASE 1
MSTAR = INT(RND * 20) + 10
KSTAR = INT(RND * 15) + 7
GSTAR = INT(RND * 10) + 5
ASTAR = INT(RND * 7) + 4
BSTAR = INT(RND * 4) + 1
LSTAR = INT(RND * 40) + 5
DWARFSTAR = INT(RND * 5)
CASE 2
MSTAR = INT(RND * 20) + 10
KSTAR = INT(RND * 12) + 7
GSTAR = INT(RND * 3) + 1
LSTAR = INT(RND * 40) + 5
DWARFSTAR = INT(RND * 10) + 5
CASE 3
MSTAR = INT(RND * 10) + 10
KSTAR = INT(RND * 7) + 3
LSTAR = INT(RND * 30) + 5
DWARFSTAR = INT(RND * 30) + 10
CASE 4
MSTAR = INT(RND * 3)
LSTAR = INT(RND * 20) + 5
DWARFSTAR = INT(RND * 40) + 10
CASE 5
LSTAR = INT(RND * 15)
DWARFSTAR = INT(RND * 60) + 10
END SELECT
'BLACKHOLE = INT(RND * 3)
'ROGUE = INT(RND * 10)
ELSE
GOTO 2222
END IF
END IF
OPEN "galaxy.cfg" FOR OUTPUT AS #1 'Creates the config file
numbRequestedStars = OSTAR + BSTAR + ASTAR + FSTAR + GSTAR + KSTAR + MSTAR + LSTAR + DWARFSTAR + CLUSTER
DIM SHARED starNameList$(0 TO numbRequestedStars)
CALL makeStarNameList(numbRequestedStars)
'################################
'#Make the cfg header text
'###Insert 10 empty lines
FOR i = 1 TO 10
PRINT #1, ""
NEXT
PRINT #1, "// WARNING! SPOILERS!"
PRINT #1, "// This file contains spoilers. If you don't want to have your surprises ruined, you should stop reading now."
'###Insert 34 empty lines'
FOR i = 1 TO 34
PRINT #1, ""
NEXT
PRINT #1, "// Seriously, it's a lot more fun to find this stuff out in the game."
PRINT #1, "// Last chance to turn back."
'###Insert 28 empty lines'
FOR i = 1 TO 28
PRINT #1, ""
NEXT
PRINT #1, "// I did warn you."
'###Insert 6 empty lines'
FOR i = 1 TO 6
PRINT #1, ""
NEXT
PRINT #1, "//Generated by To Boldly Go, version " + TBG_Version$
PRINT #1, "//Seed: " + STR$(SEED)
'PRINT #1, "@Kopernicus"
'PRINT #1, "{"
'PRINT #1, " @Body[Sun]"
'PRINT #1, " {"
'PRINT #1, " +Properties"
'PRINT #1, " {"
'#the SOI should eventually be calculated from Kerbol's mass
'#this is just a bug fix
'#STH 2017-0320
'PRINT #1, " +sphereOfInfluence = 220118820000"
'PRINT #1, " }"
'PRINT #1, " }"
'PRINT #1, "} "
'#End the cfg header text'
'#############################
'###Read in the string templates
DIM SHARED thePropertiesTemplate$, theOrbitTemplate$, theLightTemplate$, theMaterialTemplate$, theCoronasTemplate$
DIM SHARED theGasGiantTemplate$, theRingsTemplate$, thePlanetTemplate$, theStarTmp$, theWikiTemplate$
thePropertiesTemplate$ = fileAsString("propertiesTmp.txt")
theOrbitTemplate$ = fileAsString("orbitTmp.txt")
theLightTemplate$ = fileAsString("lightTmp.txt")
theMaterialTemplate$ = fileAsString("materialTmp.txt")
theCoronasTemplate$ = fileAsString("coronaTmp.txt")
theGasGiantTemplate$ = fileAsString("gasGiantScaledVersionTmp.txt")
theRingsTemplate$ = fileAsString("ringsTmp.txt")
thePlanetTemplate$ = fileAsString("planetTmp.txt")
theStarTmp$ = fileAsString("starTmp.txt")
theWikiTemplate$ = fileAsString("wikiTemplate.html")
DIM SHARED blackHole_MassKSP
DIM SHARED galaxy_RadiusKSP
DIM SHARED REDgb AS INTEGER
DIM SHARED rGREENb AS INTEGER
DIM SHARED rgBLUE AS INTEGER
blackHole_MassKg = 8.55E37
blackHole_MassKSP = sol2Kerbol_kg(blackHole_MassKg)
galaxy_RadiusKSP = 6.62251E17
'################################
PRINT #1, "@Kopernicus"
PRINT #1, "{"
PRINT #1, " Body"
PRINT #1, " {"
'PRINT #1, " name = Kerbol"
PRINT #1, " name = Core"
'PRINT #1, " cbNameLater = Sun"
PRINT #1, " Template"
PRINT #1, " {"
PRINT #1, " name = Sun"
PRINT #1, " }"
PRINT #1, " Properties"
PRINT #1, " {"
'PRINT #1, " sphereOfInfluence = 220118820000"
PRINT #1, " description = The Kraken's Lair"
'PRINT #1, " sphereOfInfluence = 46992481203007510000" '220118820000
'#it appears that giving a big SOI to CORE breaks the ability to orbit the stock Sun
'# STH 2017-0320'
PRINT #1, " sphereOfInfluence = 11243597738400000"
PRINT #1, " }"
PRINT #1, " Orbit"
PRINT #1, " {"
PRINT #1, " referenceBody = Sun"
IF GTYPE = 2 THEN
PRINT #1, " semiMajorAxis = 12243597738400000"
PRINT #1, " inclination ="; INT(RND * 360); ""
END IF
IF GTYPE = 0 THEN
PRINT #1, " semiMajorAxis = 12243597738400000"
PRINT #1, " inclination ="; INT(RND * 360); ""
END IF
IF GTYPE = 1 THEN
PRINT #1, " semiMajorAxis = 12243597738400000"
PRINT #1, " inclination ="; INT(RND * 50) - 25; ""
END IF
PRINT #1, " argumentOfPeriapsis ="; INT(RND * 1000); ""
PRINT #1, " mode = 0"
PRINT #1, " color = 0.2,0.2,0.2,1"
PRINT #1, " }"
PRINT #1, " ScaledVersion"
PRINT #1, " {"
PRINT #1, " Light"
PRINT #1, " {"
'PRINT #1, " sunlightColor = 1,1,1,1.0"
'PRINT #1, " sunlightIntensity = 0.55"
'PRINT #1, " scaledSunlightColor = 1,1,1,1.0"
'PRINT #1, " scaledSunlightIntensity = 0.55"
'PRINT #1, " IVASunColor = 1,1,1,1.0"
'PRINT #1, " IVASunIntensity = 0.55"
'PRINT #1, " sunLensFlareColor = 1,1,1,1.0"
PRINT #1, " sunlightColor = 0,0,0,0.0"
PRINT #1, " sunlightIntensity = 0"
PRINT #1, " scaledSunlightColor = 0,0,0,0.0"
PRINT #1, " scaledSunlightIntensity = 0"
PRINT #1, " IVASunColor = 0,0,0,0.0"
PRINT #1, " IVASunIntensity = 0"
PRINT #1, " sunLensFlareColor = 1,1,1,1.0"
PRINT #1, " givesOffLight = False"
PRINT #1, " }"
PRINT #1, " Material"
PRINT #1, " {"
PRINT #1, " emitColor0 = 0,0,0,1"
PRINT #1, " emitColor1 = 0,0,0,1"
PRINT #1, " sunspotColor = 0,0,0,1"
PRINT #1, " rimColor = 0,0,0,1"
PRINT #1, " }"
PRINT #1, " Coronas"
PRINT #1, " {"
PRINT #1, " Corona"
PRINT #1, " {"
PRINT #1, " rotation = 0"
PRINT #1, " speed = -1"
PRINT #1, " updateInterval = 5"
PRINT #1, " scaleLimitX = 5"
PRINT #1, " scaleLimitY = 5"
PRINT #1, " scaleSpeed = 0.007"
PRINT #1, " Material"
PRINT #1, " {"
PRINT #1, " texture = To_Boldly_Go/coronae/BlackCorona"
PRINT #1, " inverseFade = 2.553731"
PRINT #1, " }"
PRINT #1, " }"
PRINT #1, " }"
PRINT #1, " }"
PRINT #1, " }"
PRINT #1, "}"
IF GTYPE = 2 THEN
CLUSTERNUM = 0
IF CLUSTER > 0 THEN
DO
PRINT #1, "@Kopernicus"
PRINT #1, "{"
PRINT #1, " Body"
PRINT #1, " {"
'CLS
aName$ = starNameList$(CLUSTERNUM)
'aName$ = theStarName$(numbRequestedStars) '#Calls the function "theStarName"
PRINT #1, " name = "; CLUSTERNUM; ""
PRINT #1, " cbNameLater = "; aName$; " Galaxy"
PRINT #1, " Template"
PRINT #1, " {"
PRINT #1, " name = Sun"
PRINT #1, " }"
theDescription$ = aName$
theStarRadius = 10000
theStarSphereOfInfluence = 90118820000 'this is very small for a black hole I think. STH
aPropertiesTemplate$ = thePropertiesTemplate$
aPropertiesNode$ = propertyNode$(aPropertiesTemplate$, theDescription$, STR$(theStarRadius), "", "", "", "", "", "", "", "", STR$(theStarSphereOfInfluence))
PRINT #1, " Orbit"
PRINT #1, " {"
PRINT #1, " referenceBody = Sun"
PRINT #1, " semiMajorAxis ="; INT(RND * 1D+16) + 100000000000000#; ""
PRINT #1, " inclination ="; INT(RND * 50) - 25; ""
PRINT #1, " argumentOfPeriapsis ="; INT(RND * 1000); ""
PRINT #1, " mode = 0"
PRINT #1, " color = 0.2,0.2,0.2,1"
PRINT #1, " }"
PRINT #1, " ScaledVersion"
PRINT #1, " {"
PRINT #1, " Light"
PRINT #1, " {"
PRINT #1, " sunlightColor = 1,1,1,1.0"
PRINT #1, " sunlightIntensity = 0.55"
PRINT #1, " scaledSunlightColor = 1,1,1,1.0"
PRINT #1, " scaledSunlightIntensity = 0.55"
PRINT #1, " IVASunColor = 1,1,1,1.0"
PRINT #1, " IVASunIntensity = 0.55"
PRINT #1, " sunLensFlareColor = 1,1,1,1.0"
PRINT #1, " luminosity = 0"
PRINT #1, " ambientLightColor = 0,0,0,1.0"
PRINT #1, " givesOffLight = False"
PRINT #1, " }"
PRINT #1, " Material"
PRINT #1, " {"
PRINT #1, " emitColor0 = 0,0,0,1"
PRINT #1, " emitColor1 = 0,0,0,1"
PRINT #1, " sunspotColor = 0,0,0,1"
PRINT #1, " rimColor = 0,0,0,1"
PRINT #1, " }"
PRINT #1, " Coronas"
PRINT #1, " {"
PRINT #1, " Corona"
PRINT #1, " {"
PRINT #1, " rotation = 0"
PRINT #1, " speed = -1"
PRINT #1, " updateInterval = 5"
PRINT #1, " scaleLimitX = 5"
PRINT #1, " scaleLimitY = 5"
PRINT #1, " scaleSpeed = 0.007"
PRINT #1, ""
PRINT #1, " Material"
PRINT #1, " {"
PRINT #1, " texture = To_Boldly_Go/coronae/BlackCorona"
PRINT #1, " inverseFade = 2.553731"
PRINT #1, " }"
PRINT #1, " }"
PRINT #1, " Corona"
PRINT #1, " {"
PRINT #1, " rotation = 0"
PRINT #1, " speed = 1"
PRINT #1, " updateInterval = 5"
PRINT #1, " scaleLimitX = 5"
PRINT #1, " scaleLimitY = 5"
PRINT #1, " scaleSpeed = 0.009"
PRINT #1, ""
PRINT #1, " Material"
PRINT #1, " {"
PRINT #1, " texture = To_Boldly_Go/coronae/BlackCorona"
PRINT #1, " inverseFade = 2.553731"
PRINT #1, " }"
PRINT #1, " }"
PRINT #1, " }"
PRINT #1, " }"
PRINT #1, " }"
PRINT #1, "}"
CLUSTER = CLUSTER - 1
IF CLUSTER = 0 THEN
GOTO 111
END IF
CLUSTERNUM = CLUSTERNUM + 1
LOOP
111 END IF
END IF
'###########
'###Make the wiki file
OPEN "wikiEntry.html" FOR OUTPUT AS #10 'Creates the wiki file
'******************************************************************************
FOR a_Star = 1 TO OSTAR
star_MassKg = 3.18168E+31 + (RND(1) * (3.18168E+32 - 3.18168E+31)) '###pick a star mass in the M stellar class range'
'#test value: feed in Kerbol's mass in real world kg: 1.7565459e28*113.2393
'#star_MassKg = 1.7565459e28*113.2393
'###########################'
'###STH 2017-0209 Do calculations to get star characteristics
star_Name$ = starNameList$(SOBJECTNUMBER)
star_Description$ = "VAL -" + STR$(a_Star) + " is a main sequence blue giant star."
CALL makeAStar(star_MassKg, star_Name$, star_Description$) '#call the subroutinue to make a star'
maxPlanets = 0
IF PENABLE$ = "y" THEN
maxPlanets = INT(RND * 5) '#how many planets in this system? Max of 5
IF maxPlanets > 0 THEN
PRINT #1, "@Kopernicus:FINAL"
PRINT #1, "{"
planetNumb = 1
planet_distanceMax = 0.5 * star_HillSphereRadius '#max distance is 1/2 of the star's hillSphere
theSemiMajorAxis = 0
FOR aPlanet = 1 TO maxPlanets
'#2017-0201 STH This could be turned into a CSV file of roman numerals read into an array
IF planetNumb = 1 THEN PNM$ = "I"
IF planetNumb = 2 THEN PNM$ = "II"
IF planetNumb = 3 THEN PNM$ = "III"
IF planetNumb = 4 THEN PNM$ = "IV"
IF planetNumb = 5 THEN PNM$ = "V"
thePlanetName$ = star_Name$ + " " + PNM$
'########################'
'#Pick a random planet template from what is read in'
keyIndex = 1 + INT(RND * (UBOUND(planetKey$))) 'want the range to be from 1 to end. Index 0 is the header
PLANETTYPE$ = planetKey$(keyIndex)
PLANETDESC$ = thePlanetDesc$(keyIndex)
PLANETRADI = thePlanetRadius(keyIndex)
PLANETMASS = thePlanetMass(keyIndex)
PLANETSTOCK$ = thePlanetStock$(keyIndex)
PLANETSOI = thePlanetSOI(keyIndex) 'really, this should be calculated from mass'
'planet_distanceMin = rocheLimit(star_MassKSP, PLANETMASS, PLANETRADI) '#innermost location for a planet is the rocheLimit
planet_distanceMin = star_RadiusKSP + INT(RND(1) * 100000000000) 'should be roche limit but isn't working
'####'
'########################'
IF PLANETSTOCK$ = "True" THEN
PRINT #1, " Body"
ELSE
PRINT #1, " +Body[" + PLANETTYPE$ + "]"
END IF
PRINT #1, " {"
PRINT #1, " %name = " + thePlanetName$
'#########'
IF PLANETSTOCK$ = "True" THEN
PRINT #1, " Template"
PRINT #1, " {"
PRINT #1, " name = "; PLANETTYPE$
PRINT #1, " }"
END IF
'########################'
'###Fill in property data'
'theDescription$ = thePlanetDesc$(keyIndex)
'theRadius$ = STR$(thePlanetRadius(keyIndex))
'theSphereOfInfluence$ = "" '#don't use the star's SOI
aPropertiesTemplate$ = thePropertiesTemplate$
'aPropertiesNode$ = propertyNode$(aPropertiesTemplate$, star_Description$, str$(star_RadiusKSP), str$(star_MassKSP), str$(star_stdGravitationalParameter), str$(star_surfaceGravity), "True", str$(star_RotationalPeriod), "", "", "", str$(star_SOI))
aPropertiesNode$ = propertyNode$(aPropertiesTemplate$, PLANETDESC$, STR$(PLANETRADI), "", "", "", "", "", "", "", "", STR$(PLANETSOI))
PRINT #1, aPropertiesNode$
'########################'
'########################'
'###Fill in orbit data'
theReferenceBody$ = star_Name$
theColour$ = ""
theMode$ = ""
theInclination$ = STR$(INT(RND * 360))
theEccentricity$ = ""
IF theSemiMajorAxis = 0 THEN
'#let the first planet fall somewhere between the roche limit and the frostline'
theSemiMajorAxis = planet_distanceMin + (RND(1) * (star_FrostLineKm - planet_distanceMin))
ELSE
theSemiMajorAxis = theSemiMajorAxis + (theSemiMajorAxis * 1.5) 'should be a value between 1.4 and 2.0
END IF
'#The planet's semimajoraxis should not be larger than the star's SOI
'# 'star_RadiusKSP and star_SOI are shared variables
'theSemiMajorAxis = star_RadiusKSP + (RND(1) * (star_SOI - star_RadiusKSP))
'theSemiMajorAxis = INT(RND * 10000000000) + 10000000
theLongitudeOfAscendingNode$ = "0"
theArgumentOfPeriapsis$ = STR$(INT(RND * 1000))
theMeanAnomalyAtEpoch$ = STR$(0)
theEpoch$ = STR$(0)
aOrbitTemp$ = theOrbitTemplate$
aOrbitNode$ = orbitNode$(aOrbitTemp$, theReferenceBody$, theColour$, theMode$, theInclination$, theEccentricity$, STR$(theSemiMajorAxis), theLongitudeOfAscendingNode$, theArgumentOfPeriapsis$, theMeanAnomalyAtEpoch$, theEpoch$)
PRINT #1, aOrbitNode$
'theSemiMajorAxis = theSemiMajorAxis * 1.5 '#the next semimajor axis should be beyond the present planet's SOI
'###End orbit data'
'########################'
'###33.3% chance of having a ring
RINGS = INT(RND * 3)
IF RINGS = 0 THEN
theAngle$ = "0"
theOuterRadius$ = "3000"
theInnerRadius$ = "2000"
theTexture$ = STR$(INT(RND * 3) + 1)
theColour$ = "1.0,0.1,0.1,1.0"
theLockRotation$ = "false"
theUnlit$ = "false"
aRingsTemp$ = theRingsTemplate$
aRingNode$ = ringNode$(aRingsTemp$, theAngle$, theOuterRadius$, theInnerRadius$, theRingTexture$, theColour$, theLockRotation$, theUnlit$)
PRINT #1, aRingNode
END IF
PRINT #1, " }"
'########################'
'########################'
'####
'#25% chance of there being a moon
MAXMOON = INT(RND * 4)
FOR theMoonNumb = 1 TO MAXMOON
theMoonName$ = thePlanetName$ + " " + STR$(theMoonNumb)
moonSEMIMAJORAXIS = INT(RND * 50000000) + 11000000
INCLINATION = INT(RND * 360)
PRINT #1, " Body"
PRINT #1, " {"
PRINT #1, " name = " + theMoonName$
'#######'
'#We can be smarter about this by looking at radius of parent body
'#And only picking possible moons by picking things with radius less
'#than parent body
'#STH 2017-0203'
'IF PLANETTYPE$ = "Jool" THEN
IF PLANETRADI > 2000000000 THEN
DO WHILE PLANETTYPE$ = "Jool"
keyIndex = INT(RND * UBOUND(planetKey$))
PLANETTYPE$ = planetKey$(keyIndex)
LOOP
PRINT #1, " Template"
PRINT #1, " {"
PRINT #1, " name = "; PLANETTYPE$
PRINT #1, " }"
ELSE
PRINT #1, " Template"
PRINT #1, " {"
PRINT #1, " name = Gilly"
PRINT #1, " }"
END IF
'#########################'
'###Fill in orbit data'
theReferenceBody$ = thePlanetName$
theColour$ = ""
theMode$ = ""
theInclination$ = STR$(INT(RND * 360))
theEccentricity$ = ""
theMoonSemiMajorAxis = INT(RND * 50000000) + 11000000
theLongitudeOfAscendingNode$ = ""
theArgumentOfPeriapsis$ = ""
theMeanAnomalyAtEpoch$ = ""
theEpoch$ = ""
aOrbitTemp$ = theOrbitTemplate$
aOrbitNode$ = orbitNode$(aOrbitTemp$, theReferenceBody$, theColour$, theMode$, theInclination$, theEccentricity$, STR$(theMoonSemiMajorAxis), theLongitudeOfAscendingNode$, theArgumentOfPeriapsis$, theMeanAnomalyAtEpoch$, theEpoch$)
PRINT #1, aOrbitNode$
PRINT #1, " }"
MOBJECTNUMBER = MOBJECTNUMBER + 1
NEXT
planetNumb = planetNumb + 1
POBJECTNUMBER = POBJECTNUMBER + 1
NEXT
IF ASTTOG$ = "y" THEN
MAXAST = INT(RND * 2)
FOR ASTNUMBER = 1 TO MAXAST
PRINT #1, " Body"
PRINT #1, " {"
PRINT #1, " name = " + star_Name$ + " " + STR$(ASTNUMBER)
PRINT #1, " Template"
PRINT #1, " {"
PRINT #1, " name = Gilly"
PRINT #1, " }"
PRINT #1, " Properties"
PRINT #1, " {"
PRINT #1, " description = When Jeb was originally shown a map of our galaxy he said 'Wow! Thats big! Dont suppose we get any rest stops out there do we?' This statement encouraged our scientists to look closer, And eventually this asteroid among many, Was discovered. Dont expect vending machines, And if you do find them... Dont expect candy. "
PRINT #1, " radius ="; INT(RND * 80000) + 5000
PRINT #1, " }"
theAstName$ = thePlanetName$ + " " + STR$(ASTNUMBER)
astSEMIMAJORAXIS = INT(RND * 10000000000) + 10000000
INCLINATION = INT(RND * 360)
PRINT #1, " Orbit"
PRINT #1, " {"
PRINT #1, " referenceBody = " + star_Name$
PRINT #1, " inclination =" + STR$(INCLINATION)
PRINT #1, " semiMajorAxis =" + STR$(astSEMIMAJORAXIS)
PRINT #1, " }"
PRINT #1, " PQS"
PRINT #1, " {"
PRINT #1, " Mods"
PRINT #1, " {"
PRINT #1, " VertexSimplexHeightAbsolute"
PRINT #1, " {"
PRINT #1, " seed ="; INT(RND * 100000)
PRINT #1, " }"
PRINT #1, " VertexHeightNoise"
PRINT #1, " {"
PRINT #1, " seed ="; INT(RND * 100000)
PRINT #1, " }"
PRINT #1, " }"
PRINT #1, " }"
PRINT #1, " }"
AOBJECTNUMBER = AOBJECTNUMBER + 1
NEXT
END IF
PRINT #1, "}"
END IF
END IF
SOBJECTNUMBER = SOBJECTNUMBER + 1
'REDSTARNUMBER = REDSTARNUMBER + 1
NEXT
'******************************************************************************
FOR a_Star = 1 TO BSTAR
star_MassKg = 4.17596E+30 + (RND(1) * (3.18168E+31 - 4.17596E+30)) '###pick a star mass in the M stellar class range'
'#test value: feed in Kerbol's mass in real world kg: 1.7565459e28*113.2393
'#star_MassKg = 1.7565459e28*113.2393
'###########################'
'###STH 2017-0209 Do calculations to get star characteristics
star_Name$ = starNameList$(SOBJECTNUMBER)
star_Description$ = "VAL -" + STR$(a_Star) + " is a main sequence blue-white giant star."
CALL makeAStar(star_MassKg, star_Name$, star_Description$) '#call the subroutinue to make a star'
maxPlanets = 0
IF PENABLE$ = "y" THEN
maxPlanets = INT(RND * 5) '#how many planets in this system? Max of 5
IF maxPlanets > 0 THEN
PRINT #1, "@Kopernicus:FINAL"
PRINT #1, "{"
planetNumb = 1
planet_distanceMax = 0.5 * star_HillSphereRadius '#max distance is 1/2 of the star's hillSphere
theSemiMajorAxis = 0
FOR aPlanet = 1 TO maxPlanets
'#2017-0201 STH This could be turned into a CSV file of roman numerals read into an array
IF planetNumb = 1 THEN PNM$ = "I"
IF planetNumb = 2 THEN PNM$ = "II"
IF planetNumb = 3 THEN PNM$ = "III"
IF planetNumb = 4 THEN PNM$ = "IV"
IF planetNumb = 5 THEN PNM$ = "V"
thePlanetName$ = star_Name$ + " " + PNM$
'########################'
'#Pick a random planet template from what is read in'
keyIndex = 1 + INT(RND * (UBOUND(planetKey$))) 'want the range to be from 1 to end. Index 0 is the header
PLANETTYPE$ = planetKey$(keyIndex)
PLANETDESC$ = thePlanetDesc$(keyIndex)
PLANETRADI = thePlanetRadius(keyIndex)
PLANETMASS = thePlanetMass(keyIndex)
PLANETSTOCK$ = thePlanetStock$(keyIndex)
PLANETSOI = thePlanetSOI(keyIndex) 'really, this should be calculated from mass'
'planet_distanceMin = rocheLimit(star_MassKSP, PLANETMASS, PLANETRADI) '#innermost location for a planet is the rocheLimit
planet_distanceMin = star_RadiusKSP + INT(RND(1) * 100000000000) 'should be roche limit but isn't working
'####'
'########################'
IF PLANETSTOCK$ = "True" THEN
PRINT #1, " Body"
ELSE
PRINT #1, " +Body[" + PLANETTYPE$ + "]"
END IF
PRINT #1, " {"
PRINT #1, " %name = " + thePlanetName$
'#########'
IF PLANETSTOCK$ = "True" THEN
PRINT #1, " Template"
PRINT #1, " {"
PRINT #1, " name = "; PLANETTYPE$
PRINT #1, " }"
END IF
'########################'
'###Fill in property data'
'theDescription$ = thePlanetDesc$(keyIndex)
'theRadius$ = STR$(thePlanetRadius(keyIndex))
'theSphereOfInfluence$ = "" '#don't use the star's SOI
aPropertiesTemplate$ = thePropertiesTemplate$
'aPropertiesNode$ = propertyNode$(aPropertiesTemplate$, star_Description$, str$(star_RadiusKSP), str$(star_MassKSP), str$(star_stdGravitationalParameter), str$(star_surfaceGravity), "True", str$(star_RotationalPeriod), "", "", "", str$(star_SOI))
aPropertiesNode$ = propertyNode$(aPropertiesTemplate$, PLANETDESC$, STR$(PLANETRADI), "", "", "", "", "", "", "", "", STR$(PLANETSOI))
PRINT #1, aPropertiesNode$
'########################'
'########################'
'###Fill in orbit data'
theReferenceBody$ = star_Name$
theColour$ = ""
theMode$ = ""
theInclination$ = STR$(INT(RND * 360))
theEccentricity$ = ""
IF theSemiMajorAxis = 0 THEN
'#let the first planet fall somewhere between the roche limit and the frostline'
theSemiMajorAxis = planet_distanceMin + (RND(1) * (star_FrostLineKm - planet_distanceMin))
ELSE
theSemiMajorAxis = theSemiMajorAxis + (theSemiMajorAxis * 1.5) 'should be a value between 1.4 and 2.0
END IF
'#The planet's semimajoraxis should not be larger than the star's SOI
'# 'star_RadiusKSP and star_SOI are shared variables
'theSemiMajorAxis = star_RadiusKSP + (RND(1) * (star_SOI - star_RadiusKSP))
'theSemiMajorAxis = INT(RND * 10000000000) + 10000000
theLongitudeOfAscendingNode$ = "0"
theArgumentOfPeriapsis$ = STR$(INT(RND * 1000))
theMeanAnomalyAtEpoch$ = STR$(0)
theEpoch$ = STR$(0)
aOrbitTemp$ = theOrbitTemplate$
aOrbitNode$ = orbitNode$(aOrbitTemp$, theReferenceBody$, theColour$, theMode$, theInclination$, theEccentricity$, STR$(theSemiMajorAxis), theLongitudeOfAscendingNode$, theArgumentOfPeriapsis$, theMeanAnomalyAtEpoch$, theEpoch$)
PRINT #1, aOrbitNode$
'theSemiMajorAxis = theSemiMajorAxis * 1.5 '#the next semimajor axis should be beyond the present planet's SOI
'###End orbit data'
'########################'
'###33.3% chance of having a ring
RINGS = INT(RND * 3)
IF RINGS = 0 THEN
theAngle$ = "0"
theOuterRadius$ = "3000"
theInnerRadius$ = "2000"
theTexture$ = STR$(INT(RND * 3) + 1)
theColour$ = "1.0,0.1,0.1,1.0"
theLockRotation$ = "false"
theUnlit$ = "false"
aRingsTemp$ = theRingsTemplate$
aRingNode$ = ringNode$(aRingsTemp$, theAngle$, theOuterRadius$, theInnerRadius$, theRingTexture$, theColour$, theLockRotation$, theUnlit$)
PRINT #1, aRingNode
END IF
PRINT #1, " }"
'########################'
'########################'
'####
'#25% chance of there being a moon
MAXMOON = INT(RND * 4)
FOR theMoonNumb = 1 TO MAXMOON
theMoonName$ = thePlanetName$ + " " + STR$(theMoonNumb)
moonSEMIMAJORAXIS = INT(RND * 50000000) + 11000000
INCLINATION = INT(RND * 360)
PRINT #1, " Body"
PRINT #1, " {"
PRINT #1, " name = " + theMoonName$
'#######'
'#We can be smarter about this by looking at radius of parent body
'#And only picking possible moons by picking things with radius less
'#than parent body
'#STH 2017-0203'
'IF PLANETTYPE$ = "Jool" THEN
IF PLANETRADI > 2000000000 THEN
DO WHILE PLANETTYPE$ = "Jool"
keyIndex = INT(RND * UBOUND(planetKey$))
PLANETTYPE$ = planetKey$(keyIndex)
LOOP
PRINT #1, " Template"
PRINT #1, " {"
PRINT #1, " name = "; PLANETTYPE$
PRINT #1, " }"
ELSE
PRINT #1, " Template"
PRINT #1, " {"
PRINT #1, " name = Gilly"
PRINT #1, " }"
END IF
'#########################'
'###Fill in orbit data'
theReferenceBody$ = thePlanetName$
theColour$ = ""
theMode$ = ""
theInclination$ = STR$(INT(RND * 360))
theEccentricity$ = ""
theMoonSemiMajorAxis = INT(RND * 50000000) + 11000000
theLongitudeOfAscendingNode$ = ""
theArgumentOfPeriapsis$ = ""
theMeanAnomalyAtEpoch$ = ""
theEpoch$ = ""
aOrbitTemp$ = theOrbitTemplate$
aOrbitNode$ = orbitNode$(aOrbitTemp$, theReferenceBody$, theColour$, theMode$, theInclination$, theEccentricity$, STR$(theMoonSemiMajorAxis), theLongitudeOfAscendingNode$, theArgumentOfPeriapsis$, theMeanAnomalyAtEpoch$, theEpoch$)
PRINT #1, aOrbitNode$
PRINT #1, " }"
MOBJECTNUMBER = MOBJECTNUMBER + 1
NEXT
planetNumb = planetNumb + 1
POBJECTNUMBER = POBJECTNUMBER + 1
NEXT
IF ASTTOG$ = "y" THEN
MAXAST = INT(RND * 2)
FOR ASTNUMBER = 1 TO MAXAST
PRINT #1, " Body"
PRINT #1, " {"
PRINT #1, " name = " + star_Name$ + " " + STR$(ASTNUMBER)
PRINT #1, " Template"
PRINT #1, " {"
PRINT #1, " name = Gilly"
PRINT #1, " }"
PRINT #1, " Properties"
PRINT #1, " {"
PRINT #1, " description = When Jeb was originally shown a map of our galaxy he said 'Wow! Thats big! Dont suppose we get any rest stops out there do we?' This statement encouraged our scientists to look closer, And eventually this asteroid among many, Was discovered. Dont expect vending machines, And if you do find them... Dont expect candy. "
PRINT #1, " radius ="; INT(RND * 80000) + 5000
PRINT #1, " }"
theAstName$ = thePlanetName$ + " " + STR$(ASTNUMBER)
astSEMIMAJORAXIS = INT(RND * 10000000000) + 10000000
INCLINATION = INT(RND * 360)
PRINT #1, " Orbit"
PRINT #1, " {"
PRINT #1, " referenceBody = " + star_Name$
PRINT #1, " inclination =" + STR$(INCLINATION)
PRINT #1, " semiMajorAxis =" + STR$(astSEMIMAJORAXIS)
PRINT #1, " }"
PRINT #1, " PQS"
PRINT #1, " {"
PRINT #1, " Mods"
PRINT #1, " {"
PRINT #1, " VertexSimplexHeightAbsolute"
PRINT #1, " {"
PRINT #1, " seed ="; INT(RND * 100000)
PRINT #1, " }"
PRINT #1, " VertexHeightNoise"
PRINT #1, " {"
PRINT #1, " seed ="; INT(RND * 100000)
PRINT #1, " }"
PRINT #1, " }"
PRINT #1, " }"
PRINT #1, " }"
AOBJECTNUMBER = AOBJECTNUMBER + 1
NEXT
END IF
PRINT #1, "}"
END IF
END IF
SOBJECTNUMBER = SOBJECTNUMBER + 1
'REDSTARNUMBER = REDSTARNUMBER + 1
NEXT
'******************************************************************************
FOR a_Star = 1 TO ASTAR
star_MassKg = 2.78397E+30 + (RND(1) * (4.17596E+30 - 2.78397E+30)) '###pick a star mass in the M stellar class range'
'#test value: feed in Kerbol's mass in real world kg: 1.7565459e28*113.2393
'#star_MassKg = 1.7565459e28*113.2393
'###########################'
'###STH 2017-0209 Do calculations to get star characteristics
star_Name$ = starNameList$(SOBJECTNUMBER)
star_Description$ = "KIRRIM -" + STR$(a_Star) + " is a main sequence white dwarf star, though not a white-dwarf star. It's complicated."
CALL makeAStar(star_MassKg, star_Name$, star_Description$) '#call the subroutinue to make a star'
maxPlanets = 0
IF PENABLE$ = "y" THEN
maxPlanets = INT(RND * 5) '#how many planets in this system? Max of 5
IF maxPlanets > 0 THEN
PRINT #1, "@Kopernicus:FINAL"
PRINT #1, "{"
planetNumb = 1
planet_distanceMax = 0.5 * star_HillSphereRadius '#max distance is 1/2 of the star's hillSphere
theSemiMajorAxis = 0
FOR aPlanet = 1 TO maxPlanets
'#2017-0201 STH This could be turned into a CSV file of roman numerals read into an array
IF planetNumb = 1 THEN PNM$ = "I"
IF planetNumb = 2 THEN PNM$ = "II"
IF planetNumb = 3 THEN PNM$ = "III"
IF planetNumb = 4 THEN PNM$ = "IV"
IF planetNumb = 5 THEN PNM$ = "V"